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


##########
streams/src/test/java/org/apache/kafka/streams/integration/PauseResumeIntegrationTest.java:
##########
@@ -335,7 +333,39 @@ public void pauseResumehouldWorkAcrossInstances() throws 
Exception {
         kafkaStreams.resume();
         waitForApplicationState(singletonList(kafkaStreams), State.RUNNING, 
STARTUP_TIMEOUT);
 
-        awaitOutput(OUTPUT_STREAM_1, 3, COUNT_OUTPUT_DATA);
+        awaitOutput(OUTPUT_STREAM_1, 5, COUNT_OUTPUT_DATA);
+    }
+
+    @Test
+    public void pausedTopologyShouldNotRestoreStateStores() throws Exception {
+        produceToInputTopics(INPUT_STREAM_1, STANDARD_INPUT_DATA);
+
+        kafkaStreams = buildKafkaStreams(OUTPUT_STREAM_1);
+        kafkaStreams2 = buildKafkaStreams(OUTPUT_STREAM_1);
+        kafkaStreams.start();
+        kafkaStreams2.start();
+
+        waitForApplicationState(Arrays.asList(kafkaStreams, kafkaStreams2), 
State.RUNNING, STARTUP_TIMEOUT);
+
+        awaitOutput(OUTPUT_STREAM_1, 5, COUNT_OUTPUT_DATA);
+
+        kafkaStreams.close();
+        kafkaStreams2.close();
+
+        kafkaStreams = buildKafkaStreams(OUTPUT_STREAM_1);
+        kafkaStreams2 = buildKafkaStreams(OUTPUT_STREAM_1);
+        kafkaStreams.cleanUp();
+        kafkaStreams2.cleanUp();
+
+        kafkaStreams.pause();
+        kafkaStreams2.pause();
+        kafkaStreams.start();
+        kafkaStreams2.start();
+
+        waitForApplicationState(Arrays.asList(kafkaStreams, kafkaStreams2), 
State.REBALANCING, STARTUP_TIMEOUT);
+
+        assertTrue(kafkaStreams.allLocalStorePartitionLags().isEmpty());
+        assertTrue(kafkaStreams2.allLocalStorePartitionLags().isEmpty());

Review Comment:
   You could do something like:
   ```
           waitForApplicationState(Arrays.asList(kafkaStreams), 
State.REBALANCING, STARTUP_TIMEOUT);
           waitForCondition(
               () -> !kafkaStreams.allLocalStorePartitionLags().isEmpty(),
               "Lags for local store partitions were not found within the 
timeout!");
           waitUntilStreamsHasPolled(kafkaStreams, 2);
           final long stateStoreLag1 = 
kafkaStreams.allLocalStorePartitionLags().get("test-store").get(0).offsetLag();
           waitUntilStreamsHasPolled(kafkaStreams, 2);
           final long stateStoreLag2 = 
kafkaStreams.allLocalStorePartitionLags().get("test-store").get(0).offsetLag();
           assertTrue(stateStoreLag1 > 0);
           assertEquals(stateStoreLag1, stateStoreLag2);
   ```
   This code just considers one Streams client. You need to add 
`Materialized.as("test-store")` to the call to `count()` in your topology.
   As soon as you activated the standbys, you need to do the same for the 
second Streams client. 



-- 
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-unsubscr...@kafka.apache.org

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

Reply via email to