Skip to content
Closed
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 @@ -514,9 +514,11 @@ public boolean commitOffsets() {
// If the task has been cancelled, no more records will be sent from the producer; in that case, if any outstanding messages remain,
// we can stop flushing immediately
if (isCancelled() || timeoutMs <= 0) {
log.error("{} Failed to flush, timed out while waiting for producer to flush outstanding {} messages", this, outstandingMessages.size());
log.error("{} Failed to flush, task is cancelled, or timed out while waiting for producer " +
"to flush outstanding {} messages", this, outstandingMessages.size());
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

side fix: the error could be timed out or "cancelled". Add in the log.

finishFailedFlush();
recordCommitFailure(time.milliseconds() - started, null);
recordCommitFailure(time.milliseconds() - started,
new TimeoutException("Task is cancelled or timed out while waiting for flushing messages"));
return false;
}
this.wait(timeoutMs);
Expand All @@ -526,7 +528,7 @@ public boolean commitOffsets() {
// to stop immediately
log.error("{} Interrupted while flushing messages, offsets will not be committed", this);
finishFailedFlush();
recordCommitFailure(time.milliseconds() - started, null);
recordCommitFailure(time.milliseconds() - started, e);
return false;
}
}
Expand All @@ -550,16 +552,16 @@ public boolean commitOffsets() {
// Now we can actually flush the offsets to user storage.
Future<Void> flushFuture = offsetWriter.doFlush((error, result) -> {
if (error != null) {
// Very rare case: offsets were unserializable, and unable to store any data
log.error("{} Failed to flush offsets to storage: ", WorkerSourceTask.this, error);
finishFailedFlush();
recordCommitFailure(time.milliseconds() - started, error);
Comment on lines +555 to +558
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doFlush will return null after calling the callback with error attached. Handle the failed flush here, since we can know which error is thrown.

} else {
log.trace("{} Finished flushing offsets to storage", WorkerSourceTask.this);
}
});
// Very rare case: offsets were unserializable and we finished immediately, unable to store
// any data
// failed on doFlush, return false immediately
if (flushFuture == null) {
finishFailedFlush();
recordCommitFailure(time.milliseconds() - started, null);
return false;
}
try {
Expand All @@ -581,7 +583,7 @@ public boolean commitOffsets() {
} catch (TimeoutException e) {
log.error("{} Timed out waiting to flush offsets to storage", this);
finishFailedFlush();
recordCommitFailure(time.milliseconds() - started, null);
recordCommitFailure(time.milliseconds() - started, e);
return false;
}

Expand Down
Loading