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

KAFKA-10199: Shutdown with new remove operation in state updater #15894

Merged
merged 7 commits into from May 13, 2024

Conversation

cadonna
Copy link
Contributor

@cadonna cadonna commented May 8, 2024

Uses the new remove operation of the state updater that returns
a future to shutdown the task manager.

Committer Checklist (excluded from commit message)

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

@cadonna cadonna requested a review from lucasbru May 8, 2024 08:23
Copy link
Member

@lucasbru lucasbru left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @cadonna.

clearInputQueue();
updatingTasks.clear();
pausedTasks.clear();
changelogReader.clear();
Copy link
Member

Choose a reason for hiding this comment

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

why was this added? Where was it executed before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before, it was executed in removeUpdatingAndPausedTasks().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored this code a bit.

public void start() {
if (stateUpdaterThread == null) {
if (!restoredActiveTasks.isEmpty() || !exceptionsAndFailedTasks.isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

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

why did you add this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought that since we allow to restart the state updater, we should verify that the state updater starts with clean queue to avoid invalid states coming from a past run of the state updater. At the moment, we never restart the state updater but I thought having clear invariants might be good.

Copy link
Member

Choose a reason for hiding this comment

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

I wonder why we'd even allow restarting the state updater. but we don't need to fix it now

@@ -954,8 +954,7 @@ private void recycleTaskFromStateUpdater(final Task task,
}
}

/** Returns true if the task closed clean */
private boolean closeTaskClean(final Task task,
private void closeTaskClean(final Task task,
final Set<Task> tasksToCloseDirty,
Copy link
Member

Choose a reason for hiding this comment

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

indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Member

@lucasbru lucasbru left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@cadonna cadonna force-pushed the stateupdater_shutdown_with_new_remove branch from b306901 to 80d2983 Compare May 8, 2024 13:43
@cadonna cadonna force-pushed the stateupdater_shutdown_with_new_remove branch from 80d2983 to e732de3 Compare May 13, 2024 09:46
The removed verification is based on a wrong assumption about when
standby tasks are promoted. This is related to KIP-988.
@cadonna cadonna merged commit 5439914 into apache:trunk May 13, 2024
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants