Class TransportReplicationAction.ReplicasProxy
java.lang.Object
org.elasticsearch.action.support.replication.TransportReplicationAction.ReplicasProxy
- All Implemented Interfaces:
ReplicationOperation.Replicas<ReplicaRequest>
- Enclosing class:
- TransportReplicationAction<Request extends ReplicationRequest<Request>,ReplicaRequest extends ReplicationRequest<ReplicaRequest>,Response extends ReplicationResponse>
protected class TransportReplicationAction.ReplicasProxy
extends Object
implements ReplicationOperation.Replicas<ReplicaRequest>
The
ReplicasProxy
is an implementation of the Replicas
interface that performs the actual ReplicaRequest
on the replica
shards. It also encapsulates the logic required for failing the replica
if deemed necessary as well as marking it as stale when needed.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.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.void
performOn(ShardRouting replica, ReplicaRequest request, long primaryTerm, long globalCheckpoint, long maxSeqNoOfUpdatesOrDeletes, ActionListener<ReplicationOperation.ReplicaResponse> listener)
Performs the specified request on the specified replica.
-
Constructor Details
-
ReplicasProxy
protected ReplicasProxy()
-
-
Method Details
-
performOn
public void performOn(ShardRouting replica, ReplicaRequest request, long primaryTerm, long globalCheckpoint, long maxSeqNoOfUpdatesOrDeletes, ActionListener<ReplicationOperation.ReplicaResponse> listener)Description copied from interface:ReplicationOperation.Replicas
Performs the specified request on the specified replica.- Specified by:
performOn
in interfaceReplicationOperation.Replicas<ReplicaRequest extends ReplicationRequest<ReplicaRequest>>
- Parameters:
replica
- the shard this request should be executed onrequest
- 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
public void failShardIfNeeded(ShardRouting replica, long primaryTerm, String message, Exception exception, ActionListener<Void> listener)Description copied from interface:ReplicationOperation.Replicas
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.- Specified by:
failShardIfNeeded
in interfaceReplicationOperation.Replicas<ReplicaRequest extends ReplicationRequest<ReplicaRequest>>
- 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
public void markShardCopyAsStaleIfNeeded(ShardId shardId, String allocationId, long primaryTerm, ActionListener<Void> listener)Description copied from interface:ReplicationOperation.Replicas
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.- Specified by:
markShardCopyAsStaleIfNeeded
in interfaceReplicationOperation.Replicas<ReplicaRequest extends ReplicationRequest<ReplicaRequest>>
- 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
-