fix: correct end timestamp recovery in IndexStoreFile to read INDEX_END_TIME_STAMP instead of INDEX_BEGIN_TIME_STAMP - #10687
Conversation
…ND_TIME_STAMP instead of INDEX_BEGIN_TIME_STAMP
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
One-line bug fix: the recovery constructor of IndexStoreFile was reading endTimestamp from the wrong offset constant (INDEX_BEGIN_TIME_STAMP at offset 4 instead of INDEX_END_TIME_STAMP at offset 12). This caused endTimestamp to be incorrectly initialized to beginTimestamp's value during recovery.
Findings
-
[Critical]
tieredstore/src/main/java/org/apache/rocketmq/tieredstore/index/IndexStoreFile.java:117— This is a real correctness bug. The write path (lines 192-193) storesendTimestampatINDEX_END_TIME_STAMP, but the recovery constructor read fromINDEX_BEGIN_TIME_STAMP. The fix is correct and minimal. -
[Info] No new test is added for this fix. Consider adding a test that creates an
IndexStoreFile, writes data, then reconstructs via the recovery constructor and verifies thatendTimestampmatches the original value (notbeginTimestamp). This would prevent regression.
Overall
Clear, correct fix for a copy-paste bug. The change is minimal and precisely targets the issue. Would recommend adding a regression test if feasible. LGTM.
Automated review by github-manager-bot
Which Issue(s) This PR Fixes
Brief Description
The recovery constructor of
IndexStoreFilereadsendTimestampfromINDEX_BEGIN_TIME_STAMP(offset 4) instead ofINDEX_END_TIME_STAMP(offset 12).The write path (lines 192-193) correctly stores
endTimestampatINDEX_END_TIME_STAMP:But the recovery constructor (line 117) reads from the wrong offset:
This causes the end timestamp to become the begin timestamp after reopening a tiered index file, which can cause valid query results to be incorrectly skipped.
How Did You Test This Change?
The fix is a one-line offset correction. The change is trivially verified by inspection: the constant
INDEX_END_TIME_STAMP = 12is used correctly in the write path but was incorrectly replaced withINDEX_BEGIN_TIME_STAMP = 4in the recovery path. No functional logic change.