Class InstancePartitions


  • public class InstancePartitions
    extends Object
    Instance partitions for the table.

    The instance partitions is stored as a map from partition of the format: <partitionId>_<replicaGroupId> to list of instances, and is persisted under the ZK path: <cluster>/PROPERTYSTORE/INSTANCE_PARTITIONS.

    • Partition: a set of instances that contains the segments of the same partition (value partition for offline table, or stream partition for real-time table)

      NOTE: For real-time table CONSUMING instance partitions, partition cannot be explicitly configured (number of partitions must be 1), but has to be derived from the index of the instance. Each instance will contain all the segments from a stream partition before them getting relocated to the COMPLETED instance partitions. The stream partitions will be evenly spread over all instances (within each replica-group if replica-group is configured).

      TODO: Support explicit partition configuration for CONSUMING instance partitions

    • Replica-group: a set of instances that contains one replica of all the segments

    The instance partitions name is of the format <rawTableName>_<instancePartitionsType>, e.g. table_OFFLINE, table_CONSUMING, table_COMPLETED.

    When partition is not enabled, all instances will be stored as partition 0.

    When replica-group is not enabled, all instances will be stored as replica-group 0.

    The segment assignment will be based on the instance partitions of the table.

    • Constructor Detail

      • InstancePartitions

        public InstancePartitions​(String instancePartitionsName)
    • Method Detail

      • getInstancePartitionsName

        public String getInstancePartitionsName()
      • getNumPartitions

        public int getNumPartitions()
      • getNumReplicaGroups

        public int getNumReplicaGroups()
      • getInstances

        public List<String> getInstances​(int partitionId,
                                         int replicaGroupId)
      • setInstances

        public void setInstances​(int partitionId,
                                 int replicaGroupId,
                                 List<String> instances)
      • fromZNRecord

        public static InstancePartitions fromZNRecord​(org.apache.helix.zookeeper.datamodel.ZNRecord znRecord)
      • toZNRecord

        public org.apache.helix.zookeeper.datamodel.ZNRecord toZNRecord()
      • withName

        public InstancePartitions withName​(String newName)
        Returns a new instance of InstancePartitions with the given name
      • toJsonString

        public String toJsonString()