jianliu commented on pull request #11587:
URL: https://github.com/apache/shardingsphere/pull/11587#issuecomment-898447941


   @tristaZero @TeslaCN  Sorry for the deviation of the previous reason 
analysis.
   I have add a lot of logs to reproduce error. and I have added a comment to  
the issue like below.
   
   I have made a mistake when analyz the reason because of missing an important 
info,that between pre tps and next tps.
   ```
   #first statements
   set autocommit=false     -- sql1:thread1
   select  * from tablexx where sharding_key=?  -- sql2:thread2
   update  tablexx set x=x where sharding_key=?  -- sql3:thread3
   commit -- sql4:thread4
   context.flush 
   close resources because there is no transaction yet after commit
   
   #the second sql by framework (hikari)
   set autocommit=true-- sql1:thread10 this sql is request by datasource 
framework when connection is close(back to pool)
   context.flush
   close resources because there is no transaction at all
   
   #the thrid statement 
   set autocommit=false     -- sql1:thread6
   select  * from tablexx where sharding_key=?  -- sql2:thread7
   ```
   Here is the logs:
   
![image](https://user-images.githubusercontent.com/1589099/129360520-156f26e7-3960-47f9-b844-cdab850554c4.png)
   
   The second sql (setAutoCommit(true) between the first and the thrid 
statement send by framework cause this erorr,because it removes the third 
sql(setAutoCommit:false) `s connectionPostProcessor,and lead this error finally.
   
   The PR could resolve this error too. or you could make close resources and 
add resources synchronzied,it`s alose resolve this issue too.


-- 
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]


Reply via email to