private RegionReplicationSink setUpSpiedRegionReplicationSink(
    final RegionReplicationSink regionReplicationSink, final HRegionForTest primaryRegion,
    final AtomicInteger counter) {
    RegionReplicationSink spiedRegionReplicationSink = Mockito.spy(regionReplicationSink);

    Mockito.doAnswer((invocationOnMock) -> {
      if (!testWALTimout || !USER_THREAD_NAME.equals(Thread.currentThread().getName())) {
        invocationOnMock.callRealMethod();
        return null;
      }
      WALKeyImpl walKey = invocationOnMock.getArgument(0);
      if (!walKey.getTableName().equals(tableName)) {
        invocationOnMock.callRealMethod();
        return null;
      }
      counter.incrementAndGet();
      invocationOnMock.callRealMethod();
      return null;
    }).when(spiedRegionReplicationSink).add(Mockito.any(), Mockito.any(), Mockito.any());
    primaryRegion.setRegionReplicationSink(spiedRegionReplicationSink);
    return spiedRegionReplicationSink;
  }
Write second put,the {@link WAL#sync} timeout and throws
{@link WALSyncTimeoutIOException},{@link HRegion#put} is failed and rowKey2 is not
applied to primary and secondary replicas.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/regionreplication/TestRegionReplicationForWriteException.java