public interface Pusher
Modifier and Type | Method and Description |
---|---|
void |
onHighWatermarkUpdate(org.apache.kafka.common.TopicIdPartition partition,
int destinationBrokerId,
long highWatermark)
Should be called whenever the high watermark for a push-replicated partition replica is
updated.
|
void |
onLeaderAppend(org.apache.kafka.common.TopicIdPartition partition,
int destinationBrokerId,
long highWatermark,
long appendOffset,
org.apache.kafka.common.record.AbstractRecords records)
Buffers the given records to be replicated with some subsequent AppendRecords request.
|
void |
onLogStartOffsetUpdate(org.apache.kafka.common.TopicIdPartition topicPartition,
int destinationBrokerId,
long logStartOffset)
Should be called whenever the log start offset for a push-replicated partition replica is
updated.
|
void |
shutdown()
Shuts this pusher down, terminating all its push replication processing.
|
void |
start()
Starts the pusher thread.
|
CompletableFuture<Void> |
startPush(org.apache.kafka.common.TopicIdPartition partition,
int destinationBrokerId,
PushSession pushSession)
Adds this partition replica with its push replication session metadata to the set
of partitions for which this pusher will be sending AppendRecords requests.
|
CompletableFuture<Void> |
stopPush(org.apache.kafka.common.TopicIdPartition partition,
int destinationBrokerId,
boolean sendEndSessionRequest)
Stops the push replication session for the given partition, optionally preparing an
AppendRecords request signaling the stoppage.
|
CompletableFuture<Void> startPush(org.apache.kafka.common.TopicIdPartition partition, int destinationBrokerId, PushSession pushSession)
Adds this partition replica with its push replication session metadata to the set of partitions for which this pusher will be sending AppendRecords requests. Calling this would set up an initial AppendRecords request for this partition if/when the transitional records for the session are received, and will register a handler for any results of the initial as well as any subsequent AppendRecords requests within this replication session for the partition replica.
Thread-safe, must be called before any subsequent onLeaderAppend(org.apache.kafka.common.TopicIdPartition, int, long, long, org.apache.kafka.common.record.AbstractRecords)
,
onHighWatermarkUpdate(org.apache.kafka.common.TopicIdPartition, int, long)
, or onLogStartOffsetUpdate(org.apache.kafka.common.TopicIdPartition, int, long)
calls for this partition
replica.
void onLeaderAppend(org.apache.kafka.common.TopicIdPartition partition, int destinationBrokerId, long highWatermark, long appendOffset, org.apache.kafka.common.record.AbstractRecords records)
Buffers the given records to be replicated with some subsequent AppendRecords request.
Thread-safe, must be called after startPush(org.apache.kafka.common.TopicIdPartition, int, io.confluent.kafka.replication.push.PushSession)
and before stopPush(org.apache.kafka.common.TopicIdPartition, int, boolean)
have
been called for a particular replication session for this partition replica, maintaining the
in-partition record append order.
void onHighWatermarkUpdate(org.apache.kafka.common.TopicIdPartition partition, int destinationBrokerId, long highWatermark)
Should be called whenever the high watermark for a push-replicated partition replica is updated.
Thread-safe, must be called after startPush(org.apache.kafka.common.TopicIdPartition, int, io.confluent.kafka.replication.push.PushSession)
and before stopPush(org.apache.kafka.common.TopicIdPartition, int, boolean)
have
been called for a particular replication session for this partition replica, maintaining the
in-partition HWM update order.
void onLogStartOffsetUpdate(org.apache.kafka.common.TopicIdPartition topicPartition, int destinationBrokerId, long logStartOffset)
Should be called whenever the log start offset for a push-replicated partition replica is updated.
Thread-safe, must be called after startPush(org.apache.kafka.common.TopicIdPartition, int, io.confluent.kafka.replication.push.PushSession)
and before stopPush(org.apache.kafka.common.TopicIdPartition, int, boolean)
have
been called for a particular replication session for this partition replica, maintaining the
in-partition LSO update order.
CompletableFuture<Void> stopPush(org.apache.kafka.common.TopicIdPartition partition, int destinationBrokerId, boolean sendEndSessionRequest)
Stops the push replication session for the given partition, optionally preparing an AppendRecords request signaling the stoppage. Subsequent partition update events won't be transformed into AppendRecords requests until a new push replication session has been started, and any buffered state related to the stopped session will be cleared.
Thread-safe, this can be called even without a preceding startPush(org.apache.kafka.common.TopicIdPartition, int, io.confluent.kafka.replication.push.PushSession)
and can be
called multiple times in succession. If requested so (via the sendEndSessionRequest
flag) this will still prepare an AppendRecords request signaling the stoppage.
partition
- The partition for which a push replication session is being stopped.destinationBrokerId
- The broker ID of the replica for the stopped session.sendEndSessionRequest
- Indicates whether the replicas should be explicitly notified in
subsequent AppendRecords requests.sendEndSessionRequest
is false
) or when the final AppendRecords
request containing the stoppage signal has been prepared and is waiting to be sent
and any buffered state related to the stopped session has been cleared (if
sendEndSessionRequest
is true
).void start()
void shutdown()
Shuts this pusher down, terminating all its push replication processing. Once shut down
a pusher can no longer be used - any subsequent calls to startPush(org.apache.kafka.common.TopicIdPartition, int, io.confluent.kafka.replication.push.PushSession)
,
onLeaderAppend(org.apache.kafka.common.TopicIdPartition, int, long, long, org.apache.kafka.common.record.AbstractRecords)
/onHighWatermarkUpdate(org.apache.kafka.common.TopicIdPartition, int, long)
/onLogStartOffsetUpdate(org.apache.kafka.common.TopicIdPartition, int, long)
would
throw and any subsequent calls to stopPush(org.apache.kafka.common.TopicIdPartition, int, boolean)
won't have any effect.