@Test
  public void testNewEntriesWhileStreaming() throws Exception {
    appendToLog("1");
    try (WALEntryStream entryStream =
      new WALEntryStream(logQueue, fs, CONF, 0, log, new MetricsSource("1"), fakeWalGroupId)) {
      assertNotNull(next(entryStream)); // we've hit the end of the stream at this point

      // some new entries come in while we're streaming
      appendToLog("2");
      appendToLog("3");

      // don't see them
      assertEquals(HasNext.RETRY, entryStream.hasNext());

      // But we do if we retry next time, as the entryStream will reset the reader
      assertEquals("2", getRow(next(entryStream)));
      assertEquals("3", getRow(next(entryStream)));
      // reached the end again
      assertEquals(HasNext.RETRY, entryStream.hasNext());
    }
  }
Tests that if writes come in while we have a stream open, we shouldn't miss them
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestBasicWALEntryStream.java