-
Notifications
You must be signed in to change notification settings - Fork 15.1k
KAFKA-13370: add errors when commit offsets failed and add tests #11413
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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()); | ||
| 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); | ||
|
|
@@ -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; | ||
| } | ||
| } | ||
|
|
@@ -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
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } 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 { | ||
|
|
@@ -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; | ||
| } | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.