private void testSplitWithMovingWAL(InputSplit split, byte[] col1, byte[] col2) throws Exception {
    WALRecordReader<WALKey> reader = getReader();
    reader.initialize(split, MapReduceTestUtil.createDummyMapTaskAttemptContext(conf));

    assertTrue(reader.nextKeyValue());
    Cell cell = reader.getCurrentValue().getCells().get(0);
    if (
      !Bytes.equals(col1, 0, col1.length, cell.getQualifierArray(), cell.getQualifierOffset(),
        cell.getQualifierLength())
    ) {
      assertTrue(
        "expected [" + Bytes.toString(col1) + "], actual [" + Bytes.toString(
          cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()) + "]",
        false);
    }
    // Move log file to archive directory
    // While WAL record reader is open
    WALInputFormat.WALSplit split_ = (WALInputFormat.WALSplit) split;
    Path logFile = new Path(split_.getLogFileName());
    Path archivedLogDir = getWALArchiveDir(conf);
    Path archivedLogLocation = new Path(archivedLogDir, logFile.getName());
    assertNotEquals(split_.getLogFileName(), archivedLogLocation.toString());

    assertTrue(fs.rename(logFile, archivedLogLocation));
    assertTrue(fs.exists(archivedLogDir));
    assertFalse(fs.exists(logFile));
    // TODO: This is not behaving as expected. WALInputFormat#WALKeyRecordReader doesn't open
    // TODO: the archivedLogLocation to read next key value.
    assertTrue(reader.nextKeyValue());
    cell = reader.getCurrentValue().getCells().get(0);
    if (
      !Bytes.equals(col2, 0, col2.length, cell.getQualifierArray(), cell.getQualifierOffset(),
        cell.getQualifierLength())
    ) {
      assertTrue(
        "expected [" + Bytes.toString(col2) + "], actual [" + Bytes.toString(
          cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()) + "]",
        false);
    }
    reader.close();
  }
Create a new reader from the split, match the edits against the passed columns, moving WAL to
archive in between readings
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestWALRecordReader.java