private void mimicSyncUpAfterDelete() throws Exception {
    LOG.debug("mimicSyncUpAfterDelete");
    shutDownTargetHBaseCluster();

    List<Delete> list = new ArrayList<>();
    // delete half of the rows
    for (int i = 0; i < NB_ROWS_IN_BATCH / 2; i++) {
      String rowKey = "row" + i;
      Delete del = new Delete(Bytes.toBytes(rowKey));
      list.add(del);
    }
    ht1Source.delete(list);

    for (int i = 0; i < NB_ROWS_IN_BATCH; i++) {
      String rowKey = "row" + i;
      Delete del = new Delete(Bytes.toBytes(rowKey));
      list.add(del);
    }
    ht2Source.delete(list);

    int rowCount_ht1Source = countRows(ht1Source);
    assertEquals("t1_syncup has 51 rows on source, after remove 50 of the replicated colfam", 51,
      rowCount_ht1Source);

    int rowCount_ht2Source = countRows(ht2Source);
    assertEquals("t2_syncup has 101 rows on source, after remove 100 of the replicated colfam", 101,
      rowCount_ht2Source);
    List<ServerName> sourceRses = UTIL1.getHBaseCluster().getRegionServerThreads().stream()
      .map(rst -> rst.getRegionServer().getServerName()).collect(Collectors.toList());
    shutDownSourceHBaseCluster();
    restartTargetHBaseCluster(1);

    Thread.sleep(SLEEP_TIME);

    // before sync up
    int rowCountHt1TargetAtPeer1 = countRows(ht1TargetAtPeer1);
    int rowCountHt2TargetAtPeer1 = countRows(ht2TargetAtPeer1);
    assertEquals("@Peer1 t1_syncup should still have 100 rows", 100, rowCountHt1TargetAtPeer1);
    assertEquals("@Peer1 t2_syncup should still have 200 rows", 200, rowCountHt2TargetAtPeer1);

    syncUp(UTIL1);

    // After sync up
    rowCountHt1TargetAtPeer1 = countRows(ht1TargetAtPeer1);
    rowCountHt2TargetAtPeer1 = countRows(ht2TargetAtPeer1);
    assertEquals("@Peer1 t1_syncup should be sync up and have 50 rows", 50,
      rowCountHt1TargetAtPeer1);
    assertEquals("@Peer1 t2_syncup should be sync up and have 100 rows", 100,
      rowCountHt2TargetAtPeer1);

    // check we have recorded the dead region servers and also have an info file
    Path rootDir = CommonFSUtils.getRootDir(UTIL1.getConfiguration());
    Path syncUpInfoDir = new Path(rootDir, ReplicationSyncUp.INFO_DIR);
    FileSystem fs = UTIL1.getTestFileSystem();
    for (ServerName sn : sourceRses) {
      assertTrue(fs.exists(new Path(syncUpInfoDir, sn.getServerName())));
    }
    assertTrue(fs.exists(new Path(syncUpInfoDir, ReplicationSyncUp.INFO_FILE)));
    assertEquals(sourceRses.size() + 1, fs.listStatus(syncUpInfoDir).length);

    restartSourceHBaseCluster(1);
    // should finally removed all the records after restart
    UTIL1.waitFor(60000, () -> fs.listStatus(syncUpInfoDir).length == 0);
  }
Add a row to a table in each cluster, check it's replicated, delete it, check's gone Also check
the puts and deletes are not replicated back to the originating cluster.
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java