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

    String oldThreadName = Thread.currentThread().getName();
    Thread.currentThread().setName(HRegionForTest.USER_THREAD_NAME);
    try {

      byte[] rowKey1 = Bytes.toBytes(1);
      startTest = true;
      /**
       * Write First cell,replicating to secondary replica is error,and then
       * {@link RegionReplicationSink} request flush,after {@link RegionReplicationSink} receiving
       * the {@link FlushAction#START_FLUSH},the {@link RegionReplicationSink#failedReplicas} is
       * cleared,but replicating {@link FlushAction#START_FLUSH} is failed again,so
       * {@link RegionReplicationSink} request flush once more, but now memstore is empty,so the
       * {@link MemStoreFlusher} just write a {@link FlushAction#CANNOT_FLUSH} marker to the WAL.
       */
      regions[0].put(new Put(rowKey1).addColumn(FAMILY, QUAL, Bytes.toBytes(1)));
      /**
       * Wait for the {@link FlushAction#CANNOT_FLUSH} is written and initiating replication
       */
      regions[0].cyclicBarrier.await();
      assertTrue(regions[0].prepareFlushCounter.get() == 2);
      /**
       * The {@link RegionReplicationSink#failedReplicas} is cleared by the
       * {@link FlushAction#CANNOT_FLUSH} marker.
       */
      assertTrue(regionReplicationSink.getFailedReplicas().isEmpty());
    } finally {
      startTest = false;
      Thread.currentThread().setName(oldThreadName);
    }
  }
This test is for HBASE-26960, before HBASE-26960, {@link MemStoreFlusher} does not write the
{@link FlushAction#CANNOT_FLUSH} marker to the WAL when the memstore is empty,so if the
{@link RegionReplicationSink} request a flush when the memstore is empty, it could not receive
the {@link FlushAction#CANNOT_FLUSH} and the replication may be hanged. After HBASE-26768,when
the {@link RegionReplicationSink} request a flush when the memstore is empty,even it does not
writes the {@link FlushAction#CANNOT_FLUSH} marker to the WAL,we also replicate the
{@link FlushAction#CANNOT_FLUSH} marker to the secondary region replica.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/regionreplication/TestRegionReplicationForFlushMarker.java