From 09d2315bdd587f2f99d69572d3af852d5a9de568 Mon Sep 17 00:00:00 2001 From: wanghuaiyuan Date: Mon, 13 Jan 2025 15:03:18 +0800 Subject: [PATCH] init: Initialization preparations --- .../org/apache/rocketmq/tieredstore/file/FlatAppendFile.java | 2 +- .../apache/rocketmq/tieredstore/file/FlatCommitLogFile.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatAppendFile.java b/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatAppendFile.java index d2dd36cf45f..f7537700e73 100644 --- a/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatAppendFile.java +++ b/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatAppendFile.java @@ -217,7 +217,7 @@ public CompletableFuture readAsync(long offset, int length) { if (index < 0) { log.error("FlatAppendFile#readAsync offset={} is lower than minimum offset:{}", offset, fileSegmentList.get(0).getBaseOffset()); - return CompletableFuture.completedFuture(null); + throw new IndexOutOfBoundsException("offset is lower than minimum offset"); } FileSegment fileSegment1 = fileSegmentList.get(index); diff --git a/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatCommitLogFile.java b/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatCommitLogFile.java index 16c05204759..ab9445ced17 100644 --- a/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatCommitLogFile.java +++ b/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatCommitLogFile.java @@ -68,6 +68,9 @@ public CompletableFuture getMinOffsetFromFileAsync() { .thenApply(buffer -> { firstOffset.set(MessageFormatUtil.getQueueOffset(buffer)); return firstOffset.get(); + }).exceptionally(e -> { + log.error("Get min offset from file failed, filePath={}", filePath, e); + return GET_OFFSET_ERROR; }); }