Versions Compared

Key

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

...

So in some sense, the UniformStickyPartitioner is neither uniform nor sufficiently sticky.

Public Interfaces

There is one new method exposed on the partitioner interface.  The new method takes an additional callback that can be used to calculate an accurate record size in bytes.

Code Block
languagejava
   /**
     * Compute the partition for the given record.
     *
     * @param topic The topic name
     * @param key The key to partition on (or null if no key)
     * @param keyBytes The serialized key to partition on( or null if no key)
     * @param value The value to partition on or null
     * @param valueBytes The serialized value to partition on or null
     * @param getRecordSizeCallback The callback that could be used to calculate record size for a partition
     * @param cluster The current cluster metadata
     */
    default int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes,
                          Function<Integer, Integer> getRecordSizeCallback, Cluster cluster) {
        return partition(topic, key, keyBytes, value, valueBytes, cluster);
    }

A new producer config setting would be added: partitioner.sticky.batch.size.  The default would be 0, in which case the batch.size would be used (we can change the default to batch.max.size once KIP-782 is implemented).

...