arnabnandy7 commented on code in PR #22864:
URL: https://github.com/apache/kafka/pull/22864#discussion_r4524131430
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdater.java:
##########
@@ -767,15 +758,17 @@ private void maybeCompleteRestoration(final StreamTask
task,
changelogReader.unregister(changelogPartitions);
addToRestoredTasks(task);
log.info("Stateful active task " + task.id() + " completed
restoration");
- transitToUpdateStandbysIfOnlyStandbysLeft();
+ maybeTransitionChangelogReader();
} catch (final StreamsException streamsException) {
handleStreamsExceptionWithTask(streamsException,
task.id());
}
}
}
- private void transitToUpdateStandbysIfOnlyStandbysLeft() {
- if (onlyStandbyTasksUpdating()) {
+ private void maybeTransitionChangelogReader() {
+ if (updatingTasks.isEmpty() &&
!changelogReader.isRestoringActive()) {
+ changelogReader.enforceRestoreActive();
+ } else if (onlyStandbyTasksUpdating() &&
changelogReader.isRestoringActive()) {
Review Comment:
Addressed
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdaterTest.java:
##########
@@ -1265,12 +1298,12 @@ public void
shouldPauseActiveTaskAndTransitToUpdateStandby() throws Exception {
verifyExceptionsAndFailedTasks();
// shutdown ensures that the test does not end before changelog reader
methods verified below are called
stateUpdater.shutdown(Duration.ofMinutes(1));
- verify(changelogReader, times(1)).enforceRestoreActive();
+ verify(changelogReader, times(2)).enforceRestoreActive();
verify(changelogReader, times(1)).transitToUpdateStandby();
}
@Test
- public void shouldPauseStandbyTaskAndNotTransitToRestoreActive() throws
Exception {
+ public void
shouldPauseStandbyTaskAndNotTransitToRestoreActiveIfAnotherStandbyIsUpdating()
throws Exception {
Review Comment:
Addressed
--
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]