Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public IndexStoreFile(MessageStoreConfig storeConfig, long timestamp) throws IOE
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,21 @@ public void recoverFileTest() throws IOException {
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();
Expand Down
Loading