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

Extract Committer and RebalanceCoordinator classes from Runloop + unit tests #1375

Merged
merged 53 commits into from
Nov 26, 2024

Conversation

svroonland
Copy link
Collaborator

@svroonland svroonland commented Nov 10, 2024

The code is mostly just moved to a different place, the logic was left mostly intact. The 'interface' between the components has been decoupled more, i.e. the rebalance listener no longer access the full Runloop's State and the pending commits are stored internally in the Committer.

Care has been taken to make the Committer usable during rebalancing as well, with the proper access to the Consumer for example. The part that waits the end of the streams and their commits has been changed to use the Committer.

Includes unit tests for the two new components.

Copy link
Collaborator

@erikvanoosten erikvanoosten left a comment

Choose a reason for hiding this comment

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

The idea of extracting the Committer is really nice. Without this, extracting the rebalance listener would be very hard.
I don't see any thing obviously wrong but since so much code moved around this is a huge PR. So I will have to take a deeper look once this PR exists draft.

With rebalanceSafeCommits, we expect all pulled records to be processed and committed.
Helps understanding the logic here
Base automatically changed from more-rebalance-safe-commits-logging to master November 10, 2024 19:42
@svroonland svroonland changed the title Extract Committer and RunloopRebalanceListener classes from Runloop Extract Committer and RebalanceCoordinator classes from Runloop Nov 13, 2024
@svroonland svroonland changed the title Extract Committer and RebalanceCoordinator classes from Runloop Extract Committer and RebalanceCoordinator classes from Runloop + unit tests Nov 13, 2024
@svroonland svroonland marked this pull request as ready for review November 13, 2024 13:17
_ <- ZIO.fromTry(EmbeddedKafka.createCustomTopic(topic))
topic <- randomTopic
clientId <- randomClient
_ <- ZIO.attempt(EmbeddedKafka.createCustomTopic(topic)).flatMap(ZIO.fromTry(_)).retryN(3).catchSome {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is the retrying needed here, and not in other tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I couldn't figure that out either..

Copy link
Collaborator

@erikvanoosten erikvanoosten left a comment

Choose a reason for hiding this comment

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

I was a bit disappointed that cleaner code gives more code (this PR effectively adds 593 lines of code). Otherwise I am happy with the split.

It is no longer directly obvious which code executes on the same-thread-runtime (with its restrictions in ZIO operators). Therefore, I propose that methods that are used from the rebalancer will be clearly marked. I proposed a few changes for that, but perhaps there are more.

Approving, but please look at the suggestions.

@svroonland svroonland merged commit bdde6e3 into master Nov 26, 2024
13 checks passed
@svroonland svroonland deleted the separate-rebalance-listener-file branch November 26, 2024 18:05
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.

2 participants