nimo10050 commented on issue #2649: URL: https://github.com/apache/shardingsphere/issues/2649#issuecomment-1236141213
> ShardingSphere design as: If there is write operation in the same thread and database connection, all the following read operations are from the master database to ensure data consistency. > > So if you using ShardingSphere, you can not query from slave after updated. > > FYI: https://shardingsphere.apache.org/document/current/en/features/read-write-split/core-features/ In my use case, the above description is incorrect。 case: ```java public class AccountService { @Transactional public void test(String userId, BigDecimal num) { // step1, in current transaction, insert a data accountMapper.insertAccount(new Account(userId, num)); // step 2, start a new transaction, query all data accountService2.test(); // step3, query all again. accountMapper.selectAll(); } } public class AccountService2 { @Transactional(propagation = Propagation.REQUIRES_NEW) public void test() { accountMapper.selectAll(); } } ``` result: step1:insert data to master db step2:data from master db step3: query data from slave db when step1 and step2 in the same connection,step2 dose not query data from master db。 why? it is bug? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
