You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by su...@apache.org on 2019/05/08 20:07:48 UTC
[incubator-pinot] branch master updated: Randomly choose segments
that need to be moved (#4191)
This is an automated email from the ASF dual-hosted git repository.
sunithabeeram pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 29b918f Randomly choose segments that need to be moved (#4191)
29b918f is described below
commit 29b918f998c24ad8de4e2bc7ec63a7180494824e
Author: Sunitha Beeram <sb...@linkedin.com>
AuthorDate: Wed May 8 13:07:41 2019 -0700
Randomly choose segments that need to be moved (#4191)
---
.../helix/core/rebalance/ReplicaGroupRebalanceSegmentStrategy.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/ReplicaGroupRebalanceSegmentStrategy.java b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/ReplicaGroupRebalanceSegmentStrategy.java
index a75f334..9b7d8e3 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/ReplicaGroupRebalanceSegmentStrategy.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/ReplicaGroupRebalanceSegmentStrategy.java
@@ -20,6 +20,7 @@ package org.apache.pinot.controller.helix.core.rebalance;
import com.google.common.base.Function;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -454,6 +455,8 @@ public class ReplicaGroupRebalanceSegmentStrategy implements RebalanceSegmentStr
// Remove segments from servers that has more segments
for (String server : serversInReplicaGroup) {
LinkedList<String> segmentsInServer = serverToSegments.get(server);
+ // randomize the segments to be moved
+ Collections.shuffle(segmentsInServer);
int segmentToMove = numSegmentsPerServer - segmentsInServer.size();
if (segmentToMove < 0) {
// Server has more segments than needed, remove segments from this server
@@ -463,6 +466,8 @@ public class ReplicaGroupRebalanceSegmentStrategy implements RebalanceSegmentStr
}
}
+ // randomize the segments to be added
+ Collections.shuffle(segmentsToAdd);
// Add segments to servers that has less segments than numSegmentsPerServer
for (String server : serversInReplicaGroup) {
LinkedList<String> segmentsInServer = serverToSegments.get(server);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org