Class DefaultVenicePartitioner

java.lang.Object
com.linkedin.venice.partitioner.VenicePartitioner
com.linkedin.venice.partitioner.DefaultVenicePartitioner

public class DefaultVenicePartitioner extends VenicePartitioner
Default implementation of the VenicePartitioner class. It uses a hashing algorithm (MD5 by default) to determine the appropriate partition for each message.
  • Field Details

  • Constructor Details

    • DefaultVenicePartitioner

      public DefaultVenicePartitioner()
    • DefaultVenicePartitioner

      public DefaultVenicePartitioner(VeniceProperties props)
    • DefaultVenicePartitioner

      public DefaultVenicePartitioner(VeniceProperties props, org.apache.avro.Schema schema)
  • Method Details

    • getPartitionId

      public int getPartitionId(byte[] keyBytes, int offset, int length, int numPartitions)
      Description copied from class: VenicePartitioner
      Implementors of this class can optionally provide an implementation of this function, which would result in eliminating an instantiation of ByteBuffer in the case where the provided offset and length do not map to the boundaries of the byte[]. This is just a minor optimization.
      Overrides:
      getPartitionId in class VenicePartitioner
    • getPartitionId

      public int getPartitionId(byte[] keyBytes, int numPartitions)
      Description copied from class: VenicePartitioner
      A function that returns the partitionId based on the key and partition count.
      Specified by:
      getPartitionId in class VenicePartitioner
      Parameters:
      keyBytes - - A key that will be mapped into a partition
      numPartitions - - The number of total partitions available in Kafka/storage
      Returns:
    • getPartitionId

      public int getPartitionId(ByteBuffer keyByteBuffer, int numPartitions)
      Specified by:
      getPartitionId in class VenicePartitioner