public List<PartialPath> getAllDatabasePaths(final Boolean isTableModel) {
    final List<PartialPath> res = new ArrayList<>();
    final Deque<IConfigMNode> nodeStack = new ArrayDeque<>();
    nodeStack.add(root);
    while (!nodeStack.isEmpty()) {
      final IConfigMNode current = nodeStack.pop();
      if (current.isDatabase()) {
        if (Boolean.TRUE.equals(isTableModel) && !current.getDatabaseSchema().isIsTableModel()
            || Boolean.FALSE.equals(isTableModel) && current.getDatabaseSchema().isIsTableModel()) {
          continue;
        }
        res.add(current.getPartialPath());
      } else {
        nodeStack.addAll(current.getChildren().values());
      }
    }
    return res;
  }
Get all database names

@return a list contains all distinct databases
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java