public int getRegionGroupLeaderCount(int dataNodeId, TConsensusGroupType type) {
    AtomicInteger result = new AtomicInteger(0);
    getRegionLeaderMap()
        .forEach(
            ((consensusGroupId, leaderId) -> {
              if (dataNodeId == leaderId && type.equals(consensusGroupId.getType())) {
                result.getAndIncrement();
              }
            }));
    return result.get();
  }
Get the number of RegionGroup-leaders in the specified DataNode.

@param dataNodeId The specified DataNode
@param type SchemaRegion or DataRegion
@return The number of RegionGroup-leaders
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/LoadManager.java