Class FixedPartitionDistributor

java.lang.Object
io.camunda.zeebe.broker.partitioning.distribution.FixedPartitionDistributor
All Implemented Interfaces:
PartitionDistributor

public final class FixedPartitionDistributor extends Object implements PartitionDistributor
A PartitionDistributor implementation which takes in a provided, fixed mapping which already describes which member maps to which partitions, and returns the appropriate set of distributed partitions on demand.

See FixedPartitionDistributorBuilder to build a new instance. The class is intentionally not publicly instantiable to reduce the risk of configuration errors.

  • Method Details

    • distributePartitions

      public Set<PartitionMetadata> distributePartitions(Set<MemberId> clusterMembers, List<PartitionId> sortedPartitionIds, int replicationFactor)
      Generates a partition distribution based on the initial configuration, using the input here mostly for validation.
      Specified by:
      distributePartitions in interface PartitionDistributor
      Parameters:
      clusterMembers - the set of members that can own partitions
      sortedPartitionIds - a sorted list of partition IDs
      replicationFactor - the replication factor for each partition
      Returns:
      a set of distributed partitions, containing the set of members to which they belong to
      Throws:
      IllegalStateException - if any of the configured members are not found in the set of clusterMembers; this implies that these members do not exist in the cluster
      IllegalStateException - if at least one of the partitions in sortedPartitionIds is not distributed over any members
      IllegalStateException - if at least one of the partitions in sortedPartitionIds does not have exactly replicationFactor members