balderdashy / sails

Realtime MVC Framework for Node.js
https://sailsjs.com
MIT License
22.83k stars 1.95k forks source link

Table data not reflected in read data store after update in write data store #7019

Open thiruopti opened 4 years ago

thiruopti commented 4 years ago

Node version: 12.x Sails version (sails):1.0.x ORM hook version (sails-hook-orm): 3.1.0 DB adapter & version (e.g. sails-mysql@5.55.5): sails-mysql@1.0.1 Skipper adapter & version (e.g. skipper-s3@5.55.5): skipper-s3@0.6.0


We using two data stores for database operations. One connection is used for reading data from read database. Another one used for Create/Update/Delete mysql operations. What's the issue we faced is we can't able to get updated data in read data store immediately after certain time periods or request calls. We have to restart the sails app in order to get latest data from read data store. Is that anything we missed to configure with multi data store configurations ? Mysql Used : AWS RDS Server: EC2 Instance Sample connection string:

This is the sample connection string we used default: { adapter: 'sails-mysql', user: 'root', password: '', host: 'localhost', // RDS database database: 'test', multipleStatements: true, port: 3306, pool: true, // ssl: true, url: 'mysql://root@localhost:3306/test' }, writeSqlserver: { adapter: 'sails-mysql', user: 'root', password: '', host: 'localhost', // RDS database database: 'test', multipleStatements: true, port: 3306, pool: true, // ssl: true, url: 'mysql://root@localhost:3306/test },

Sample Find query: await Users.findOne({userId:1})

sailsbot commented 4 years ago

@thiruopti Thanks for posting! We'll take a look as soon as possible.

In the mean time, there are a few ways you can help speed things along:

Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.

For help with questions about Sails, click here.

eashaw commented 4 years ago

Hi @thiruopti, We were looking at this issue and we had some questions about your use case. We understand why you have two databases but why do you have two datastores in your config? Would you be able to create a minimal Sails repo that recreates this issue so we can further examine it?