Description
After installing a snapshot from leader, SnapshotManager will rename the tmp dir to statemachine dir so that the latest snapshot is visible to statemachine, see https://github.com/apache/ratis/blob/e49687aba20cad70c576900f1be59bb8fcd55d10/ratis-server/src/main/java/org/apache/ratis/server/storage/SnapshotManager.java#L154.
SnapshotManager uses Files.move underlying to rename the tmpdir to statemachine, see https://github.com/apache/ratis/blob/e49687aba20cad70c576900f1be59bb8fcd55d10/ratis-common/src/main/java/org/apache/ratis/util/FileUtils.java#L80. Files.move provide a CopyOption as StandardCopyOption.ATOMIC_MOVE, which guarantees atomicity in move operation, see https://docs.oracle.com/javase/8/docs/api/java/nio/file/StandardCopyOption.html.
We should use this option explicitly.
Attachments
Issue Links
- links to