[ISSUE #10656] Fix incorrect end timestamp recovery in tiered index files#10657
[ISSUE #10656] Fix incorrect end timestamp recovery in tiered index files#10657majialoong wants to merge 2 commits into
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Fixes a copy-paste bug in IndexStoreFile constructor where endTimestamp was incorrectly recovered from INDEX_BEGIN_TIME_STAMP (offset 4) instead of INDEX_END_TIME_STAMP (offset 12).
Findings
-
[Info]
IndexStoreFile.java:117— The fix is correct. The write path (lines 192-193) storesbeginTimestampatINDEX_BEGIN_TIME_STAMPandendTimestampatINDEX_END_TIME_STAMP. The old read was using the wrong offset, meaning after recovery,endTimestampwould hold the same value asbeginTimestamp, breaking time-range queries on recovered index files. -
[Info]
IndexStoreFileTest.java— Good regression test. It writes an index entry with a distinctendTimestamp, reopens the file, and verifies recovery. Consider also testing the edge case whereendTimestamp == beginTimestamp(single-entry file) to ensure no off-by-one. -
[Info] The fix is minimal (1-line source change + test) and directly addresses the root cause. No compatibility concerns since this is a bug fix in the recovery path — the on-disk format is unchanged.
Verdict
Clean fix with proper test coverage. LGTM.
Automated review by github-manager-bot
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10657 +/- ##
=============================================
- Coverage 48.32% 48.21% -0.11%
+ Complexity 13490 13464 -26
=============================================
Files 1380 1380
Lines 101031 101044 +13
Branches 13092 13094 +2
=============================================
- Hits 48825 48721 -104
- Misses 46247 46341 +94
- Partials 5959 5982 +23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Fixes incorrect endTimestamp recovery in tiered store index files — the constructor was reading from INDEX_BEGIN_TIME_STAMP offset instead of INDEX_END_TIME_STAMP when restoring the end timestamp from the mapped file buffer.
Findings
- [Critical]
IndexStoreFile.java:117— The original code readsendTimestampfrom the wrong buffer offset (INDEX_BEGIN_TIME_STAMP). This means after recovery, the index file'sendTimestampwould be set to the begin timestamp, breaking any logic that depends on accurate end timestamps (e.g., compaction decisions, time-range queries). - [Info]
IndexStoreFileTest.java— NewrecoverEndTimestampTestcorrectly validates the fix by writing an entry with a known end timestamp, shutting down, recovering, and asserting the end timestamp is preserved.
Verdict
Clean one-line bug fix with appropriate test coverage. The fix is clearly correct — the variable name endTimestamp should be initialized from INDEX_END_TIME_STAMP, not INDEX_BEGIN_TIME_STAMP.
Automated review by github-manager-bot
Which Issue(s) This PR Fixes
Brief Description
Fix
IndexStoreFileto restoreendTimestampfromINDEX_END_TIME_STAMPand add a regression test.How Did You Test This Change?
Added a test that writes an index, reopens the file, and verifies that its end timestamp is recovered correctly with and without mmap writes.