Kafka Connect: Surface commit failures instead of silently swallowing them#16237
Open
yadavay-amzn wants to merge 1 commit intoapache:mainfrom
Open
Kafka Connect: Surface commit failures instead of silently swallowing them#16237yadavay-amzn wants to merge 1 commit intoapache:mainfrom
yadavay-amzn wants to merge 1 commit intoapache:mainfrom
Conversation
… them The Coordinator previously caught all exceptions from doCommit() and only logged a warning, causing the connector to stay RUNNING after a CommitFailedException (e.g., Glue concurrent update) while silently dropping data. Propagate the exception so CoordinatorThread terminates and the Kafka Connect task transitions to FAILED. Fixes apache#15878
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #15878.
Problem
The Kafka Connect
Coordinatorpreviously caughtExceptionarounddoCommit()and only logged a warning, so when a commit failed (e.g., aCommitFailedExceptionfrom Glue detecting a concurrent table update), the connector stayedRUNNINGwhile silently dropping the data that was in flight.Fix
Remove the catch-all around
doCommit()and instead log atERRORlevel with the task id and commit id before rethrowing.CoordinatorThread.run()already terminates the thread on uncaught exceptions, which transitions the Kafka Connect task toFAILED— so failures are now surfaced rather than dropped.The
finallyblock that callscommitState.endCurrentCommit()is preserved so per-commit state is cleaned up regardless of the outcome.Testing
testCommitFailedExceptionPropagateswhich mocks a catalog-sideCommitFailedExceptiononAppendFiles.commit()and asserts it propagates out ofCoordinator.process(). Without the fix, this test fails because the exception is swallowed.testCoordinatorWithBadDataFileandtestCoordinatorCommittedOffsetValidation) that previously relied on silent-swallow behaviour; they now assert the specific exception propagates (IllegalArgumentExceptionfor bad partition spec,ValidationExceptionfor stale offsets).TestCoordinatorsuite passes locally (8/8).spotlessApplypasses.