Skip to content

Commit 622c807

Browse files
authored
[ISSUE #9233] Query message in tiered storage may fail for the first correct index file was not selected (#9234)
1 parent 630cef8 commit 622c807

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tieredstore/src/main/java/org/apache/rocketmq/tieredstore/index/IndexStoreService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,10 @@ public CompletableFuture<List<IndexItem>> queryAsync(
229229
CompletableFuture<List<IndexItem>> future = new CompletableFuture<>();
230230
try {
231231
readWriteLock.readLock().lock();
232+
long firstFileTimeStamp = this.timeStoreTable.lowerKey(beginTime) == null ?
233+
this.timeStoreTable.firstKey() : this.timeStoreTable.lowerKey(beginTime);
232234
ConcurrentNavigableMap<Long, IndexFile> pendingMap =
233-
this.timeStoreTable.subMap(beginTime, true, endTime, true);
235+
this.timeStoreTable.subMap(firstFileTimeStamp, true, endTime, true);
234236
List<CompletableFuture<Void>> futureList = new ArrayList<>(pendingMap.size());
235237
ConcurrentHashMap<String /* queueId-offset */, IndexItem> result = new ConcurrentHashMap<>();
236238

0 commit comments

Comments
 (0)