diff --git a/core/src/main/scala/kafka/log/s3/operator/DefaultS3Operator.java b/core/src/main/scala/kafka/log/s3/operator/DefaultS3Operator.java index b34b432299..a62d9e8706 100644 --- a/core/src/main/scala/kafka/log/s3/operator/DefaultS3Operator.java +++ b/core/src/main/scala/kafka/log/s3/operator/DefaultS3Operator.java @@ -399,7 +399,7 @@ public CompletableFuture close() { // upload the cached buf anyway. Note that the last part can be smaller than minPartSize. if (cachedBuf != null) { handleWriteFuturePart(cachedBufLastAddCf, cachedBuf, System.nanoTime()); - cachedBuf = null; + clearCache(); } OBJECT_INTO_CLOSE_COST.update(System.nanoTime() - start);