@Test
  public void test() throws Exception {
    final HRegionForTest[] regions = this.createTable();
    final AtomicBoolean completedRef = new AtomicBoolean(false);
    RegionReplicationSink regionReplicationSink = regions[0].getRegionReplicationSink().get();
    assertTrue(regionReplicationSink != null);

    RegionReplicationSink spiedRegionReplicationSink =
      this.setUpSpiedRegionReplicationSink(regionReplicationSink, regions[0], completedRef);

    String oldThreadName = Thread.currentThread().getName();
    Thread.currentThread().setName(HRegionForTest.USER_THREAD_NAME);
    try {
      startTest = true;
      /**
       * Write First cell,replicating to secondary replica is error.
       */
      byte[] rowKey1 = Bytes.toBytes(1);

      regions[0].put(new Put(rowKey1).addColumn(FAMILY, QUAL, Bytes.toBytes(1)));
      regions[0].flushcache(true, true, FlushLifeCycleTracker.DUMMY);

      HTU.waitFor(120000, () -> completedRef.get());
      assertTrue(spiedRegionReplicationSink.getFailedReplicas().isEmpty());
    } finally {
      startTest = false;
      Thread.currentThread().setName(oldThreadName);
    }
  }
This test is for HBASE-26768,test the case that we have already clear the
{@link RegionReplicationSink#failedReplicas} due to a flush all edit,which may in flusher
thread,and then in the callback of replay, which may in Netty nioEventLoop,we add a replica to
the {@link RegionReplicationSink#failedReplicas} because of a failure of replicating.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/regionreplication/TestRegionReplicationSinkCallbackAndFlushConcurrently.java