@Internal public class KeySharedSplitAssigner extends Object
SubscriptionType.Key_Shared
subscription.Modifier and Type | Field and Description |
---|---|
protected Set<TopicPartition> |
appendedPartitions |
protected SplitEnumeratorContext<PulsarPartitionSplit> |
context |
protected boolean |
enablePartitionDiscovery |
protected boolean |
initialized |
protected Map<Integer,Set<PulsarPartitionSplit>> |
pendingPartitionSplits |
protected StopCursor |
stopCursor |
Constructor and Description |
---|
KeySharedSplitAssigner(StopCursor stopCursor,
boolean enablePartitionDiscovery,
SplitEnumeratorContext<PulsarPartitionSplit> context,
PulsarSourceEnumState enumState) |
Modifier and Type | Method and Description |
---|---|
void |
addSplitsBack(List<PulsarPartitionSplit> splits,
int subtaskId)
Add a split back to the split assigner if the reader fails.
|
protected void |
addSplitToPendingList(int readerId,
PulsarPartitionSplit split)
Add split to pending lists.
|
Optional<SplitsAssignment<PulsarPartitionSplit>> |
createAssignment(List<Integer> readers)
Create a split assignment from the current readers.
|
boolean |
noMoreSplits(Integer reader)
It would return true only if periodically partition discovery is turned off, the initializing
partition discovery has finished, AND there are no pending splits for assignment.
|
protected int |
partitionOwner(TopicPartition partition)
Returns the index of the target subtask that a specific partition should be assigned to.
|
List<TopicPartition> |
registerTopicPartitions(Set<TopicPartition> fetchedPartitions)
Add the current available partitions into assigner.
|
PulsarSourceEnumState |
snapshotState()
Snapshot the current assign state into checkpoint.
|
protected final StopCursor stopCursor
protected final boolean enablePartitionDiscovery
protected final SplitEnumeratorContext<PulsarPartitionSplit> context
protected final Set<TopicPartition> appendedPartitions
protected final Map<Integer,Set<PulsarPartitionSplit>> pendingPartitionSplits
protected boolean initialized
public KeySharedSplitAssigner(StopCursor stopCursor, boolean enablePartitionDiscovery, SplitEnumeratorContext<PulsarPartitionSplit> context, PulsarSourceEnumState enumState)
public List<TopicPartition> registerTopicPartitions(Set<TopicPartition> fetchedPartitions)
SplitAssigner
fetchedPartitions
- The available partitions queried from Pulsar broker.public void addSplitsBack(List<PulsarPartitionSplit> splits, int subtaskId)
SplitAssigner
public Optional<SplitsAssignment<PulsarPartitionSplit>> createAssignment(List<Integer> readers)
SplitAssigner
createAssignment
in interface SplitAssigner
public boolean noMoreSplits(Integer reader)
SplitAssigner
noMoreSplits
in interface SplitAssigner
public PulsarSourceEnumState snapshotState()
SplitAssigner
snapshotState
in interface SplitAssigner
protected void addSplitToPendingList(int readerId, PulsarPartitionSplit split)
protected int partitionOwner(TopicPartition partition)
KafkaSourceEnumerator.getSplitOwner()
The resulting distribution of partition has the following contract:
partition
- The Pulsar partition to assign.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.