diff --git a/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala b/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala index ae9e17108a..a4c5f435c0 100644 --- a/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala +++ b/core/src/main/scala/kafka/log/streamaspect/ElasticUnifiedLog.scala @@ -128,9 +128,10 @@ class ElasticUnifiedLog(_logStartOffset: Long, elasticLog.close() } elasticLog.segments.clear() - elasticLog.isMemoryMappedBufferClosed = true - elasticLog.deleteEmptyDir() - closeFuture + closeFuture.whenComplete((_, _) => { + elasticLog.isMemoryMappedBufferClosed = true + elasticLog.deleteEmptyDir() + }) } /**