public int countDataNodeScatterWidth(
      int dataNodeId, TConsensusGroupType type, int clusterNodeCount) {
    BitSet scatterSet = new BitSet(clusterNodeCount);
    databasePartitionTables
        .values()
        .forEach(
            databasePartitionTable ->
                databasePartitionTable.countDataNodeScatterWidth(dataNodeId, type, scatterSet));
    // The minimal scatter width is 0
    return Math.max(scatterSet.cardinality() - 1, 0);
  }
Only leader use this interface.

<p>Count the scatter width of the specified DataNode

@param dataNodeId The specified DataNode
@param type SchemaRegion or DataRegion
@param clusterNodeCount The number of registeredNodes
@return The schema/data scatter width of the specified DataNode. The scatter width refers to
    the number of other DataNodes in the cluster which have at least one identical schema/data
    replica as the specified DataNode.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java