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



##########
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");

Review comment:
       It's because we we will write data to the .tmp file first and then swap 
to the CHECKPOINT_FILE. And in the swap action, we use `Files.move` with 
`ATOMIC_MOVE` option, which will try to replace the target file if exists. I 
added comments for this line to explain the reason. Thank you.
   ref: 
https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#move-java.nio.file.Path-java.nio.file.Path-java.nio.file.CopyOption...-




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