public class GlobalCheckpointTracker extends AbstractIndexShardComponent
The global checkpoint is maintained by the primary shard and is replicated to all the replicas (via GlobalCheckpointSyncAction
).
Modifier and Type | Class and Description |
---|---|
static class |
GlobalCheckpointTracker.CheckpointState |
static class |
GlobalCheckpointTracker.PrimaryContext
Represents the sequence number component of the primary context.
|
deprecationLogger, indexSettings, logger, shardId
Modifier and Type | Method and Description |
---|---|
void |
abortRelocationHandoff()
Fails a relocation handoff attempt.
|
void |
activatePrimaryMode(long localCheckpoint)
Initializes the global checkpoint tracker in primary mode (see
primaryMode . |
void |
activateWithPrimaryContext(GlobalCheckpointTracker.PrimaryContext primaryContext)
Activates the global checkpoint tracker in primary mode (see
primaryMode . |
void |
completeRelocationHandoff()
Marks a relocation handoff attempt as successful.
|
long |
getGlobalCheckpoint()
Returns the global checkpoint for the shard.
|
ReplicationGroup |
getReplicationGroup()
Returns the current replication group for the shard.
|
GlobalCheckpointTracker.CheckpointState |
getTrackedLocalCheckpointForShard(java.lang.String allocationId)
Returns the local checkpoint information tracked for a specific shard.
|
void |
initiateTracking(java.lang.String allocationId)
Called when the recovery process for a shard is ready to open the engine on the target shard.
|
void |
markAllocationIdAsInSync(java.lang.String allocationId,
long localCheckpoint)
Marks the shard with the provided allocation ID as in-sync with the primary shard.
|
boolean |
pendingInSync()
Whether the are shards blocking global checkpoint advancement.
|
GlobalCheckpointTracker.PrimaryContext |
startRelocationHandoff()
Initiates a relocation handoff and returns the corresponding primary context.
|
void |
updateFromMaster(long applyingClusterStateVersion,
java.util.Set<java.lang.String> inSyncAllocationIds,
IndexShardRoutingTable routingTable,
java.util.Set<java.lang.String> pre60AllocationIds)
Notifies the tracker of the current allocation IDs in the cluster state.
|
void |
updateGlobalCheckpointForShard(java.lang.String allocationId,
long globalCheckpoint)
Update the local knowledge of the global checkpoint for the specified allocation ID.
|
void |
updateGlobalCheckpointOnReplica(long globalCheckpoint,
java.lang.String reason)
Updates the global checkpoint on a replica shard after it has been updated by the primary.
|
void |
updateLocalCheckpoint(java.lang.String allocationId,
long localCheckpoint)
Notifies the service to update the local checkpoint for the shard with the provided allocation ID.
|
indexSettings, nodeName, shardId
public ReplicationGroup getReplicationGroup()
public long getGlobalCheckpoint()
public void updateGlobalCheckpointOnReplica(long globalCheckpoint, java.lang.String reason)
globalCheckpoint
- the global checkpointreason
- the reason the global checkpoint was updatedpublic void updateGlobalCheckpointForShard(java.lang.String allocationId, long globalCheckpoint)
allocationId
- the allocation ID to update the global checkpoint forglobalCheckpoint
- the global checkpointpublic void activatePrimaryMode(long localCheckpoint)
primaryMode
. Called on primary activation or promotion.public void updateFromMaster(long applyingClusterStateVersion, java.util.Set<java.lang.String> inSyncAllocationIds, IndexShardRoutingTable routingTable, java.util.Set<java.lang.String> pre60AllocationIds)
applyingClusterStateVersion
- the cluster state version being applied when updating the allocation IDs from the masterinSyncAllocationIds
- the allocation IDs of the currently in-sync shard copiesroutingTable
- the shard routing tablepre60AllocationIds
- the allocation IDs of shards that are allocated to pre-6.0 nodespublic void initiateTracking(java.lang.String allocationId)
allocationId
- the allocation ID of the shard for which recovery was initiatedpublic void markAllocationIdAsInSync(java.lang.String allocationId, long localCheckpoint) throws java.lang.InterruptedException
allocationId
- the allocation ID of the shard to mark as in-synclocalCheckpoint
- the current local checkpoint on the shardjava.lang.InterruptedException
public void updateLocalCheckpoint(java.lang.String allocationId, long localCheckpoint)
allocationId
- the allocation ID of the shard to update the local checkpoint forlocalCheckpoint
- the local checkpoint for the shardpublic GlobalCheckpointTracker.PrimaryContext startRelocationHandoff()
public void abortRelocationHandoff()
public void completeRelocationHandoff()
public void activateWithPrimaryContext(GlobalCheckpointTracker.PrimaryContext primaryContext)
primaryMode
. Called on primary relocation target during
primary relocation handoff.primaryContext
- the primary context used to initialize the statepublic boolean pendingInSync()
public GlobalCheckpointTracker.CheckpointState getTrackedLocalCheckpointForShard(java.lang.String allocationId)