private void updateReplicaSets(
      List<TRegionReplicaSet> allocatedReplicaSets,
      Set<TRegionReplicaSet> affectedReplicaSets,
      Map<TConsensusGroupId, TDataNodeLocation> removedNodeMap) {
    for (TRegionReplicaSet replicaSet : affectedReplicaSets) {
      // Remove the replica set, update its node list, then re-add it
      allocatedReplicaSets.remove(replicaSet);
      replicaSet.getDataNodeLocations().remove(removedNodeMap.get(replicaSet.getRegionId()));
      allocatedReplicaSets.add(replicaSet);
    }
  }
Updates each affected replica set by removing the removed DataNode from its list. The
allocatedReplicaSets list is updated accordingly.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RemoveDataNodeHandler.java