Skip to content

Fixed lost compression errors #528

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

Merged
merged 1 commit into from
Aug 13, 2025
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
@@ -1,6 +1,5 @@
package tech.ydb.topic.write.impl;

import java.io.IOException;
import java.time.Instant;
import java.util.List;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -35,7 +34,7 @@ public class EnqueuedMessage {
private final YdbTransaction transaction;

private volatile boolean isReady = false;
private volatile IOException compressError = null;
private volatile Throwable compressError = null;

public EnqueuedMessage(Message message, SendSettings sendSettings, boolean noCompression) {
this.bytes = message.getData();
Expand All @@ -60,7 +59,7 @@ public long getSize() {
return bytes.length;
}

public IOException getCompressError() {
public Throwable getCompressError() {
return compressError;
}

Expand All @@ -71,8 +70,9 @@ public void encode(String writeId, Codec codec) {
bytes = Encoder.encode(codec, bytes);
isReady = true;
logger.trace("[{}] Successfully finished encoding message", writeId);
} catch (IOException ex) {
} catch (Throwable ex) {
logger.error("[{}] Exception while encoding message: ", writeId, ex);
compressError = ex;
isReady = true;
future.completeExceptionally(ex);
}
Expand Down
5 changes: 2 additions & 3 deletions topic/src/main/java/tech/ydb/topic/write/impl/WriterImpl.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package tech.ydb.topic.write.impl;

import java.io.IOException;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -165,7 +164,7 @@ private void acceptMessageIntoSendingQueue(EnqueuedMessage message) {
} else {
CompletableFuture
.runAsync(() -> message.encode(id, settings.getCodec()), compressionExecutor)
.thenRun(this::moveEncodedMessagesToSendingQueue);
.whenComplete((res, th) -> moveEncodedMessagesToSendingQueue());
}
}

Expand All @@ -187,7 +186,7 @@ private void moveEncodedMessagesToSendingQueue() {
break;
}

IOException error = msg.getCompressError();
Throwable error = msg.getCompressError();
if (error != null) { // just skip
logger.warn("[{}] Message wasn't sent because of processing error", id, error);
free(1, msg.getOriginalSize());
Expand Down