Skip to content
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

KAYAK-3391 RecordStream.processingAndCommitting #846

Merged
merged 11 commits into from
Jan 18, 2024

Conversation

zcox
Copy link
Collaborator

@zcox zcox commented Jan 17, 2024

KAYAK-3391 Refactors ConsumerOps.processingAndCommitting to be very generic. Also adds a batched implementation.

Adds processingAndCommitting to the RecordStream abstraction, and implements it for both chunked (i.e. one-at-a-time) and batched record streams.

Note that batched processingAndCommitting simply processes the entire batch, and if that succeeds then it updates the state to include that successfully processed batch's offsets. Only offsets for records in successfully processed batches will be committed. It does not try to do fancy things like handle partially succeeding (and failing) batches, or try to update state with individual records' offsets as they are processed. Note that if a batch fails processing, none of the offsets in that batch will be committed. This will lead to more reprocessing after startup, but hey this is at-least-once and your processing is idempotent, right?

@zcox zcox requested a review from a team as a code owner January 17, 2024 01:03
val offsets = c.foldLeft(Map.empty[TopicPartition, Long])(_ ++ _._1)
val nextOffsets =
offsets.view.mapValues(o => new OffsetAndMetadata(o + 1)).toMap
println(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this println be removed, or replaced with proper logging?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Definitely removed 😄 this is some experimental code to try out Stream.groupWithin. Will clean up before merge.

Comment on lines 216 to 217
maxRecordCount: Long = 1000L,
maxElapsedTime: FiniteDuration = 60.seconds,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think default args in an anonymous implementation will do anything but maybe get out of sync?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah these default args everywhere are a bit weird. Removed from the 2 impls in 43345d5.

@zcox
Copy link
Collaborator Author

zcox commented Jan 18, 2024

Local testing in 2 real services went well, so going to merge this, cut a release, and continue testing. Can definitely make any needed followup changes in future PRs.

@zcox zcox merged commit 97c4f1f into Banno:main Jan 18, 2024
5 checks passed
@zcox zcox deleted the record-stream-pac branch January 18, 2024 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants