-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: SQLIntegrityConstraintViolationException capture incorrectly when inserting a globallock #6833
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/apache/incubator-seata/blob/2.x/changes/zh-cn/2.x.md
https://github.com/apache/incubator-seata/blob/2.x/changes/en-us/2.x.md
请在上述md文件中登记pr信息和作者信息
Please register pr information and author information in the above md file
server/src/main/java/org/apache/seata/server/storage/db/lock/LockStoreDataBaseDAO.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/seata/server/storage/db/lock/LockStoreDataBaseDAO.java
Outdated
Show resolved
Hide resolved
根据这个堆栈,其实可以看到批量插入的时候,nextException是SQLIntegrityConstraintViolationException,如果存在其他异常,可能是数据库之类的异常,这种情况应该属于sqlexception,也不需要额外处理,直接抛出去即可 |
我用mysql测试时,SQLIntegrityConstraintViolationException在cause中, 但我写单元测试时发现, h2的SQLIntegrityConstraintViolationException在nextException中 |
nextException并不会在日志中打印出来,因此我最后选择抛出nextException,可以更好的知道是什么异常 |
server/src/main/java/org/apache/seata/server/storage/db/lock/LockStoreDataBaseDAO.java
Show resolved
Hide resolved
Error: Failures: |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.x #6833 +/- ##
============================================
+ Coverage 52.41% 52.43% +0.02%
- Complexity 6379 6384 +5
============================================
Files 1080 1080
Lines 37565 37575 +10
Branches 4451 4457 +6
============================================
+ Hits 19691 19704 +13
+ Misses 15923 15920 -3
Partials 1951 1951
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you for your contributions to Seata. If possible, please send your Dingtalk contact information to my email, and I will invite you to join the Seata developer group. |
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
fixes #6822
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews