Skip to content
Closed
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 @@ -310,6 +310,9 @@ public long getMinOffsetInQueue(String topic, int queueId) {
if (minOffsetInTieredStore < 0) {
return minOffsetInNextStore;
}
if (minOffsetInNextStore < 0) {
return minOffsetInTieredStore;
}
return Math.min(minOffsetInNextStore, minOffsetInTieredStore);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ public void testGetMinOffsetInQueue() {

Mockito.when(flatFile.getConsumeQueueMinOffset()).thenReturn(10L);
Assert.assertEquals(10L, currentStore.getMinOffsetInQueue(mq.getTopic(), mq.getQueueId()));

// When local store returns -1 (no valid offset), tiered store offset should be used
long tieredOffset = flatFile.getConsumeQueueMinOffset();
Assert.assertTrue("tiered offset should be valid for this test", tieredOffset >= 0);
Mockito.when(defaultStore.getMinOffsetInQueue(anyString(), anyInt())).thenReturn(-1L);
Assert.assertEquals(tieredOffset, currentStore.getMinOffsetInQueue(mq.getTopic(), mq.getQueueId()));
}

@Test
Expand Down