darkaquarius opened a new issue #14976: URL: https://github.com/apache/shardingsphere/issues/14976
there are two datasources used in our project. old datasource's configuration is, only shards tables, do NOT shards database:  new datasource's configuration is, we shards both databases and tables:  The datasources are:  We use the two datasources by extending spring AbstractRoutingDataSource ``` public class DynamicDataSource extends AbstractRoutingDataSource { @Override protected Object determineCurrentLookupKey() { return DynamicDataSourceHolder.getDataSource(); } } ``` DynamicDataSourceHolder uses ThreadLocal to choose either old datasource or new datasource. We read the new datasource first and then write into new datasource by multithreading, as the following:  But sometimes, we find that it wrote to the old dataSource! For convenience, we added some logs in InlineShardingAlgorithm:  The logs are:  First, we found the new datasource's sharding rules, but then, when we wrote, we unexpectedly found the old datasource sharding rules, so we failed to write data! And then, we execute the code again, the we succeed!  We counted it, about 100,000 executions will report an error once, Does anyone know why? -- 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]
