You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by li...@apache.org on 2024/07/23 06:53:45 UTC

(rocketmq) branch develop updated: [ISSUE #8409] Fix tiered storage roll file logic if committing the last part of a file failed (#8410)

This is an automated email from the ASF dual-hosted git repository.

lizhimin pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 6fb455a1d4 [ISSUE #8409] Fix tiered storage roll file logic if committing the last part of a file failed (#8410)
6fb455a1d4 is described below

commit 6fb455a1d4dc7416c81ad447fbfe4f9429765609
Author: bxfjb <48...@users.noreply.github.com>
AuthorDate: Tue Jul 23 14:53:39 2024 +0800

    [ISSUE #8409] Fix tiered storage roll file logic if committing the last part of a file failed (#8410)
    
    Co-authored-by: zhaoyuhan <zh...@xiaomi.com>
---
 .../org/apache/rocketmq/tieredstore/file/FlatAppendFile.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

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 d048413798..b9ba80d08d 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
@@ -175,8 +175,14 @@ public class FlatAppendFile {
             FileSegment fileSegment = this.getFileToWrite();
             result = fileSegment.append(buffer, timestamp);
             if (result == AppendResult.FILE_FULL) {
-                fileSegment.commitAsync().join();
-                return this.rollingNewFile(this.getAppendOffset()).append(buffer, timestamp);
+                boolean commitResult = fileSegment.commitAsync().join();
+                log.info("FlatAppendFile#append not successful for the file {} is full, commit result={}",
+                    fileSegment.getPath(), commitResult);
+                if (commitResult) {
+                    return this.rollingNewFile(this.getAppendOffset()).append(buffer, timestamp);
+                } else {
+                    return AppendResult.UNKNOWN_ERROR;
+                }
             }
         } finally {
             fileSegmentLock.writeLock().unlock();