gabriellefu commented on code in PR #22282:
URL: https://github.com/apache/kafka/pull/22282#discussion_r3299435323
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java:
##########
@@ -2989,6 +2989,54 @@ public void shouldSuspendActiveTasksDuringRevocation() {
verify(task00).suspend();
}
+ @Test
+ public void shouldSuspendRevokedTasksWhenPrepareCommitThrows() {
+ final StreamTask task00 = statefulTask(taskId00,
taskId00ChangelogPartitions)
+ .withInputPartitions(taskId00Partitions)
+ .inState(State.RUNNING)
+ .build();
+
+ final TasksRegistry tasks = mock(TasksRegistry.class);
+ when(tasks.allInitializedTasks()).thenReturn(Set.of(task00));
+
+ when(task00.commitNeeded()).thenReturn(true);
+ when(task00.prepareCommit(true)).thenThrow(new
TaskMigratedException("task migrated"));
+
+ final TaskManager taskManager =
setUpTaskManager(ProcessingMode.AT_LEAST_ONCE, tasks);
+
+ final StreamsException thrown = assertThrows(StreamsException.class,
+ () -> taskManager.handleRevocation(taskId00Partitions));
+
+ assertInstanceOf(TaskMigratedException.class, thrown);
Review Comment:
I added a thrown on the taskid, thanks
--
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]