From 8a7bc1a36f5495a1ec4c97748a55630a9aa25798 Mon Sep 17 00:00:00 2001 From: Robin Han Date: Mon, 11 Dec 2023 17:21:58 +0800 Subject: [PATCH 1/2] fix: callback fail when partition closing Signed-off-by: Robin Han --- .../main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala b/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala index ae9e17108a..e679bbe27b 100644 --- a/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala +++ b/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala @@ -128,7 +128,6 @@ class ElasticUnifiedLog(_logStartOffset: Long, elasticLog.close() } elasticLog.segments.clear() - elasticLog.isMemoryMappedBufferClosed = true elasticLog.deleteEmptyDir() closeFuture } From 0140bc3a7a2dd72dcd99506b8e44dc0439d672b9 Mon Sep 17 00:00:00 2001 From: Robin Han Date: Mon, 11 Dec 2023 17:45:25 +0800 Subject: [PATCH 2/2] fix: unit test Signed-off-by: Robin Han --- .../scala/kafka/log/streamaspect/ElasticUnifiedLog.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala b/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala index e679bbe27b..a4c5f435c0 100644 --- a/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala +++ b/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala @@ -128,8 +128,10 @@ class ElasticUnifiedLog(_logStartOffset: Long, elasticLog.close() } elasticLog.segments.clear() - elasticLog.deleteEmptyDir() - closeFuture + closeFuture.whenComplete((_, _) => { + elasticLog.isMemoryMappedBufferClosed = true + elasticLog.deleteEmptyDir() + }) } /**