public Map<String, List<TConsensusGroupId>> getCurrentDatabaseRegionGroupMap(
      TConsensusGroupType type) {
    Map<String, List<TConsensusGroupId>> databaseRegionGroupMap = new TreeMap<>();
    regionGroupCacheMap.forEach(
        (regionGroupId, regionGroupCache) -> {
          if (type.equals(regionGroupId.getType())) {
            databaseRegionGroupMap
                .computeIfAbsent(regionGroupCache.getDatabase(), empty -> new ArrayList<>())
                .add(regionGroupId);
          }
        });
    return databaseRegionGroupMap;
  }
Get a map of cached RegionGroups of all Databases.

@param type SchemaRegion or DataRegion
@return Map<Database, List<RegionGroupId>>
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java