@Test
  public void testStartANewSyncUpToolAfterFailed() throws Exception {
    // Start syncUpTool for the first time with non-force mode,
    // let's assume that this will fail in sync data,
    // this does not affect our test results
    syncUp(UTIL1);
    Path rootDir = CommonFSUtils.getRootDir(UTIL1.getConfiguration());
    Path syncUpInfoDir = new Path(rootDir, ReplicationSyncUp.INFO_DIR);
    Path replicationInfoPath = new Path(syncUpInfoDir, ReplicationSyncUp.INFO_FILE);
    FileSystem fs = UTIL1.getTestFileSystem();
    assertTrue(fs.exists(replicationInfoPath));
    FileStatus fileStatus1 = fs.getFileStatus(replicationInfoPath);

    // Start syncUpTool for the second time with non-force mode,
    // startup will fail because replication info file already exists
    try {
      syncUp(UTIL1);
    } catch (Exception e) {
      assertTrue("e should be a FileAlreadyExistsException",
        (e instanceof FileAlreadyExistsException));
    }
    FileStatus fileStatus2 = fs.getFileStatus(replicationInfoPath);
    assertEquals(fileStatus1.getModificationTime(), fileStatus2.getModificationTime());

    // Start syncUpTool for the third time with force mode,
    // startup will success and create a new replication info file
    syncUp(UTIL1, new String[] { "-f" });
    FileStatus fileStatus3 = fs.getFileStatus(replicationInfoPath);
    assertTrue(fileStatus3.getModificationTime() > fileStatus2.getModificationTime());
  }
test "start a new ReplicationSyncUp after the previous failed". See HBASE-27623 for details.
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java