Hrw

Highest random weight (rendezvous) assignment of partitions to nodes: owner(p) = argmax weight(node, p). Every node computes the same assignment from the same member list without a leader, and a change of members moves only the partitions the joining node wins or the leaving node held, about P/N of them.

The weight is part of the cluster protocol, so nodes of adjacent versions agree: the 64-bit FNV-1a hash the log partitions by (Partitioner.hash) of node/partition, finished with MurmurHash3's 64-bit mixer so that keys differing only in their last characters still spread over all bits. Weights compare as unsigned numbers; a tie goes to the smaller node id.

Functions

Link copied to clipboard
fun assignment(nodes: Collection<String>, partitions: Int): Map<Int, String>

The owner of every partition among partitions when nodes are the members.

Link copied to clipboard
fun owner(partition: Int, nodes: Collection<String>): String?

The owner of partition among nodes, or null when there is none.

Link copied to clipboard
fun partitionsOf(node: String, nodes: Collection<String>, partitions: Int): Set<Int>

The partitions among partitions that node owns when nodes are the members.

Link copied to clipboard
fun weight(node: String, partition: Int): Long

The weight of node for partition.