public static ProcedureWALHeader readHeader(InputStream stream) throws IOException {
    ProcedureWALHeader header;
    try {
      header = ProcedureWALHeader.parseDelimitedFrom(stream);
    } catch (InvalidProtocolBufferException e) {
      throw new InvalidWALDataException(e);
    }

    if (header == null) {
      throw new InvalidWALDataException("No data available to read the Header");
    }

    if (header.getVersion() < 0 || header.getVersion() != HEADER_VERSION) {
      throw new InvalidWALDataException(
        "Invalid Header version. got " + header.getVersion() + " expected " + HEADER_VERSION);
    }

    if (header.getType() < 0 || header.getType() > LOG_TYPE_MAX_VALID) {
      throw new InvalidWALDataException("Invalid header type. got " + header.getType());
    }

    return header;
  }
Load all the procedures in these ProcedureWALFiles, and rebuild the given {@code tracker} if
needed, i.e, the {@code tracker} is a partial one.
<p/>
The method in the give {@code loader} will be called at the end after we load all the
procedures and construct the hierarchy.
<p/>
And we will call the {@link ProcedureStoreTracker#resetModified()} method for the given
{@code tracker} before returning, as it will be used to track the next proc wal file's modified
procedures.
hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/ProcedureWALFormat.java