You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/10/10 06:37:39 UTC

[GitHub] [shardingsphere] lyf200581105 opened a new issue, #19503: Sharding-jdbc Can't findById after insert the data

lyf200581105 opened a new issue, #19503:
URL: https://github.com/apache/shardingsphere/issues/19503

   Using shardingsphere-jdbc-core 5.1.2 + spring jpa, only sharding tables, using LOCAL Transaction only.
   DB: AWS Aurora
   Both read and write operations are using the master endpoint
   
   Using Jmeter to do some performance test
   step 1: call create API to insert data to DB and return id
   step 2: call get API with ID returned by step1 to query the data by Id, about 70% of results showed data not found(please refer to attached log)
   ![image](https://user-images.githubusercontent.com/49605984/180646918-56598000-47bb-4ee8-b811-2a2f93cfafe5.png)
   
   
   But if pause about 30ms between step1 and step2,  or or add **@Transactional** with getting method(like below ), then all queries of step2 return successfully 
      @Transactional
       @Override
       public TestModel getById(Long id) {
           Optional<TestModel> optional = repository.findById(id);
           if(!optional.isPresent()) {
               throw new RuntimeException("TestModel [" + id + "] not found");
           }
           return optional.get();
       }
   
   I saw there is a statement for LOCAL Transaction as below
   "There is no loss in performance, but strong consistency and final consistency cannot be guaranteed."
   
   Is this behavior correct? Need to use @transactional  for query operation to guarantee consistency?
   
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] closed issue #19503: Sharding-jdbc Can't findById after insert the data

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #19503: Sharding-jdbc Can't findById after insert the data
URL: https://github.com/apache/shardingsphere/issues/19503


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] lyf200581105 commented on issue #19503: Sharding-jdbc Can't findById after insert the data

Posted by GitBox <gi...@apache.org>.
lyf200581105 commented on issue #19503:
URL: https://github.com/apache/shardingsphere/issues/19503#issuecomment-1193620221

   > Hi @lyf200581105, thank you for your feedback. Can you show the original sql which send to ShardingSphere?
   
   Thanks for your reply.
   I'm using jpa API: repository.findById(id), the original search sql is like below:
   
   Hibernate: select testmodel0_.id as id1_0_0_, testmodel0_.create_time as create_t2_0_0_, testmodel0_.last_update_time as last_upd3_0_0_, testmodel0_.model_name as model_na4_0_0_, testmodel0_.module_res_id as module_r5_0_0_ from db_test testmodel0_ where testmodel0_.id=?
   
   2022-07-19T08:57:54.998 INFO [http-apr-0.0.0.0-8080-exec-9] org.apache.shardingsphere.infra.executor.sql.log.SQLLogger.log-74 | Logic SQL: select testmodel0_.id as id1_0_0_, testmodel0_.create_time as create_t2_0_0_, testmodel0_.last_update_time as last_upd3_0_0_, testmodel0_.model_name as model_na4_0_0_, testmodel0_.module_res_id as module_r5_0_0_ from db_test testmodel0_ where testmodel0_.id=?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] lyf200581105 commented on issue #19503: Sharding-jdbc Can't findById after insert the data

Posted by GitBox <gi...@apache.org>.
lyf200581105 commented on issue #19503:
URL: https://github.com/apache/shardingsphere/issues/19503#issuecomment-1298369880

   hello
   Any update for this?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #19503: Sharding-jdbc Can't findById after insert the data

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #19503:
URL: https://github.com/apache/shardingsphere/issues/19503#issuecomment-1365643413

   From your logs, it seems that insert and select were executed in different threads, so probably 2 threads were using different db connections. If the transaction isolation is not `READ UNCOMMITTED`, how could you make sure the select operation is performed after transaction committed?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] lyf200581105 commented on issue #19503: Sharding-jdbc Can't findById after insert the data

Posted by GitBox <gi...@apache.org>.
lyf200581105 commented on issue #19503:
URL: https://github.com/apache/shardingsphere/issues/19503#issuecomment-1367020815

   @TeslaCN  Actually the select thread begins after the insert thread is executed, and it uses the insert result to search (id is generated by insert operation), which means when the select thread starts, the insert transaction is already committed.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on issue #19503: Sharding-jdbc Can't findById after insert the data

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #19503:
URL: https://github.com/apache/shardingsphere/issues/19503#issuecomment-1193543259

   Hi @lyf200581105, thank you for your feedback.  Can you show the original sql which send to ShardingSphere?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #19503: Sharding-jdbc Can't findById after insert the data

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #19503:
URL: https://github.com/apache/shardingsphere/issues/19503#issuecomment-1407259396

   Closed due to no response.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] commented on issue #19503: Sharding-jdbc Can't findById after insert the data

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #19503:
URL: https://github.com/apache/shardingsphere/issues/19503#issuecomment-1272349266

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #19503: Sharding-jdbc Can't findById after insert the data

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #19503:
URL: https://github.com/apache/shardingsphere/issues/19503#issuecomment-1367025677

   Could you show us your configuration?
   Consider enabling logs by `sql-show: true` and check actual SQL execution.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang closed issue #19503: Sharding-jdbc Can't findById after insert the data

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #19503: Sharding-jdbc Can't findById after insert the data
URL: https://github.com/apache/shardingsphere/issues/19503


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org