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 2021/01/13 08:02:56 UTC

[GitHub] [shardingsphere] ben905713861 opened a new issue #9013: Seata-global-lock in Sharding-Proxy(SeataAT transaction mode) is invalid

ben905713861 opened a new issue #9013:
URL: https://github.com/apache/shardingsphere/issues/9013


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   4.1.1
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   When I use Seata-AT transaction in ShardingSphere-Proxy, I open 2 mysql-client to simulate resource compete. I open transaction:
   (proxy使用Seata-AT事务模式,打开两个mysql客户端,分别开启事务)
   Client1:
   ```sql
   BEGIN;
   ```
   Client2:
   ```sql
   BEGIN;
   ```
   
   After, I send the same `UPDATE` SQL in 2 clients:
   Client1:
   ```sql
   update user set money=money-1 where id=1;
   (success)
   ```
   Client2:
   ```sql
   update user set money=money-1 where id=1;
   (success!!!)
   ```
   The client2 is success actually( It is not natural), and this time I can see seata-server thows exception( It is natural):
   (向mysql两个客户端先后发送相同的update语句模拟资源锁竞争,第二个客户端居然成功了(这是不正常的),此时seata服务抛出全局锁获取异常(这是正常现象))
   ```
   BranchTransactionException: Global lock acquire failed xid = 172.16.2.65:8091:92644548343500800 branchId = 92644578118864897
   ```
   
   ###conclusion
   Sharding-proxy can't handle seata-global-lock-exception correctly.
   (Sharding-proxy不能正确处理seata全局锁异常)
   
   
   the server.yml is:
   ```
   authentication:
     users:
       root:
         password: 12345678
   props:
     proxy.transaction.type: BASE
     sql.show: true
   ```
   
   register.conf is:
   ```
   registry {
     type = "nacos"
     nacos {
       serverAddr = "127.0.0.1:8848"
       namespace = ""
       cluster = "default"
       group = "SEATA_GROUP"
       application = "seata-server"
     }
   }
   config {
     type = "nacos"
     nacos {
       serverAddr = "127.0.0.1:8848"
       namespace = ""
       cluster = "default"
       group = "SEATA_GROUP"
     }
   }
   ```
   
   seata.conf is:
   ```
   sharding.transaction.seata.at.enable = true
   client {
       application.id = test
       transaction.service.group = my_test_tx_group
   }
   ```
   


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

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