You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2021/10/12 18:04:37 UTC

[pinot] branch master updated: Make utility functions in `SegmentAssignmentUtils` public. (#7561)

This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 01cb4cd  Make utility functions in `SegmentAssignmentUtils` public. (#7561)
01cb4cd is described below

commit 01cb4cd2f1dfa29ccf3f92f302d5bf3a1c2d0494
Author: Mayank Shrivastava <ma...@apache.org>
AuthorDate: Tue Oct 12 11:03:46 2021 -0700

    Make utility functions in `SegmentAssignmentUtils` public. (#7561)
    
    The `SegmentAssignmentUtils` contains some segment assignment static utility functions that can be used standalone. Making them public.
---
 .../core/assignment/segment/SegmentAssignmentUtils.java    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/SegmentAssignmentUtils.java b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/SegmentAssignmentUtils.java
index 07b32f5..e27983e 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/SegmentAssignmentUtils.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/SegmentAssignmentUtils.java
@@ -45,7 +45,7 @@ public class SegmentAssignmentUtils {
   /**
    * Returns the number of segments assigned to each instance.
    */
-  static int[] getNumSegmentsAssignedPerInstance(Map<String, Map<String, String>> segmentAssignment,
+  public static int[] getNumSegmentsAssignedPerInstance(Map<String, Map<String, String>> segmentAssignment,
       List<String> instances) {
     int[] numSegmentsPerInstance = new int[instances.size()];
     Map<String, Integer> instanceNameToIdMap = getInstanceNameToIdMap(instances);
@@ -72,7 +72,7 @@ public class SegmentAssignmentUtils {
   /**
    * Returns instances for non-replica-group based assignment.
    */
-  static List<String> getInstancesForNonReplicaGroupBasedAssignment(InstancePartitions instancePartitions,
+  public static List<String> getInstancesForNonReplicaGroupBasedAssignment(InstancePartitions instancePartitions,
       int replication) {
     Preconditions
         .checkState(instancePartitions.getNumReplicaGroups() == 1 && instancePartitions.getNumPartitions() == 1,
@@ -89,7 +89,7 @@ public class SegmentAssignmentUtils {
   /**
    * Assigns the segment for the non-replica-group based segment assignment strategy and returns the assigned instances.
    */
-  static List<String> assignSegmentWithoutReplicaGroup(Map<String, Map<String, String>> currentAssignment,
+  public static List<String> assignSegmentWithoutReplicaGroup(Map<String, Map<String, String>> currentAssignment,
       InstancePartitions instancePartitions, int replication) {
     List<String> instances =
         SegmentAssignmentUtils.getInstancesForNonReplicaGroupBasedAssignment(instancePartitions, replication);
@@ -109,7 +109,7 @@ public class SegmentAssignmentUtils {
   /**
    * Assigns the segment for the replica-group based segment assignment strategy and returns the assigned instances.
    */
-  static List<String> assignSegmentWithReplicaGroup(Map<String, Map<String, String>> currentAssignment,
+  public static List<String> assignSegmentWithReplicaGroup(Map<String, Map<String, String>> currentAssignment,
       InstancePartitions instancePartitions, int partitionId) {
     // First assign the segment to replica-group 0
     List<String> instances = instancePartitions.getInstances(partitionId, 0);
@@ -138,7 +138,7 @@ public class SegmentAssignmentUtils {
   /**
    * Rebalances the table with Helix AutoRebalanceStrategy.
    */
-  static Map<String, Map<String, String>> rebalanceTableWithHelixAutoRebalanceStrategy(
+  public static Map<String, Map<String, String>> rebalanceTableWithHelixAutoRebalanceStrategy(
       Map<String, Map<String, String>> currentAssignment, List<String> instances, int replication) {
     // Use Helix AutoRebalanceStrategy to rebalance the table
     LinkedHashMap<String, Integer> states = new LinkedHashMap<>();
@@ -161,7 +161,7 @@ public class SegmentAssignmentUtils {
    * <p>The number of partitions for the segments can be different from the number of partitions in the instance
    * partitions. Uniformly spray the segment partitions over the instance partitions.
    */
-  static Map<String, Map<String, String>> rebalanceReplicaGroupBasedTable(
+  public static Map<String, Map<String, String>> rebalanceReplicaGroupBasedTable(
       Map<String, Map<String, String>> currentAssignment, InstancePartitions instancePartitions,
       Map<Integer, List<String>> partitionIdToSegmentsMap) {
     Map<String, Map<String, String>> newAssignment = new TreeMap<>();
@@ -195,7 +195,7 @@ public class SegmentAssignmentUtils {
    *   </li>
    * </ul>
    */
-  static void rebalanceReplicaGroupBasedPartition(Map<String, Map<String, String>> currentAssignment,
+  public static void rebalanceReplicaGroupBasedPartition(Map<String, Map<String, String>> currentAssignment,
       InstancePartitions instancePartitions, int partitionId, List<String> segments,
       Map<String, Map<String, String>> newAssignment) {
     // Fetch instances in replica-group 0

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org