bugfix: fixes SQL Server row locks are not released in Redis mode.#8072
bugfix: fixes SQL Server row locks are not released in Redis mode.#8072maple525866 wants to merge 3 commits intoapache:2.xfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.x #8072 +/- ##
=========================================
Coverage 72.12% 72.12%
Complexity 872 872
=========================================
Files 1320 1320
Lines 50550 50553 +3
Branches 6026 6027 +1
=========================================
+ Hits 36459 36463 +4
+ Misses 11101 11097 -4
- Partials 2990 2993 +3
🚀 New features to boost your workflow:
|
funky-eyes
left a comment
There was a problem hiding this comment.
I believe this has nothing to do with Redis. The ConnectionContext#buildLockKeys method coincidentally uses ; as the separator for Seata's global lock. Replacing ; with , only affects the conversion process in the convertToLockDO method and has no effect on the logic for assembling the global lock on the client side.
A more thorough solution would be to convert the global lock constructed on the client side into a base64-encoded format with hidden symbol delimiters. I have implemented a version locally, but the changes are quite extensive and require multi-version negotiation capabilities to achieve backward compatibility.
Ⅰ. Describe what this PR did
Core Issue:
ROW_LOCK_KEY_SPLIT_CHAR = ";"is a global single-character delimiter used to concatenate multiplerowKeyvalues into a single string. However, the sub-elementrowKeyitself contains aresourceId, and in SQL Server scenarios,resourceIdalways contains a semicolon (;). This delimiter conflicts with the content being delimited, causing an irreversible "concatenation → splitting" process.Scope of Impact:
Only affects Redis storage modes (RedisLocker, RedisLuaLocker, GlobalLockRedisServiceImpl).
DB storage mode (LockStoreDataBaseDAO) stores tables row-by-row LockDO, which does not involve semicolon concatenation and is unaffected.
File storage mode is similarly unaffected.
Any scenario other than SQL Server where a semicolon might appear in the
resourceIdwill encounter this issue.My Fix:
In the final step of constructing the
rowKey, usereplace(";", "^^^")to eliminate the character conflict once and for all.Ⅱ. Does this pull request fix one issue?
fixes #8033
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
I have verified the correctness of the changes by adding the corresponding unit tests.
mvn clean test
Ⅴ. Special notes for reviews