private void initRegionGroupHeartbeatCache(
      Map<String, List<TRegionReplicaSet>> regionReplicaMap) {
    regionGroupCacheMap.clear();
    consensusGroupCacheMap.clear();
    regionReplicaMap.forEach(
        (database, regionReplicaSets) ->
            regionReplicaSets.forEach(
                regionReplicaSet -> {
                  TConsensusGroupId regionGroupId = regionReplicaSet.getRegionId();
                  boolean isStrongConsistency =
                      CONF.isConsensusGroupStrongConsistency(regionGroupId);
                  regionGroupCacheMap.put(
                      regionGroupId,
                      new RegionGroupCache(
                          database,
                          regionGroupId,
                          regionReplicaSet.getDataNodeLocations().stream()
                              .map(TDataNodeLocation::getDataNodeId)
                              .collect(Collectors.toSet()),
                          isStrongConsistency));
                  consensusGroupCacheMap.put(regionGroupId, new ConsensusGroupCache());
                }));
  }
Initialize the regionGroupCacheMap and regionRouteCacheMap when the ConfigNode-Leader is
switched.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java