Skip to content

ref(kafka): Remove incremental rebalancing #101

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

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 6 additions & 22 deletions src/consumer/kafka.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,32 +359,16 @@ pub async fn handle_events(
unreachable!("Got partition revocation before the consumer has started")
}
(ConsumerState::Ready, Event::Shutdown) => ConsumerState::Stopped,
(ConsumerState::Consuming(handles, mut tpl), Event::Assign(mut assigned)) => {
assert!(
tpl.is_disjoint(&assigned),
"Newly assigned TPL should be disjoint from TPL we're consuming from"
);
tpl.append(&mut assigned);
debug!(
"{} additional topic partitions added after assignment",
assigned.len()
);
handles.shutdown(CALLBACK_DURATION).await;
ConsumerState::Consuming(spawn_actors(consumer.clone(), &tpl), tpl)
(ConsumerState::Consuming(_, _), Event::Assign(_)) => {
unreachable!("Got partition assignment after the consumer has started")
}
(ConsumerState::Consuming(handles, mut tpl), Event::Revoke(revoked)) => {
(ConsumerState::Consuming(handles, tpl), Event::Revoke(revoked)) => {
assert!(
tpl.is_subset(&revoked),
"Revoked TPL should be a subset of TPL we're consuming from"
tpl == revoked,
"Revoked TPL should be equal to the subset of TPL we're consuming from"
);
tpl.retain(|e| !revoked.contains(e));
debug!("{} topic partitions remaining after revocation", tpl.len());
handles.shutdown(CALLBACK_DURATION).await;
if tpl.is_empty() {
ConsumerState::Ready
} else {
ConsumerState::Consuming(spawn_actors(consumer.clone(), &tpl), tpl)
}
ConsumerState::Ready
}
(ConsumerState::Consuming(handles, _), Event::Shutdown) => {
handles.shutdown(CALLBACK_DURATION).await;
Expand Down
Loading