Skip to content

KAFKA-14339 : Do not perform prodcuerCommit on serializationError when trying offsetWriter flush - #12784

Closed
sudeshwasnik wants to merge 4 commits into
apache:trunkfrom
sudeshwasnik:doNotCommitOnSerializationError
Closed

sudeshwasnik wants to merge 4 commits into
apache:trunkfrom
sudeshwasnik:doNotCommitOnSerializationError

Conversation

@sudeshwasnik

@sudeshwasnik sudeshwasnik commented Oct 25, 2022 •

Copy link
Copy Markdown

We shouldn't commitTransaction() on producer, when offsetWriter faces some issue and returns without sending offsets to producer.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@sudeshwasnik sudeshwasnik changed the title Do not perform prodcuerCommit on serialization error MINOR: Do not perform prodcuerCommit on serializationError when trying offsetWriter flush Oct 26, 2022
@sudeshwasnik
sudeshwasnik marked this pull request as ready for review October 26, 2022 17:32
@sudeshwasnik

Copy link
Copy Markdown
Author

hi @C0urante, could you ptal on this quick small change

@sudeshwasnik
sudeshwasnik force-pushed the doNotCommitOnSerializationError branch from 8c4b5c5 to 1d9be8f Compare October 27, 2022 08:01
@C0urante

Copy link
Copy Markdown
Contributor

Thanks @sudeshwasnik, good catch! Would you mind filing a Jira for this so that others who encounter the same bug can track its status and fixed versions?

Regarding the actual changes--I think we should expand unit testing coverage here. The tweak to ExactlyOnceWorkerSourceTaskTest does address the case of synchronous offset flush failures (i.e., ones detected before offsets are dispatched to the producer), but it drops coverage for the case of asynchronous offset flush failures (i.e., ones detected after offsets are dispatched to the producer). Can we account for both cases?

@vamossagar12

Copy link
Copy Markdown
Contributor

Thanks @sudeshwasnik . This is a nice catch. I have requested couple of cosmetic changes. And I agree with Chris, might need to increase the test coverage. Currently the only test part of this change is removing an expected Call on FAIL_FLUSH_CALLBACK.

@sudeshwasnik sudeshwasnik changed the title MINOR: Do not perform prodcuerCommit on serializationError when trying offsetWriter flush KAFKA-14339 : Do not perform prodcuerCommit on serializationError when trying offsetWriter flush Oct 27, 2022
@sudeshwasnik

Copy link
Copy Markdown
Author

@C0urante @vamossagar12 quick dumb question - if there is an Async failure (detected after offsets are dispatched to producer), won't producer.commitTransaction also throw exception eventually? which gets captured in flushError (atleast that's what I expect, hence curious).
If so, is there a case where we require Async error tracking in offsets sent to producer separately?

Although I agree, we should anyways. And +1 to the suggestion! I'll try to add tests for Async failures (which is different from FAIL_TRANSACTION_COMMIT).
thansk for the review!

@C0urante

C0urante commented Oct 31, 2022 •

Copy link
Copy Markdown
Contributor

@sudeshwasnik Good point. I think with the code base as it is right now, we do get the invariant that asynchronous failures occur if and only if an offset is dispatched to Producer::send. And yes, past that point, any failures should be reported by an exception thrown when Producer::commitTransaction is called.

I'd still like to see coverage for (and handling of) this case if possible, though, since we may modify the offset writer, offset backing store, or Kafka log classes in a way that causes the callback to be invoked without the record making it to Producer::send.

@C0urante

Copy link
Copy Markdown
Contributor

@sudeshwasnik are you still working on this?

@sudeshwasnik

sudeshwasnik commented Nov 21, 2022 •

Copy link
Copy Markdown
Author

@C0urante sorry for the delay. I'll try to make the relevant changes and get back on this in few days.

@sudeshwasnik

Copy link
Copy Markdown
Author

Closing this PR. Can reassign this ticket. Shouldn't block on my prioritizations.

@gharris1727

Copy link
Copy Markdown
Contributor

Superseded by #12920.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants