Class ReplicationStateMetadata
java.lang.Object
io.confluent.kafka.replication.push.ReplicationStateMetadata
- All Implemented Interfaces:
ReplicationState
Manages replication mode transitions for push replication.
A Follower partition can be in either PULL or PUSH mode.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.confluent.kafka.replication.push.ReplicationState
ReplicationState.Mode -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe final replication session ID.static final ReplicationStateMetadatastatic final longThe initial replication session ID.static final longAn invalid replication session ID. -
Constructor Summary
ConstructorsConstructorDescriptionReplicationStateMetadata(ReplicationState.Mode replicationMode, long replicationSessionId) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanTransitionTo(ReplicationState.Mode next, long proposedSessionId) Follower replication mode transition proposal requires the proposed session ID to be incremented when the leader requests a transition back to PULL.booleaninthashCode()mode()The replication mode of this partition replica.longnextId(ReplicationState.Mode nextMode) longThe current replication session ID for this partition replica.static booleanreplicationSessionIdSupportsPushTransition(long replicationSessionId) toString()
-
Field Details
-
UNKNOWN_REPLICATION_SESSION_ID
public static final long UNKNOWN_REPLICATION_SESSION_IDAn invalid replication session ID. Used by followers in pull replication mode that do not support a transition to push replication mode. Also used to initialize the replication session ID on the leader before any fetches are received.- See Also:
-
INITIAL_REPLICATION_SESSION_ID
public static final long INITIAL_REPLICATION_SESSION_IDThe initial replication session ID. Used when initializing replicas on the follower.- See Also:
-
FINAL_REPLICATION_SESSION_ID
public static final long FINAL_REPLICATION_SESSION_IDThe final replication session ID. Used when push transition is disabled, in which case the replica fetch requests will be built with this replication session ID. This also means a partition with the final replication ID (which should never happen in practice) will not be able to transition to push.- See Also:
-
INITIAL
-
-
Constructor Details
-
ReplicationStateMetadata
-
-
Method Details
-
replicationSessionIdSupportsPushTransition
public static boolean replicationSessionIdSupportsPushTransition(long replicationSessionId) -
mode
Description copied from interface:ReplicationStateThe replication mode of this partition replica.- Specified by:
modein interfaceReplicationState
-
replicationSessionId
public long replicationSessionId()Description copied from interface:ReplicationStateThe current replication session ID for this partition replica. Used for coordinating transitions between pull and push replication mode by the leader and the follower.
The replication session ID is included in both the Fetch (pull replication) protocol and the AppendRecords (push replication) protocol. It's incremented on the follower whenever the leader requests a transition back to
ReplicationState.Mode.PULL.- Specified by:
replicationSessionIdin interfaceReplicationState
-
canTransitionTo
Follower replication mode transition proposal requires the proposed session ID to be incremented when the leader requests a transition back to PULL. Replication mode transitions also require the current replication mode to be a valid previous state.- Parameters:
next- proposed replication modeproposedSessionId- proposed session ID- Returns:
trueif the follower state can be transitioned to the proposed replication mode with the proposed session ID,falseotherwise
-
nextId
-
hashCode
-
equals
-
toString
-