public static CheckpointInfo recoverMemTableInfo(File logDirectory) {
    // find all .checkpoint file
    File[] checkpointFiles = CheckpointFileUtils.listAllCheckpointFiles(logDirectory);
    if (checkpointFiles == null) {
      return new CheckpointInfo(0, Collections.emptyMap());
    }
    // desc sort by version id
    CheckpointFileUtils.descSortByVersionId(checkpointFiles);
    // find last valid .checkpoint file and load checkpoints from it
    long maxMemTableId = 0;
    List<Checkpoint> checkpoints = null;
    for (File checkpointFile : checkpointFiles) {
      CheckpointReader reader = new CheckpointReader(checkpointFile);
      maxMemTableId = reader.getMaxMemTableId();
      checkpoints = reader.getCheckpoints();
      if (!checkpoints.isEmpty()) {
        break;
      }
    }
    if (checkpoints == null || checkpoints.isEmpty()) {
      return new CheckpointInfo(0, Collections.emptyMap());
    }
    // recover memTables information by checkpoints
    Map<Long, MemTableInfo> memTableId2Info = new HashMap<>();
    for (Checkpoint checkpoint : checkpoints) {
      switch (checkpoint.getType()) {
        case GLOBAL_MEMORY_TABLE_INFO:
        case CREATE_MEMORY_TABLE:
          for (MemTableInfo memTableInfo : checkpoint.getMemTableInfos()) {
            maxMemTableId = Math.max(maxMemTableId, memTableInfo.getMemTableId());
            memTableId2Info.put(memTableInfo.getMemTableId(), memTableInfo);
          }
          break;
        case FLUSH_MEMORY_TABLE:
          for (MemTableInfo memTableInfo : checkpoint.getMemTableInfos()) {
            memTableId2Info.remove(memTableInfo.getMemTableId());
          }
          break;
        default:
          break;
      }
    }
    return new CheckpointInfo(maxMemTableId, memTableId2Info);
  }
Recover memTable information from checkpoint folder.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/CheckpointRecoverUtils.java