Skip to content
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: Fixed that the same record has different lowkeys due to mixed case of table names #6678

Merged
merged 7 commits into from
Jul 16, 2024

Conversation

GoodBoyCoder
Copy link
Contributor

@GoodBoyCoder GoodBoyCoder commented Jul 15, 2024

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

When the database is case-insensitive, if different services use table names with different case to query the same record, the lock RowKey will be inconsistent, causing the same global transaction lock to fail to re-enter. This PR unifies the record table name of TableMetaCache with the actual converted table name to avoid this situation.

Ⅱ. Does this pull request fix one issue?

fixes #6612

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Seata Version: 2.0.0
Database: oracle-xe-11g with JDBC ojdbc6:11.2.0.4.0
How to reproduce? using Oracle database as an example. In a GlobalTransactional
Service A: Use SQL1 - update stock_tbl set count = count - ? where id= "1"
Service B: Use SQL2 - update stock_TBL set count = count - ? where id = "1"

The RowKey generated by service A is resourceId^^^stock_tbl^^^1, while service B is resourceId^^^stock_TBL^^^1
The result is that Service A cannot acquire global lock.

Using the same case, the transaction can be committed normally after modification

Ⅴ. Special notes for reviews

It should be noted that after upgrading, if there are uncleared locks in the old version, there may be lock conflicts, causing transactions to roll back.

Copy link

codecov bot commented Jul 15, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.

Project coverage is 50.86%. Comparing base (e8ea2cc) to head (192b7a4).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6678      +/-   ##
============================================
+ Coverage     50.84%   50.86%   +0.02%     
- Complexity     5831     5836       +5     
============================================
  Files          1051     1051              
  Lines         36325    36341      +16     
  Branches       4317     4321       +4     
============================================
+ Hits          18468    18486      +18     
+ Misses        16003    15995       -8     
- Partials       1854     1860       +6     
Files Coverage Δ
.../datasource/sql/struct/cache/DmTableMetaCache.java 83.14% <100.00%> (ø)
...asource/sql/struct/cache/OracleTableMetaCache.java 67.30% <100.00%> (ø)
...rce/sql/struct/cache/PostgresqlTableMetaCache.java 74.74% <75.00%> (+0.02%) ⬆️
...urce/sql/struct/cache/SqlServerTableMetaCache.java 78.89% <75.00%> (-0.31%) ⬇️

... and 5 files with indirect coverage changes

@funky-eyes funky-eyes changed the title Bugfix: Fixed that the same record has different lowkeys due to mixed case of table names bugfix: Fixed that the same record has different lowkeys due to mixed case of table names Jul 15, 2024
Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Please register this PR along with author information in 2.x.md

@funky-eyes funky-eyes added type: bug Category issues or prs related to bug. DB: Oracle Relate to seata Oracle module/rm-datasource rm-datasource module mode: AT AT transaction mode labels Jul 16, 2024
@funky-eyes funky-eyes added this to the 2.2.0 milestone Jul 16, 2024
@funky-eyes funky-eyes merged commit 1c0a442 into apache:2.x Jul 16, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DB: Oracle Relate to seata Oracle mode: AT AT transaction mode module/rm-datasource rm-datasource module multilingual type: bug Category issues or prs related to bug.
Projects
None yet
2 participants