SzyWilliam commented on code in PR #661:
URL: https://github.com/apache/ratis/pull/661#discussion_r909300993


##########
ratis-server/src/main/java/org/apache/ratis/server/storage/SnapshotManager.java:
##########
@@ -98,17 +102,21 @@ public void installSnapshot(StateMachine stateMachine,
           }
           // create the temp snapshot file and put padding inside
           out = new FileOutputStream(tmpSnapshotFile);
+          digester = MD5Hash.getDigester();
+          outWithDigest = new DigestOutputStream(out, digester);
         } else {
           Preconditions.assertTrue(tmpSnapshotFile.exists());
           out = new FileOutputStream(tmpSnapshotFile, true);
+          outWithDigest = new DigestOutputStream(out, digester);
           FileChannel fc = out.getChannel();
           fc.position(chunk.getOffset());
         }
 
         // write data to the file
-        out.write(chunk.getData().toByteArray());
+        outWithDigest.write(chunk.getData().toByteArray());

Review Comment:
   The lint says new DigestOutputStream(...) here will cause a opened stream, 
so I' ll use the try() clause



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

Reply via email to