You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sz...@apache.org on 2024/08/22 18:35:50 UTC

(ratis) 22/25: RATIS-2144. SegmentedRaftLogWorker should close the stream before releasing the buffer. (#1138)

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

szetszwo pushed a commit to branch branch-3.1.1_review
in repository https://gitbox.apache.org/repos/asf/ratis.git

commit 557675f12b08c046d9256102478e02ac762feba0
Author: Potato <ta...@apache.org>
AuthorDate: Thu Aug 22 10:42:39 2024 +0800

    RATIS-2144. SegmentedRaftLogWorker should close the stream before releasing the buffer. (#1138)
---
 .../apache/ratis/server/raftlog/segmented/SegmentedRaftLogWorker.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLogWorker.java b/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLogWorker.java
index 573270cca..5b0470d4f 100644
--- a/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLogWorker.java
+++ b/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLogWorker.java
@@ -246,8 +246,8 @@ class SegmentedRaftLogWorker {
     Optional.ofNullable(flushExecutor).ifPresent(ExecutorService::shutdown);
     ConcurrentUtils.shutdownAndWait(TimeDuration.ONE_SECOND.multiply(3),
         workerThreadExecutor, timeout -> LOG.warn("{}: shutdown timeout in " + timeout, name));
-    PlatformDependent.freeDirectBuffer(writeBuffer);
     IOUtils.cleanup(LOG, out);
+    PlatformDependent.freeDirectBuffer(writeBuffer);
     LOG.info("{} close()", name);
   }