-
Notifications
You must be signed in to change notification settings - Fork 15.2k
KAFKA-10317: Global thread should honor shutdown signal during bootstrapping #22417
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
7c26aca
1902941
627150c
bf57fef
567b610
56abb15
7bddbf1
09935c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -382,7 +382,8 @@ private StateConsumer initialize() { | |
| globalConsumer, | ||
| stateDirectory, | ||
| stateRestoreListener, | ||
| config | ||
| config, | ||
| this::inErrorState | ||
| ); | ||
|
|
||
| final GlobalProcessorContextImpl globalProcessorContext = new GlobalProcessorContextImpl( | ||
|
|
@@ -429,6 +430,11 @@ private StateConsumer initialize() { | |
| ); | ||
| } | ||
|
|
||
| if (inErrorState()) { | ||
| closeStateConsumer(stateConsumer, false); | ||
| return null; | ||
| } | ||
|
Comment on lines
+433
to
+436
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for which scenario we need this check?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous This follow-up checks the situation where shutdown is already requested, and routes to cleanup, causes the run() loop to go to the early-exit path.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right, I see it now. thanks for clarification |
||
|
|
||
| setState(RUNNING); | ||
| return stateConsumer; | ||
| } catch (final StreamsException fatalException) { | ||
|
|
@@ -475,8 +481,15 @@ public synchronized void start() { | |
| public void shutdown() { | ||
| // one could call shutdown() multiple times, so ignore subsequent calls | ||
| // if already shutting down or dead | ||
| setState(PENDING_SHUTDOWN); | ||
| final boolean wakeupBootstrap; | ||
| synchronized (stateLock) { | ||
| wakeupBootstrap = (state == State.CREATED); | ||
| setState(PENDING_SHUTDOWN); | ||
| } | ||
| initializationLatch.countDown(); | ||
| if (wakeupBootstrap) { | ||
| globalConsumer.wakeup(); | ||
| } | ||
| } | ||
|
|
||
| public Map<MetricName, Metric> consumerMetrics() { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm: so we ether catch the "interrupted bootstrapping" fact on next iteration or when handling
WakeupException. That makes senseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. First path is supplier check between stores, the other one is wakeupException thrown by methods like
poll/partitionsFor/...