private void loadNextSegment() throws IOException {
    if (channel.position() >= endOffset) {
      throw new EOFException("Reach the end offset of wal file");
    }
    long startTime = System.nanoTime();
    long startPosition = channel.position();
    if (version == WALFileVersion.V2) {
      loadNextSegmentV2();
    } else if (version == WALFileVersion.V1) {
      loadNextSegmentV1();
    } else {
      tryLoadSegment();
    }
    WritingMetrics.getInstance()
        .recordWALRead(channel.position() - startPosition, System.nanoTime() - startTime);
  }
1 byte for whether enable compression, 4 byte for compressedSize
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/io/WALInputStream.java