@Test
  public void testRegionObserverFlushTimeStacking() throws Exception {
    byte[] ROW = Bytes.toBytes("testRow");
    byte[] TABLE = Bytes.toBytes(getClass().getName());
    byte[] A = Bytes.toBytes("A");
    byte[][] FAMILIES = new byte[][] { A };

    // Use new HTU to not overlap with the DFS cluster started in #CompactionStacking
    Configuration conf = new HBaseTestingUtil().getConfiguration();
    HRegion region = initHRegion(TABLE, getClass().getName(), conf, FAMILIES);
    RegionCoprocessorHost h = region.getCoprocessorHost();
    h.load(NoDataFromFlush.class, Coprocessor.PRIORITY_HIGHEST, conf);
    h.load(EmptyRegionObsever.class, Coprocessor.PRIORITY_USER, conf);

    // put a row and flush it to disk
    Put put = new Put(ROW);
    put.addColumn(A, A, A);
    region.put(put);
    region.flush(true);
    Get get = new Get(ROW);
    Result r = region.get(get);
    assertNull(
      "Got an unexpected number of rows - "
        + "no data should be returned with the NoDataFromScan coprocessor. Found: " + r,
      r.listCells());
    HBaseTestingUtil.closeRegionAndWAL(region);
  }
Don't allow any data to be written out in the compaction by creating a custom
{@link StoreScanner}.
hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverScannerOpenHook.java