Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A topic hash represents topic id, name, number of partitions, and partition racks. To avoid useless rebalance, the hash function should return same value for same data, even if it runs on different JDKs or partition racks have different order. For different JDKs, the KIP will use Murmur3 to compute the hash value. For partition racks with different order, we will compute hash for each value in it and sum as a result. We will also set the first byte as magic byte to represent hash version. The Murmur3 uses bit operation to ensure avalanche effect. A single bit change can get a different hash value.

...

languagejava
linenumberstrue

...

The hash function should follow the order to combine different fields:

  • magic byte (byte)
  • topic id (long)
  • topic name (string)
  • partition size (long)
  • sorted partition by id
    • partition id (int)
    • sorted racks (string)

SubscribedTopicDescriberImpl

...