private boolean logsAreEqual(Path p1, Path p2) throws IOException {
    try (WALStreamReader in1 = wals.createStreamReader(fs, p1);
      WALStreamReader in2 = wals.createStreamReader(fs, p2)) {
      Entry entry1;
      Entry entry2;
      while ((entry1 = in1.next()) != null) {
        entry2 = in2.next();
        if (
          (entry1.getKey().compareTo(entry2.getKey()) != 0)
            || (!entry1.getEdit().toString().equals(entry2.getEdit().toString()))
        ) {
          return false;
        }
      }
    }
    return true;
  }
@param leaveOpen index to leave un-closed. -1 to close all.
@return the writer that's still open, or null if all were closed.
hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALSplit.java