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.-
Field Summary
Fields inherited from class com.linkedin.venice.partitioner.VenicePartitioner
props
-
Constructor Summary
ConstructorDescriptionDefaultVenicePartitioner
(VeniceProperties props, org.apache.avro.Schema schema) -
Method Summary
Modifier and TypeMethodDescriptionint
getPartitionId
(byte[] keyBytes, int numPartitions) A function that returns the partitionId based on the key and partition count.int
getPartitionId
(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 ofByteBuffer
in the case where the provided offset and length do not map to the boundaries of the byte[].int
getPartitionId
(ByteBuffer keyByteBuffer, int numPartitions) Methods inherited from class com.linkedin.venice.partitioner.VenicePartitioner
checkSchema
-
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:VenicePartitioner
Implementors of this class can optionally provide an implementation of this function, which would result in eliminating an instantiation ofByteBuffer
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 classVenicePartitioner
-
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 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:
getPartitionId
in classVenicePartitioner
-