mjsax commented on a change in pull request #9121:
URL: https://github.com/apache/kafka/pull/9121#discussion_r477606207



##########
File path: 
streams/src/test/java/org/apache/kafka/streams/processor/internals/GlobalStateManagerImplTest.java
##########
@@ -180,6 +183,27 @@ public void shouldReadCheckpointOffsets() throws 
IOException {
         assertEquals(expected, offsets);
     }
 
+    @Test
+    public void shouldLogWarningMessageWhenIOExceptionInCheckPoint() throws 
IOException {
+        final Map<TopicPartition, Long> offsets = Collections.singletonMap(t1, 
25L);
+        stateManager.initialize();
+        stateManager.updateChangelogOffsets(offsets);
+
+        final File file = new File(stateDirectory.globalStateDir(), 
StateManagerUtil.CHECKPOINT_FILE_NAME + ".tmp");
+        file.createNewFile();
+        // set the checkpoint tmp file to read-only to simulate the 
IOException situation
+        file.setWritable(false);
+
+        try (final LogCaptureAppender appender =
+                 
LogCaptureAppender.createAndRegister(GlobalStateManagerImpl.class)) {
+
+            // checkpoint should fail due to the file is readonly
+            stateManager.checkpoint();
+            assertThat(appender.getMessages(), hasItem(containsString(
+                "Failed to write offset checkpoint file to " + 
checkpointFile.getPath() + " for global stores")));

Review comment:
       Ah. Good point. We can leave as-is.




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

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


Reply via email to