Class InstancePartitionsUtils
- java.lang.Object
-
- org.apache.pinot.common.assignment.InstancePartitionsUtils
-
public class InstancePartitionsUtils extends Object
Utility class for instance partitions.
-
-
Field Summary
Fields Modifier and Type Field Description static charTYPE_SUFFIX_SEPARATOR
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static InstancePartitionscomputeDefaultInstancePartitions(org.apache.helix.HelixManager helixManager, TableConfig tableConfig, InstancePartitionsType instancePartitionsType)Computes the default instance partitions.static InstancePartitionscomputeDefaultInstancePartitionsForTag(org.apache.helix.HelixManager helixManager, String tableNameWithType, String instancePartitionsType, String serverTag)Computes the default instance partitions using the given serverTag.static InstancePartitionsfetchInstancePartitions(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore, String instancePartitionsName)Fetches the instance partitions from Helix property store.static InstancePartitionsfetchInstancePartitionsWithRename(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore, String instancePartitionsName, String newName)Gets the instance partitions with the given name, and returns a re-named copy of the same.static InstancePartitionsfetchOrComputeInstancePartitions(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.static StringgetInstancePartitionsName(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.static voidpersistInstancePartitions(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore, InstancePartitions instancePartitions)Persists the instance partitions to Helix property store.static voidremoveInstancePartitions(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore, String instancePartitionsName)Removes the instance partitions from Helix property store.
-
-
-
Field Detail
-
TYPE_SUFFIX_SEPARATOR
public static final char TYPE_SUFFIX_SEPARATOR
- See Also:
- Constant Field Values
-
-
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.zookeeper.datamodel.ZNRecord> propertyStore, String instancePartitionsName)
Fetches the instance partitions from Helix property store.
-
fetchInstancePartitionsWithRename
public static InstancePartitions fetchInstancePartitionsWithRename(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore, String instancePartitionsName, String newName)
Gets the instance partitions with the given name, and returns a re-named copy of the same. This method is useful when we use a table with instancePartitionsMap since in that case the value of a table's instance partitions are copied over from an existing instancePartitions.
-
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.zookeeper.datamodel.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.zookeeper.datamodel.ZNRecord> propertyStore, String instancePartitionsName)Removes the instance partitions from Helix property store.
-
-