public final class PushReplicationEvent<T> extends Object
A generic event representing a partition replica change that should be processed for the purposes of push replication.
There are different types of these events corresponding to starting push replication,
stopping push replication, the various types of partition updates - a newly appended records
batch, an updated HWM, or an updated LSO, and even a FileRecords
transfer that might be
needed to have a follower catch up.
Modifier and Type | Class and Description |
---|---|
static class |
PushReplicationEvent.OffsetPayload
A payload carrying a single offset value.
|
static class |
PushReplicationEvent.RecordsPayload
A payload carrying an
AbstractRecords representing some records already appended on
the partition replica leader, their append offset, and the high watermark value at the time
of creating the records. |
static class |
PushReplicationEvent.TransitionRecordsPayload |
static class |
PushReplicationEvent.Type
Enumerates the different types of push replication events.
|
Modifier and Type | Method and Description |
---|---|
static PushReplicationEvent<PushReplicationEvent.OffsetPayload> |
forHighWatermarkUpdate(org.apache.kafka.common.TopicIdPartition topicIdPartition,
int replicaId,
long updatedHighWatermark)
Creates a new event of type
PushReplicationEvent.Type.HWM_UPDATE with its payload being an
PushReplicationEvent.OffsetPayload containing the updated high watermark. |
static PushReplicationEvent<PushReplicationEvent.OffsetPayload> |
forLogStartOffsetUpdate(org.apache.kafka.common.TopicIdPartition topicIdPartition,
int replicaId,
long updatedLogStartOffset)
Creates a new event of type
PushReplicationEvent.Type.LSO_UPDATE with its payload being an
PushReplicationEvent.OffsetPayload containing the updated log start offset. |
static PushReplicationEvent<PushReplicationEvent.RecordsPayload> |
forRecords(org.apache.kafka.common.TopicIdPartition topicIdPartition,
int replicaId,
org.apache.kafka.common.record.AbstractRecords records,
long appendOffset,
long highWatermark)
Creates a new event of type either
PushReplicationEvent.Type.MEMORY_RECORDS or PushReplicationEvent.Type.FILE_RECORDS
with its payload being a PushReplicationEvent.RecordsPayload containing the given records and offsets. |
static PushReplicationEvent<PushSession> |
forStartPush(org.apache.kafka.common.TopicIdPartition topicIdPartition,
int replicaId,
PushSession pushSession)
Creates a new event of type
PushReplicationEvent.Type.START_PUSH with its payload being the given
PushSession . |
static PushReplicationEvent<CompletableFuture<Void>> |
forStopPush(org.apache.kafka.common.TopicIdPartition topicIdPartition,
int replicaId)
Creates a new event of type
PushReplicationEvent.Type.STOP_PUSH with its payload being an
CompletableFuture containing the future that will be used as the result of
the push replication stop operation. |
static PushReplicationEvent<PushReplicationEvent.TransitionRecordsPayload> |
forTransitionRecords(PushReplicationEvent<PushReplicationEvent.RecordsPayload> fileRecordsEvent,
CompletableFuture<Void> startFuture)
Creates a new event of type
PushReplicationEvent.Type.TRANSITION_RECORDS from a given
PushReplicationEvent.Type.FILE_RECORDS event and a completable future. |
T |
payload()
The payload carried by this push replication event.
|
int |
replicaId() |
org.apache.kafka.common.TopicIdPartition |
topicIdPartition() |
String |
toString() |
PushReplicationEvent.Type |
type()
The type of this push replication event.
|
public static PushReplicationEvent<PushSession> forStartPush(org.apache.kafka.common.TopicIdPartition topicIdPartition, int replicaId, PushSession pushSession)
PushReplicationEvent.Type.START_PUSH
with its payload being the given
PushSession
.public static PushReplicationEvent<PushReplicationEvent.RecordsPayload> forRecords(org.apache.kafka.common.TopicIdPartition topicIdPartition, int replicaId, org.apache.kafka.common.record.AbstractRecords records, long appendOffset, long highWatermark)
PushReplicationEvent.Type.MEMORY_RECORDS
or PushReplicationEvent.Type.FILE_RECORDS
with its payload being a PushReplicationEvent.RecordsPayload
containing the given records and offsets.public static PushReplicationEvent<PushReplicationEvent.TransitionRecordsPayload> forTransitionRecords(PushReplicationEvent<PushReplicationEvent.RecordsPayload> fileRecordsEvent, CompletableFuture<Void> startFuture)
PushReplicationEvent.Type.TRANSITION_RECORDS
from a given
PushReplicationEvent.Type.FILE_RECORDS
event and a completable future. Meant to be used only internally
by pushers to "combine" a PushReplicationEvent.Type.START_PUSH
and the first following
PushReplicationEvent.Type.FILE_RECORDS
event so that they can be processed together (as they are expected
to be).public static PushReplicationEvent<PushReplicationEvent.OffsetPayload> forHighWatermarkUpdate(org.apache.kafka.common.TopicIdPartition topicIdPartition, int replicaId, long updatedHighWatermark)
PushReplicationEvent.Type.HWM_UPDATE
with its payload being an
PushReplicationEvent.OffsetPayload
containing the updated high watermark.public static PushReplicationEvent<PushReplicationEvent.OffsetPayload> forLogStartOffsetUpdate(org.apache.kafka.common.TopicIdPartition topicIdPartition, int replicaId, long updatedLogStartOffset)
PushReplicationEvent.Type.LSO_UPDATE
with its payload being an
PushReplicationEvent.OffsetPayload
containing the updated log start offset.public static PushReplicationEvent<CompletableFuture<Void>> forStopPush(org.apache.kafka.common.TopicIdPartition topicIdPartition, int replicaId)
PushReplicationEvent.Type.STOP_PUSH
with its payload being an
CompletableFuture
containing the future that will be used as the result of
the push replication stop operation.public org.apache.kafka.common.TopicIdPartition topicIdPartition()
public int replicaId()
public T payload()
public PushReplicationEvent.Type type()
PushReplicationEvent.Type