diff --git a/s3stream/src/main/java/com/automq/stream/s3/compact/CompactionManager.java b/s3stream/src/main/java/com/automq/stream/s3/compact/CompactionManager.java index 19851eccef..c849466861 100644 --- a/s3stream/src/main/java/com/automq/stream/s3/compact/CompactionManager.java +++ b/s3stream/src/main/java/com/automq/stream/s3/compact/CompactionManager.java @@ -744,14 +744,16 @@ void executeCompactionPlans(CommitStreamSetObjectRequest request, List uploader.forceUploadStreamSetObject()) - .exceptionally(ex -> { - uploader.release().thenAccept(v -> { - for (CompactedObject compactedObject : compactionPlan.compactedObjects()) { - compactedObject.streamDataBlocks().forEach(StreamDataBlock::release); - } - }).join(); - throw new IllegalStateException("Error while uploading compaction objects", ex); + .whenComplete((v, ex) -> { + uploader.forceUploadStreamSetObject(); + if (ex != null) { + logger.error("Error while uploading compaction objects", ex); + uploader.release().thenAccept(vv -> { + for (CompactedObject compactedObject : compactionPlan.compactedObjects()) { + compactedObject.streamDataBlocks().forEach(StreamDataBlock::release); + } + }).join(); + } }); } try {