Skip to content

Commit dca7c06

Browse files
authored
feat(s3stream): add logs on completion of timeout read request (AutoMQ#1227)
Signed-off-by: Shichao Nie <[email protected]>
1 parent 2c37dc5 commit dca7c06

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

s3stream/src/main/java/com/automq/stream/s3/S3Storage.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ private CompletableFuture<ReadDataBlock> read0(FetchContext context,
483483
}
484484
return new ReadDataBlock(rst, blockCacheRst.getCacheAccessType());
485485
}).whenComplete((rst, ex) -> {
486-
timeout.cancel();
486+
handleTimeout(timeout, streamId, startOffset, finalEndOffset, maxBytes);
487487
if (ex != null) {
488488
LOGGER.error("read from block cache failed, stream={}, {}-{}, maxBytes: {}",
489489
streamId, startOffset, finalEndOffset, maxBytes, ex);
@@ -492,6 +492,15 @@ private CompletableFuture<ReadDataBlock> read0(FetchContext context,
492492
});
493493
}
494494

495+
private void handleTimeout(Timeout timeout, long streamId, long startOffset, long finalEndOffset, int maxBytes) {
496+
if (timeout.isExpired()) {
497+
LOGGER.error("[POTENTIAL_BUG_RECOVERED] read from block cache completed, stream={}, [{},{}), maxBytes: {}",
498+
streamId, startOffset, finalEndOffset, maxBytes);
499+
} else {
500+
timeout.cancel();
501+
}
502+
}
503+
495504
private void continuousCheck(List<StreamRecordBatch> records) {
496505
long expectStartOffset = -1L;
497506
for (StreamRecordBatch record : records) {

0 commit comments

Comments
 (0)