@Test
  public void testResumeStreamingFromPosition() throws Exception {
    long lastPosition = 0;
    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
      appendToLog("2");
      appendToLog("3");
      lastPosition = entryStream.getPosition();
    }
    // next stream should picks up where we left off
    try (WALEntryStream entryStream = new WALEntryStream(logQueue, fs, CONF, lastPosition, log,
      new MetricsSource("1"), fakeWalGroupId)) {
      assertEquals("2", getRow(next(entryStream)));
      assertEquals("3", getRow(next(entryStream)));
      assertEquals(HasNext.RETRY, entryStream.hasNext()); // done
      assertEquals(1, getQueue().size());
    }
  }
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