@Override
  protected int doWork() throws Exception {
    Path path = new Path(file);
    FileSystem fs = path.getFileSystem(conf);
    try (WALStreamReader reader = WALFactory.createStreamReader(fs, path, conf)) {
      for (;;) {
        WAL.Entry entry = reader.next();
        if (entry == null) {
          return 0;
        }
        WALKey key = entry.getKey();
        WALEdit edit = entry.getEdit();
        long sequenceId = key.getSequenceId();
        long writeTime = key.getWriteTime();
        out.println(
          String.format(KEY_TMPL, sequenceId, FORMATTER.format(Instant.ofEpochMilli(writeTime))));
        for (Cell cell : edit.getCells()) {
          Map<String, Object> op = WALPrettyPrinter.toStringMap((ExtendedCell) cell);
          if (
            !Bytes.equals(PROC_FAMILY, 0, PROC_FAMILY.length, cell.getFamilyArray(),
              cell.getFamilyOffset(), cell.getFamilyLength())
          ) {
            // We could have cells other than procedure edits, for example, a flush marker
            WALPrettyPrinter.printCell(out, op, false, false);
            continue;
          }
          long procId = Bytes.toLong(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
          out.println("pid=" + procId + ", type=" + op.get("type") + ", column=" + op.get("family")
            + ":" + op.get("qualifier"));
          if (cell.getType() == Cell.Type.Put) {
            if (cell.getValueLength() > 0) {
              // should be a normal put
              Procedure<?> proc =
                ProcedureUtil.convertToProcedure(ProcedureProtos.Procedure.parser()
                  .parseFrom(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
              out.println("\t" + proc.toStringDetails());
            } else {
              // should be a 'delete' put
              out.println("\tmark deleted");
            }
          }
          out.println("cell total size sum: " + cell.heapSize());
        }
        out.println("edit heap size: " + edit.heapSize());
        out.println("position: " + reader.getPosition());
      }
    }
  }
A tool to dump the procedures in the WAL files.
<p/>
The different between this and {@link WALPrettyPrinter} is that, this class will decode the
procedure in the WALEdit for better debugging. You are free to use {@link WALPrettyPrinter} to
dump the same file as well.
hbase-server/src/main/java/org/apache/hadoop/hbase/procedure2/store/region/WALProcedurePrettyPrinter.java