Skip to content

Conversation

@maple525866
Copy link
Contributor

@maple525866 maple525866 commented Nov 2, 2025

Ⅰ. Describe what this PR did

When the primary key is of type BINARY(16), pkVal is actually a byte[] array.

  • For a byte[] array, StringBuilder.append(Object obj) calls obj.toString().

  • The default toString() method of byte[] returns a string representing the memory address of the Java object.

  • This address string is stored in the pk field of the global lock table lock_table.

The problem lies in the undo_log serialization logic: it correctly serializes the contents of the byte[] array, not the memory address.

My solution: Based on the buildLockKey, I performed special processing on the byte[] type. Calling ArrayUtils.toString(pkVal) returns the actual content instead of the memory address.

In addition, I added corresponding unit tests to verify the correctness of the modification.

Ⅱ. Does this pull request fix one issue?

fixes #7738

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

Ⅳ. Describe how to verify it

mvn clean test

Ⅴ. Special notes for reviews

@codecov
Copy link

codecov bot commented Nov 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.61%. Comparing base (6f1e37d) to head (c3cbc58).
⚠️ Report is 1 commits behind head on 2.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7761      +/-   ##
============================================
- Coverage     67.62%   67.61%   -0.01%     
- Complexity      992      994       +2     
============================================
  Files          1323     1323              
  Lines         50155    50157       +2     
  Branches       5928     5929       +1     
============================================
- Hits          33915    33912       -3     
- Misses        13316    13317       +1     
- Partials       2924     2928       +4     
Files with missing lines Coverage Δ
.../rm/datasource/exec/BaseTransactionalExecutor.java 75.11% <100.00%> (+0.23%) ⬆️

... and 7 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@slievrly slievrly changed the title bugfix: special handling is applied to the Byte[] type to ensure the correct primary key value. bugfix: fix Byte[] type to ensure the correct primary key value. Nov 2, 2025
@slievrly slievrly added this to the 2.6.0 milestone Nov 2, 2025
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

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

LGTM

@slievrly slievrly merged commit 50879a4 into apache:2.x Nov 2, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

全局锁的键值与 undo_log 记录中的值不一致导致回滚失败

2 participants