@Override
  public void serializeToWAL(IWALByteBufferView buffer) {
    if (isSignalMemTable()) {
      WALWriteUtils.write(isSignalMemTable(), buffer);
      return;
    }
    // marker for multi-tvlist mem chunk
    WALWriteUtils.write((byte) -1, buffer);
    buffer.putInt(seriesNumber);
    buffer.putLong(memSize);
    buffer.putLong(tvListRamCost);
    buffer.putLong(totalPointsNum);
    buffer.putLong(totalPointsNumThreshold);
    buffer.putLong(maxPlanIndex);
    buffer.putLong(minPlanIndex);

    buffer.putInt(memTableMap.size());
    for (Map.Entry<IDeviceID, IWritableMemChunkGroup> entry : memTableMap.entrySet()) {
      try {
        entry.getKey().serialize(buffer);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
      IWritableMemChunkGroup memChunkGroup = entry.getValue();
      WALWriteUtils.write(memChunkGroup instanceof AlignedWritableMemChunkGroup, buffer);
      memChunkGroup.serializeToWAL(buffer);
    }
  }
Notice: this method is concurrent unsafe.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java