SzyWilliam commented on code in PR #661:
URL: https://github.com/apache/ratis/pull/661#discussion_r909270969
##########
ratis-server/src/main/java/org/apache/ratis/server/storage/SnapshotManager.java:
##########
@@ -51,6 +53,7 @@ public class SnapshotManager {
private final RaftStorage storage;
private final RaftPeerId selfId;
+ private MessageDigest digester;
Review Comment:
done
##########
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:
done
--
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]