public int getRegionCount(int dataNodeId, TConsensusGroupType type) {
    AtomicInteger result = new AtomicInteger(0);
    databasePartitionTables
        .values()
        .forEach(
            databasePartitionTable ->
                result.getAndAdd(databasePartitionTable.getRegionCount(dataNodeId, type)));
    return result.get();
  }
Only leader use this interface.

<p>Get the number of Regions currently owned by the specified DataNode

@param dataNodeId The specified DataNode
@param type SchemaRegion or DataRegion
@return The number of Regions currently owned by the specified DataNode
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java