public void reBalanceDataPartitionPolicy(List<TConsensusGroupId> dataRegionGroups) {
    if (dataRegionGroups.isEmpty()) {
      // No need to re-balance when there is no DataRegionGroup
      return;
    }

    dataAllotTableLock.lock();
    try {
      dataRegionGroups.forEach(
          dataRegionGroup -> {
            if (!seriesPartitionSlotCounter.containsKey(dataRegionGroup)) {
              seriesPartitionSlotCounter.put(dataRegionGroup, 0);
            }
          });

      // Enumerate all SeriesSlots randomly
      List<TSeriesPartitionSlot> seriesPartitionSlots = new ArrayList<>();
      for (int i = 0; i < SERIES_SLOT_NUM; i++) {
        seriesPartitionSlots.add(new TSeriesPartitionSlot(i));
      }
      Collections.shuffle(seriesPartitionSlots);

      int mu = SERIES_SLOT_NUM / dataRegionGroups.size();
      for (TSeriesPartitionSlot seriesPartitionSlot : seriesPartitionSlots) {
        if (!dataAllotMap.containsKey(seriesPartitionSlot)) {
          // Skip unallocated SeriesPartitionSlot
          // They will be activated when allocating DataPartition
          continue;
        }

        TConsensusGroupId regionGroupId = dataAllotMap.get(seriesPartitionSlot);
        int seriesPartitionSlotCount = seriesPartitionSlotCounter.get(regionGroupId);
        if (seriesPartitionSlotCount > mu) {
          // Remove from dataAllotMap if the number of SeriesSlots is greater than mu
          // They will be re-activated when allocating DataPartition
          dataAllotMap.remove(seriesPartitionSlot);
          seriesPartitionSlotCounter.put(regionGroupId, seriesPartitionSlotCount - 1);
        }
      }
    } finally {
      dataAllotTableLock.unlock();
    }
  }
Re-balance the allocation of SeriesSlots to RegionGroups.

@param dataRegionGroups All DataRegionGroups currently in the Database
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/partition/DataPartitionPolicyTable.java