[#10421] Fix Timer message rocksdb use wrong cache key.#10422
Open
echooymxq wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10422 +/- ##
=============================================
- Coverage 48.05% 48.01% -0.04%
+ Complexity 13303 13299 -4
=============================================
Files 1377 1377
Lines 100611 100612 +1
Branches 12991 12991
=============================================
- Hits 48347 48310 -37
Misses 46348 46348
- Partials 5916 5954 +38 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@zk-drizzle help review it. |
oss-taishan-ai
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Fixes #10421 — DELETE_KEY_CACHE_FOR_TIMER used raw byte[] as Guava cache key, causing identity-based lookups to always miss. Switches to ByteBuffer for content-equality semantics.
Findings
- [Correctness] ✅ Changing cache key from
byte[]toByteBufferproperly uses content-basedequals()/hashCode(), which is the correct fix for the ghost record issue. - [Correctness]
⚠️ Line 87-88: The cache declarationCache<byte[], byte[]>appears unchanged in the diff — please verify the cache type is also updated toCache<ByteBuffer, byte[]>to match theByteBuffer.wrap()calls at lines 357 and 359. - [Correctness]
⚠️ ByteBuffer.wrap(keyBytes).equals()compares fromposition()tolimit(). Sincewrap()sets position=0 and limit=array.length, this works correctly for equal-length arrays. However, if key lengths could differ, consider usingByteBuffer.wrap(keyBytes, offset, length)consistently. - [Tests]
⚠️ No new tests visible in this diff. The bug is about cache key identity vs equality — recommend adding a unit test that verifiesDELETE+UPDATEfor the same timer key results in the UPDATE being correctly skipped. - [Compatibility] ✅ No public API changes. Internal implementation detail only.
Suggestions
- Ensure cache type declaration matches usage:
Cache<ByteBuffer, byte[]>(notCache<byte[], byte[]>) - Add a test case that creates a DELETE record and an UPDATE record for the same timer key, and verifies the UPDATE does not re-insert the deleted key
- Consider adding a brief comment explaining why
ByteBufferis used instead ofbyte[](identity vs content equality)
Automated review by github-manager-bot
RongtongJin
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #10421