Class PartitionUtils


  • public class PartitionUtils
    extends java.lang.Object
    • Constructor Detail

      • PartitionUtils

        public PartitionUtils()
    • Method Detail

      • calculatePartitionCount

        public static int calculatePartitionCount​(java.lang.String storeName,
                                                  long storageQuota,
                                                  int storePartitionCount,
                                                  long partitionSize,
                                                  int minPartitionCount,
                                                  int maxPartitionCount,
                                                  boolean isRoundUpEnabled,
                                                  int roundUpSize)
        Calculate partition count for new version. If store level partition count is not configured (0), calculate the number by storage quota and partition size. Otherwise, use the store level partition count.
      • getSubPartitions

        public static it.unimi.dsi.fastutil.ints.IntList getSubPartitions​(java.util.Collection<java.lang.Integer> userPartitions,
                                                                          int amplificationFactor)
      • getSubPartition

        public static int getSubPartition​(PubSubTopicPartition topicPartition,
                                          int amplificationFactor)
        Parameters:
        topicPartition - the PubSubTopicPartition topic which the record is from
        amplificationFactor - of the store-version
        Returns:
        leaderSubPartition if it's consuming from a Real-time topic, else return partition itself
      • getSubPartitions

        public static it.unimi.dsi.fastutil.ints.IntList getSubPartitions​(int userPartition,
                                                                          int amplificationFactor)
      • getUserPartitions

        public static it.unimi.dsi.fastutil.ints.IntList getUserPartitions​(java.util.Collection<java.lang.Integer> subPartitions,
                                                                           int amplificationFactor)
      • getUserPartition

        public static int getUserPartition​(int subPartition,
                                           int amplificationFactor)
      • getLeaderSubPartition

        public static int getLeaderSubPartition​(int userPartition,
                                                int amplificationFactor)
      • getUserPartitionLevelVenicePartitioner

        public static VenicePartitioner getUserPartitionLevelVenicePartitioner​(PartitionerConfig config)
        This util method returns a new venice partitioner that works for user-level partition, regardless of the amplification factor in the partitioner config.
      • getVenicePartitioner

        public static VenicePartitioner getVenicePartitioner​(java.lang.String partitionerClass,
                                                             int amplificationFactor,
                                                             VeniceProperties params)
      • getVenicePartitioner

        public static VenicePartitioner getVenicePartitioner​(java.lang.String partitionerClass,
                                                             int amplificationFactor,
                                                             VeniceProperties params,
                                                             org.apache.avro.Schema keySchema)
      • getAmplificationFactor

        public static int getAmplificationFactor​(ReadOnlyStoreRepository readOnlyStoreRepository,
                                                 java.lang.String topicName)
      • getAmplificationFactor

        public static int getAmplificationFactor​(ReadOnlyStoreRepository readOnlyStoreRepository,
                                                 java.lang.String storeName,
                                                 int versionNumber)