Uploaded image for project: 'Ratis'
  1. Ratis
  2. RATIS-1681

InstallSnapshot Atomicity

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3.0
    • 2.4.0
    • util
    • None

    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

          Activity

            People

              William Song Song Ziyang
              William Song Song Ziyang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m