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/07/05 11:32:49 UTC

[GitHub] [kafka] cadonna opened a new pull request, #12379: KAFKA-10199: Remove call to Task#completeRestoration from state updater

cadonna opened a new pull request, #12379:
URL: https://github.com/apache/kafka/pull/12379

   The call to Task#completeRestoration calls methods on the main consumer.
   The state updater thread should not access the main consumer since the
   main consumer is not thread-safe. Additionally, Task#completeRestoration
   changed the state of active tasks, but we decided to keep task life cycle
   management outside of the state updater.
   
   Task#completeRestoration should be called by the stream thread on
   restored active tasks returned by the state udpater.
   
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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


[GitHub] [kafka] cadonna commented on a diff in pull request #12379: KAFKA-10199: Remove call to Task#completeRestoration from state updater

Posted by GitBox <gi...@apache.org>.
cadonna commented on code in PR #12379:
URL: https://github.com/apache/kafka/pull/12379#discussion_r913693619


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdaterTest.java:
##########
@@ -93,11 +93,11 @@ public void tearDown() {
 
     private Properties configProps() {
         return mkObjectProperties(mkMap(
-                mkEntry(StreamsConfig.APPLICATION_ID_CONFIG, "appId"),
-                mkEntry(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:2171"),
-                mkEntry(StreamsConfig.PROCESSING_GUARANTEE_CONFIG, StreamsConfig.EXACTLY_ONCE_V2),
-                mkEntry(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, COMMIT_INTERVAL),
-                mkEntry(producerPrefix(ProducerConfig.TRANSACTION_TIMEOUT_CONFIG), COMMIT_INTERVAL)
+            mkEntry(StreamsConfig.APPLICATION_ID_CONFIG, "appId"),
+            mkEntry(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:2171"),
+            mkEntry(StreamsConfig.PROCESSING_GUARANTEE_CONFIG, StreamsConfig.EXACTLY_ONCE_V2),
+            mkEntry(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, COMMIT_INTERVAL),
+            mkEntry(producerPrefix(ProducerConfig.TRANSACTION_TIMEOUT_CONFIG), COMMIT_INTERVAL)

Review Comment:
   Just formatting!



-- 
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


[GitHub] [kafka] cadonna commented on a diff in pull request #12379: KAFKA-10199: Remove call to Task#completeRestoration from state updater

Posted by GitBox <gi...@apache.org>.
cadonna commented on code in PR #12379:
URL: https://github.com/apache/kafka/pull/12379#discussion_r913695817


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdaterTest.java:
##########
@@ -993,9 +979,6 @@ private void verifyRemovedTasks(final Task... tasks) throws Exception {
                 VERIFICATION_TIMEOUT,
                 "Did not get all removed task within the given timeout!"
             );
-            assertTrue(removedTasks.stream()
-                .allMatch(task -> task.isActive() && task.state() == State.RESTORING

Review Comment:
   See above



-- 
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


[GitHub] [kafka] cadonna commented on a diff in pull request #12379: KAFKA-10199: Remove call to Task#completeRestoration from state updater

Posted by GitBox <gi...@apache.org>.
cadonna commented on code in PR #12379:
URL: https://github.com/apache/kafka/pull/12379#discussion_r913695625


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdaterTest.java:
##########
@@ -922,7 +914,6 @@ private void verifyRestoredActiveTasks(final StreamTask... tasks) throws Excepti
                 VERIFICATION_TIMEOUT,
                 "Did not get all restored active task within the given timeout!"
             );
-            assertTrue(restoredTasks.stream().allMatch(task -> task.state() == State.RESTORING));

Review Comment:
   It doesn't make sense to verify the state of a mock task, because the mock will always return what we specified it should return independently of what the state updater does with the task. Totally missed that until now 🙂 !



##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdaterTest.java:
##########
@@ -956,10 +947,6 @@ private void verifyUpdatingTasks(final Task... tasks) throws Exception {
                 VERIFICATION_TIMEOUT,
                 "Did not get all updating task within the given timeout!"
             );
-            assertTrue(updatingTasks.stream()
-                .allMatch(task -> task.isActive() && task.state() == State.RESTORING
-                    ||
-                    !task.isActive() && task.state() == State.RUNNING));

Review Comment:
   See above



-- 
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


[GitHub] [kafka] cadonna commented on a diff in pull request #12379: KAFKA-10199: Remove call to Task#completeRestoration from state updater

Posted by GitBox <gi...@apache.org>.
cadonna commented on code in PR #12379:
URL: https://github.com/apache/kafka/pull/12379#discussion_r913695158


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdaterTest.java:
##########
@@ -956,10 +947,6 @@ private void verifyUpdatingTasks(final Task... tasks) throws Exception {
                 VERIFICATION_TIMEOUT,
                 "Did not get all updating task within the given timeout!"
             );
-            assertTrue(updatingTasks.stream()
-                .allMatch(task -> task.isActive() && task.state() == State.RESTORING
-                    ||
-                    !task.isActive() && task.state() == State.RUNNING));

Review Comment:
   It doesn't make sense to verify the state of a mock task, because the mock will always return what we specified it should return independently of what the state updater does with the task. Totally missed that until now 🙂 !



##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdaterTest.java:
##########
@@ -975,7 +962,6 @@ private void verifyUpdatingStandbyTasks(final StandbyTask... tasks) throws Excep
             VERIFICATION_TIMEOUT,
             "Did not see all standby task within the given timeout!"
         );
-        assertTrue(standbyTasks.stream().allMatch(task -> task.state() == State.RUNNING));

Review Comment:
   See above



-- 
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


[GitHub] [kafka] cadonna commented on pull request #12379: KAFKA-10199: Remove call to Task#completeRestoration from state updater

Posted by GitBox <gi...@apache.org>.
cadonna commented on PR #12379:
URL: https://github.com/apache/kafka/pull/12379#issuecomment-1176062651

   Test failure is unrelated:
   ```
   Build / JDK 11 and Scala 2.13 / testTaskCancellation() – org.apache.kafka.trogdor.coordinator.CoordinatorTest
   ```


-- 
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


[GitHub] [kafka] cadonna commented on a diff in pull request #12379: KAFKA-10199: Remove call to Task#completeRestoration from state updater

Posted by GitBox <gi...@apache.org>.
cadonna commented on code in PR #12379:
URL: https://github.com/apache/kafka/pull/12379#discussion_r913696040


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdaterTest.java:
##########
@@ -993,9 +979,6 @@ private void verifyRemovedTasks(final Task... tasks) throws Exception {
                 VERIFICATION_TIMEOUT,
                 "Did not get all removed task within the given timeout!"
             );
-            assertTrue(removedTasks.stream()
-                .allMatch(task -> task.isActive() && task.state() == State.RESTORING
-                    || !task.isActive() && task.state() == State.RUNNING));

Review Comment:
   See above



-- 
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


[GitHub] [kafka] cadonna merged pull request #12379: KAFKA-10199: Remove call to Task#completeRestoration from state updater

Posted by GitBox <gi...@apache.org>.
cadonna merged PR #12379:
URL: https://github.com/apache/kafka/pull/12379


-- 
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