Class InstancePartitionsUtils


  • public class InstancePartitionsUtils
    extends Object
    Utility class for instance partitions.
    • Field Detail

    • Method Detail

      • getInstancePartitionsName

        public static String getInstancePartitionsName​(String tableName,
                                                       String instancePartitionsType)
        Returns the name of the instance partitions for the given table name (with or without type suffix) and instance partitions type.
      • fetchOrComputeInstancePartitions

        public static InstancePartitions fetchOrComputeInstancePartitions​(org.apache.helix.HelixManager helixManager,
                                                                          TableConfig tableConfig,
                                                                          InstancePartitionsType instancePartitionsType)
        Fetches the instance partitions from Helix property store if it exists, or computes it for backward-compatibility.
      • fetchInstancePartitions

        @Nullable
        public static InstancePartitions fetchInstancePartitions​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.ZNRecord> propertyStore,
                                                                 String instancePartitionsName)
        Fetches the instance partitions from Helix property store.
      • computeDefaultInstancePartitions

        public static InstancePartitions computeDefaultInstancePartitions​(org.apache.helix.HelixManager helixManager,
                                                                          TableConfig tableConfig,
                                                                          InstancePartitionsType instancePartitionsType)
        Computes the default instance partitions. Sort all qualified instances and rotate the list based on the table name to prevent creating hotspot servers.

        Choose both enabled and disabled instances with the server tag as the qualified instances to avoid unexpected data shuffling when instances get disabled.

      • computeDefaultInstancePartitionsForTag

        public static InstancePartitions computeDefaultInstancePartitionsForTag​(org.apache.helix.HelixManager helixManager,
                                                                                String tableNameWithType,
                                                                                String instancePartitionsType,
                                                                                String serverTag)
        Computes the default instance partitions using the given serverTag. Sort all qualified instances and rotate the list based on the table name to prevent creating hotspot servers.

        Choose both enabled and disabled instances with the server tag as the qualified instances to avoid unexpected data shuffling when instances get disabled.

      • persistInstancePartitions

        public static void persistInstancePartitions​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.ZNRecord> propertyStore,
                                                     InstancePartitions instancePartitions)
        Persists the instance partitions to Helix property store.
      • removeInstancePartitions

        public static void removeInstancePartitions​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.ZNRecord> propertyStore,
                                                    String instancePartitionsName)
        Removes the instance partitions from Helix property store.