You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/10/18 19:44:52 UTC

[GitHub] [kafka] cadonna commented on a diff in pull request #12762: KAFKA-14299: Never transition to UpdateStandby twice

cadonna commented on code in PR #12762:
URL: https://github.com/apache/kafka/pull/12762#discussion_r998636964


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdaterTest.java:
##########
@@ -658,6 +658,29 @@ public void shouldUpdateStandbyTaskAfterAllActiveStatefulTasksFailed() throws Ex
         orderVerifier.verify(changelogReader, atLeast(1)).enforceRestoreActive();
         orderVerifier.verify(changelogReader).transitToUpdateStandby();
     }
+    
+    @Test
+    public void shouldNotTransitToStandbyAgainAfterStandbyTaskFailed() throws Exception {
+        final StandbyTask task1 = standbyTask(TASK_0_0, mkSet(TOPIC_PARTITION_A_0)).inState(State.RUNNING).build();
+        final StandbyTask task2 = standbyTask(TASK_1_0, mkSet(TOPIC_PARTITION_B_0)).inState(State.RUNNING).build();
+        final Map<TaskId, Task> updatingTasks = mkMap(
+                mkEntry(task1.id(), task1),
+                mkEntry(task2.id(), task2)
+        );
+        final TaskCorruptedException taskCorruptedException =
+                new TaskCorruptedException(mkSet(task1.id()));
+        final ExceptionAndTasks expectedExceptionAndTasks =
+                new ExceptionAndTasks(mkSet(task1), taskCorruptedException);

Review Comment:
   nit:
   ```suggestion
           final ExceptionAndTasks expectedExceptionAndTasks = new ExceptionAndTasks(mkSet(task1), taskCorruptedException);
   ```



##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdaterTest.java:
##########
@@ -658,6 +658,29 @@ public void shouldUpdateStandbyTaskAfterAllActiveStatefulTasksFailed() throws Ex
         orderVerifier.verify(changelogReader, atLeast(1)).enforceRestoreActive();
         orderVerifier.verify(changelogReader).transitToUpdateStandby();
     }
+    
+    @Test
+    public void shouldNotTransitToStandbyAgainAfterStandbyTaskFailed() throws Exception {
+        final StandbyTask task1 = standbyTask(TASK_0_0, mkSet(TOPIC_PARTITION_A_0)).inState(State.RUNNING).build();
+        final StandbyTask task2 = standbyTask(TASK_1_0, mkSet(TOPIC_PARTITION_B_0)).inState(State.RUNNING).build();
+        final Map<TaskId, Task> updatingTasks = mkMap(
+                mkEntry(task1.id(), task1),
+                mkEntry(task2.id(), task2)
+        );
+        final TaskCorruptedException taskCorruptedException =
+                new TaskCorruptedException(mkSet(task1.id()));

Review Comment:
   nit:
   ```suggestion
           final TaskCorruptedException taskCorruptedException = new TaskCorruptedException(mkSet(task1.id()));
   ```



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org