code: public void recover() {
      try {
        boolean checkpointExists = mUfs.isFile(mCheckpoint.toString());
        boolean backupCheckpointExists = mUfs.isFile(mBackupCheckpoint.toString());
        boolean tempBackupCheckpointExists = mUfs.isFile(mTempBackupCheckpoint.toString());
        Preconditions
            .checkState(!(checkpointExists && backupCheckpointExists && tempBackupCheckpointExists),
                "checkpoint, temp backup checkpoint, and backup checkpoint should never all exist ");
        if (tempBackupCheckpointExists) {
          // If mCheckpointPath also exists, step 2 must have implemented rename as copy + delete, and
          // failed during the delete.
          UnderFileSystemUtils.deleteFileIfExists(mUfs, mCheckpoint.toString());
          mUfs.renameFile(mTempBackupCheckpoint.toString(), mCheckpoint.toString());
        }
        if (backupCheckpointExists) {
          // We must have crashed after step 3
          if (checkpointExists) {
            // We crashed after step 4, so we can finish steps 5 and 6.
            mWriter.deleteCompletedLogs();
            mUfs.deleteFile(mBackupCheckpoint.toString());
          } else {
            // We crashed before step 4, so we roll back to the backup checkpoint.
            mUfs.renameFile(mBackupCheckpoint.toString(), mCheckpoint.toString());
          }
        }
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
docs: Recovers the checkpoint in case the master crashed while updating it.