lucliu1108 opened a new pull request, #22417: URL: https://github.com/apache/kafka/pull/22417
## Summary This PR introduces a shutdown-aware bootstrap loop in `GlobalStateManagerImpl` and a `consumer.wakeup()` call during `GlobalStreamThread.shutdown()` that together let `KafkaStreams#close()` interrupt global-store restoration in progress, instead of waiting for the entire changelog to be replayed. ## Implementation The global thread passes its `inErrorState()` predicate to the state manager, which checks it before each batch in the bootstrap poll loop and exits cleanly when shutdown is requested. The `wakeup()` call additionally interrupts any in-flight `poll()` so shutdown takes effect right away, even if the loop is currently blocked on a fetch. A matching WakeupException catch in the main update loop ensures clean shutdowns aren't reported through the uncaught-exception handler. ## Tests Added unit tests in `GlobalStateManagerImplTest` covering the supplier check and `WakeupException` handling in both `restoreState` and `reprocessState`, and end-to-end tests in `GlobalStreamThreadTest` for the close-during-bootstrap scenario. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
