public static WALEntry deserialize(DataInputStream stream) throws IOException {
    byte typeNum = stream.readByte();
    WALEntryType type = WALEntryType.valueOf(typeNum);

    // handle signal
    switch (type) {
      case CLOSE_SIGNAL:
      case ROLL_WAL_LOG_WRITER_SIGNAL:
      case WAL_FILE_INFO_END_MARKER:
        return new WALSignalEntry(type);
      default:
        break;
    }

    // handle info
    long memTableId = stream.readLong();
    WALEntryValue value = null;
    switch (type) {
      case MEMORY_TABLE_SNAPSHOT:
        value = AbstractMemTable.Factory.create(stream);
        break;
      case OLD_MEMORY_TABLE_SNAPSHOT:
        value = AbstractMemTable.Factory.createFromOldMemTableSnapshot(stream);
        break;
      case INSERT_ROW_NODE:
        value = (InsertRowNode) PlanNodeType.deserializeFromWAL(stream);
        break;
      case INSERT_TABLET_NODE:
        value = (InsertTabletNode) PlanNodeType.deserializeFromWAL(stream);
        break;
      case INSERT_ROWS_NODE:
        value = (InsertRowsNode) PlanNodeType.deserializeFromWAL(stream);
        break;
      case DELETE_DATA_NODE:
        value = (DeleteDataNode) PlanNodeType.deserializeFromWAL(stream);
        break;
      case RELATIONAL_DELETE_DATA_NODE:
        value = (RelationalDeleteDataNode) PlanNodeType.deserializeFromWAL(stream);
        break;
      case CONTINUOUS_SAME_SEARCH_INDEX_SEPARATOR_NODE:
        value = (ContinuousSameSearchIndexSeparatorNode) PlanNodeType.deserializeFromWAL(stream);
        break;
      default:
        throw new RuntimeException("Unknown WALEntry type " + type);
    }
    return new WALInfoEntry(type, memTableId, value);
  }
{@link WALEntry} is the basic element of .wal file, including type, memTable id, and specific
value(physical plan or memTable snapshot).
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/buffer/WALEntry.java