@Test
  public void test() throws Exception {
    HRegionServer server = TEST_UTIL.getHBaseCluster().getRegionServer(0);
    AbstractFSWAL<?> wal = (AbstractFSWAL<?>) server.getWAL(null);
    Path currentFile = wal.getCurrentFileName();
    // restart every dn to simulate a dn rolling upgrade
    for (int i = 0, n = TEST_UTIL.getDFSCluster().getDataNodes().size(); i < n; i++) {
      // This is NOT a bug, when restart dn in miniDFSCluster, it will remove the stopped dn from
      // the dn list and then add to the tail of this list, we need to always restart the first one
      // to simulate rolling upgrade of every dn.
      TEST_UTIL.getDFSCluster().restartDataNode(0);
      // sleep enough time so log roller can detect the pipeline break and roll log
      Thread.sleep(DN_RESTART_INTERVAL);
    }

    if (!server.getFileSystem().exists(currentFile)) {
      Path walRootDir = CommonFSUtils.getWALRootDir(TEST_UTIL.getConfiguration());
      final Path oldLogDir = new Path(walRootDir, HConstants.HREGION_OLDLOGDIR_NAME);
      currentFile = new Path(oldLogDir, currentFile.getName());
    }
    // if the log is not rolled, then we can never open this wal forever.
    try (WALStreamReader reader = NoEOFWALStreamReader.create(TEST_UTIL.getTestFileSystem(),
      currentFile, TEST_UTIL.getConfiguration())) {
      reader.next();
    }
  }
see HBASE-18132 This is a test case of failing open a wal(for replication for example) after
all datanode restarted (rolling upgrade, for example). Before this patch, low replication
detection is only used when syncing wal. But if the wal haven't had any entry whiten, it will
never know all the replica of the wal is broken(because of dn restarting). And this wal can
never be open
hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALOpenAfterDNRollingStart.java