Module org.elasticsearch.server
Interface ReplicationOperation.Replicas<RequestT extends ReplicationRequest<RequestT>>
- All Known Implementing Classes:
TransportReplicationAction.ReplicasProxy,TransportShardRefreshAction.UnpromotableReplicasRefreshProxy
- Enclosing class:
ReplicationOperation<Request extends ReplicationRequest<Request>,ReplicaRequest extends ReplicationRequest<ReplicaRequest>, PrimaryResultT extends ReplicationOperation.PrimaryResult<ReplicaRequest>>
public static interface ReplicationOperation.Replicas<RequestT extends ReplicationRequest<RequestT>>
An encapsulation of an operation that will be executed on the replica shards, if present.
-
Method Summary
Modifier and TypeMethodDescriptionvoidfailShardIfNeeded(ShardRouting replica, long primaryTerm, String message, Exception exception, ActionListener<Void> listener) Fail the specified shard if needed, removing it from the current set of active shards.voidmarkShardCopyAsStaleIfNeeded(ShardId shardId, String allocationId, long primaryTerm, ActionListener<Void> listener) Marks shard copy as stale if needed, removing its allocation id from the set of in-sync allocation ids.default voidonPrimaryOperationComplete(RequestT replicaRequest, IndexShardRoutingTable indexShardRoutingTable, ActionListener<Void> listener) Optional custom logic to execute when the primary operation is complete, before sending the replica requests.voidperformOn(ShardRouting replica, RequestT replicaRequest, long primaryTerm, long globalCheckpoint, long maxSeqNoOfUpdatesOrDeletes, ActionListener<ReplicationOperation.ReplicaResponse> listener) Performs the specified request on the specified replica.
-
Method Details
-
performOn
void performOn(ShardRouting replica, RequestT replicaRequest, long primaryTerm, long globalCheckpoint, long maxSeqNoOfUpdatesOrDeletes, ActionListener<ReplicationOperation.ReplicaResponse> listener) Performs the specified request on the specified replica.- Parameters:
replica- the shard this request should be executed onreplicaRequest- the operation to performprimaryTerm- the primary termglobalCheckpoint- the global checkpoint on the primarymaxSeqNoOfUpdatesOrDeletes- the max seq_no of updates (index operations overwriting Lucene) or deletes on primary after this replication was executed on it.listener- callback for handling the response or failure
-
failShardIfNeeded
void failShardIfNeeded(ShardRouting replica, long primaryTerm, String message, Exception exception, ActionListener<Void> listener) Fail the specified shard if needed, removing it from the current set of active shards. Whether a failure is needed is left up to the implementation.- Parameters:
replica- shard to failprimaryTerm- the primary termmessage- a (short) description of the reasonexception- the original exception which caused the ReplicationOperation to request the shard to be failedlistener- a listener that will be notified when the failing shard has been removed from the in-sync set
-
markShardCopyAsStaleIfNeeded
void markShardCopyAsStaleIfNeeded(ShardId shardId, String allocationId, long primaryTerm, ActionListener<Void> listener) Marks shard copy as stale if needed, removing its allocation id from the set of in-sync allocation ids. Whether marking as stale is needed is left up to the implementation.- Parameters:
shardId- shard idallocationId- allocation id to remove from the set of in-sync allocation idsprimaryTerm- the primary termlistener- a listener that will be notified when the failing shard has been removed from the in-sync set
-
onPrimaryOperationComplete
default void onPrimaryOperationComplete(RequestT replicaRequest, IndexShardRoutingTable indexShardRoutingTable, ActionListener<Void> listener) Optional custom logic to execute when the primary operation is complete, before sending the replica requests.- Parameters:
replicaRequest- the operation that will be performed on replicasindexShardRoutingTable- the replication's group index shard routing tablelistener- callback for handling the response or failure
-