Package com.linkedin.venice.partitioner
Class DefaultVenicePartitioner
java.lang.Object
com.linkedin.venice.partitioner.VenicePartitioner
com.linkedin.venice.partitioner.DefaultVenicePartitioner
Default implementation of the
VenicePartitioner class.
It uses a hashing algorithm (MD5 by default) to determine the appropriate partition
for each message.-
Nested Class Summary
Nested classes/interfaces inherited from class com.linkedin.venice.partitioner.VenicePartitioner
VenicePartitioner.VenicePartitionerType -
Field Summary
FieldsFields inherited from class com.linkedin.venice.partitioner.VenicePartitioner
props -
Constructor Summary
ConstructorsConstructorDescriptionDefaultVenicePartitioner(VeniceProperties props, org.apache.avro.Schema schema) -
Method Summary
Modifier and TypeMethodDescriptionintgetPartitionId(byte[] keyBytes, int numPartitions) A function that returns the partitionId based on the key and partition count.intgetPartitionId(byte[] keyBytes, int offset, int length, int numPartitions) Implementors of this class can optionally provide an implementation of this function, which would result in eliminating an instantiation ofByteBufferin the case where the provided offset and length do not map to the boundaries of the byte[].intgetPartitionId(ByteBuffer keyByteBuffer, int numPartitions) Methods inherited from class com.linkedin.venice.partitioner.VenicePartitioner
checkSchema, getPartitionerType
-
Field Details
-
MD5_HASH_ALGORITHM
- See Also:
-
-
Constructor Details
-
DefaultVenicePartitioner
public DefaultVenicePartitioner() -
DefaultVenicePartitioner
-
DefaultVenicePartitioner
-
-
Method Details
-
getPartitionId
public int getPartitionId(byte[] keyBytes, int offset, int length, int numPartitions) Description copied from class:VenicePartitionerImplementors of this class can optionally provide an implementation of this function, which would result in eliminating an instantiation ofByteBufferin the case where the provided offset and length do not map to the boundaries of the byte[]. This is just a minor optimization.- Overrides:
getPartitionIdin classVenicePartitioner
-
getPartitionId
public int getPartitionId(byte[] keyBytes, int numPartitions) Description copied from class:VenicePartitionerA function that returns the partitionId based on the key and partition count.- Specified by:
getPartitionIdin classVenicePartitioner- Parameters:
keyBytes- - A key that will be mapped into a partitionnumPartitions- - The number of total partitions available in Kafka/storage- Returns:
-
getPartitionId
- Specified by:
getPartitionIdin classVenicePartitioner
-