Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(s3stream): prevent erorr logging when compaction is shutdown #925

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private void scheduleNextCompaction(long delayMillis) {
public void shutdown() {
this.compactScheduledExecutor.shutdown();
this.bucketCallbackScheduledExecutor.shutdown();
this.uploader.stop();
this.uploader.shutdown();
}

public CompletableFuture<Void> compact() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class CompactionUploader {
private CompletableFuture<Long> streamSetObjectIdCf = null;
private DataBlockWriter streamSetObjectWriter = null;
private volatile boolean isAborted = false;
private volatile boolean isShutdown = false;

public CompactionUploader(ObjectManager objectManager, S3Operator s3Operator, Config config) {
this.objectManager = objectManager;
Expand All @@ -49,7 +50,8 @@ public CompactionUploader(ObjectManager objectManager, S3Operator s3Operator, Co
ThreadUtils.createThreadFactory("compaction-stream-set-object-uploader-%d", true), LOGGER);
}

public void stop() {
public void shutdown() {
this.isShutdown = true;
this.streamSetObjectUploadPool.shutdown();
this.streamObjectUploadPool.shutdown();
}
Expand Down Expand Up @@ -106,7 +108,12 @@ public CompletableFuture<StreamObject> writeStreamObject(CompactedObject compact
return streamObject;
}).whenComplete((ret, ex) -> {
if (ex != null) {
LOGGER.error("write to stream object {} failed", objectId, ex);
if (isShutdown) {
// TODO: remove this when we're able to abort object uploading gracefully
LOGGER.warn("write to stream object {} failed", objectId, ex);
} else {
LOGGER.error("write to stream object {} failed", objectId, ex);
}
dataBlockWriter.release();
compactedObject.streamDataBlocks().forEach(StreamDataBlock::release);
}
Expand Down
Loading