public MemTableInfo getOldestUnpinnedMemTableInfo() {
    // find oldest memTable
    return activeOrPinnedMemTables().stream()
        .filter(memTableInfo -> !memTableInfo.isPinned())
        .min(Comparator.comparingLong(MemTableInfo::getMemTableId))
        .orElse(null);
  }
Get MemTableInfo of oldest unpinned MemTable, whose first version id is smallest.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/checkpoint/CheckpointManager.java