This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 51dafb52ab [ISSUE #10656] Fix incorrect end timestamp recovery in 
tiered index files (#10657)
51dafb52ab is described below

commit 51dafb52ab10857c2c66128db207dde8f79744d2
Author: majialong <[email protected]>
AuthorDate: Wed Nov 25 11:32:03 2026 +0800

    [ISSUE #10656] Fix incorrect end timestamp recovery in tiered index files 
(#10657)
---
 .../apache/rocketmq/tieredstore/index/IndexStoreFile.java |  2 +-
 .../rocketmq/tieredstore/index/IndexStoreFileTest.java    | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git 
a/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/index/IndexStoreFile.java
 
b/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/index/IndexStoreFile.java
index 60d92b0c68..82ebb7dcbc 100644
--- 
a/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/index/IndexStoreFile.java
+++ 
b/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/index/IndexStoreFile.java
@@ -117,7 +117,7 @@ public class IndexStoreFile implements IndexFile {
         this.fileChannel = this.mappedFile.getFileChannel();
 
         this.beginTimestamp.set(timestamp);
-        this.endTimestamp.set(byteBuffer.getLong(INDEX_BEGIN_TIME_STAMP));
+        this.endTimestamp.set(byteBuffer.getLong(INDEX_END_TIME_STAMP));
         this.hashSlotCount.set(byteBuffer.getInt(INDEX_SLOT_COUNT));
         this.indexItemCount.set(byteBuffer.getInt(INDEX_ITEM_INDEX));
         this.flushNewMetadata(byteBuffer, indexItemMaxCount == 
this.indexItemCount.get() + 1);
diff --git 
a/tieredstore/src/test/java/org/apache/rocketmq/tieredstore/index/IndexStoreFileTest.java
 
b/tieredstore/src/test/java/org/apache/rocketmq/tieredstore/index/IndexStoreFileTest.java
index dbad2d1aba..60ebfc2a0b 100644
--- 
a/tieredstore/src/test/java/org/apache/rocketmq/tieredstore/index/IndexStoreFileTest.java
+++ 
b/tieredstore/src/test/java/org/apache/rocketmq/tieredstore/index/IndexStoreFileTest.java
@@ -229,6 +229,21 @@ public class IndexStoreFileTest {
         Assert.assertEquals(indexCount, indexStoreFile.getIndexItemCount());
     }
 
+    @Test
+    public void recoverEndTimestampTest() throws IOException {
+        long beginTimestamp = indexStoreFile.getTimestamp();
+        long endTimestamp = beginTimestamp + 10000L;
+        Assert.assertEquals(AppendResult.SUCCESS, indexStoreFile.putKey(
+            TOPIC_NAME, TOPIC_ID, QUEUE_ID, KEY_SET, MESSAGE_OFFSET, 
MESSAGE_SIZE, endTimestamp));
+        Assert.assertEquals(endTimestamp, indexStoreFile.getEndTimestamp());
+
+        indexStoreFile.shutdown();
+        indexStoreFile = new IndexStoreFile(storeConfig, beginTimestamp);
+
+        Assert.assertEquals(beginTimestamp, indexStoreFile.getTimestamp());
+        Assert.assertEquals(endTimestamp, indexStoreFile.getEndTimestamp());
+    }
+
     @Test
     public void doCompactionTest() {
         long timestamp = indexStoreFile.getTimestamp();

Reply via email to