Module org.elasticsearch.server
Class ReplicationOperation<Request extends ReplicationRequest<Request>,ReplicaRequest extends ReplicationRequest<ReplicaRequest>,PrimaryResultT extends ReplicationOperation.PrimaryResult<ReplicaRequest>>
java.lang.Object
org.elasticsearch.action.support.replication.ReplicationOperation<Request,ReplicaRequest,PrimaryResultT>
public class ReplicationOperation<Request extends ReplicationRequest<Request>,ReplicaRequest extends ReplicationRequest<ReplicaRequest>,PrimaryResultT extends ReplicationOperation.PrimaryResult<ReplicaRequest>>
extends Object
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceReplicationOperation.Primary<RequestT extends ReplicationRequest<RequestT>,ReplicaRequestT extends ReplicationRequest<ReplicaRequestT>, PrimaryResultT extends ReplicationOperation.PrimaryResult<ReplicaRequestT>> An encapsulation of an operation that is to be performed on the primary shardstatic interfacestatic interfaceAn interface to encapsulate the metadata needed from replica shards when they respond to operations performed on them.static interfaceAn encapsulation of an operation that will be executed on the replica shards, if present.static final class -
Constructor Summary
ConstructorsConstructorDescriptionReplicationOperation(Request request, ReplicationOperation.Primary<Request, ReplicaRequest, PrimaryResultT> primary, ActionListener<PrimaryResultT> listener, ReplicationOperation.Replicas<ReplicaRequest> replicas, org.apache.logging.log4j.Logger logger, ThreadPool threadPool, String opType, long primaryTerm, TimeValue initialRetryBackoffBound, TimeValue retryTimeout) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringChecks whether we can perform a write based on the required active shard count setting.voidexecute()The execution is based on aRefCountingListenerthat encapsulates the pending sub-operations in this operation.
-
Constructor Details
-
ReplicationOperation
public ReplicationOperation(Request request, ReplicationOperation.Primary<Request, ReplicaRequest, PrimaryResultT> primary, ActionListener<PrimaryResultT> listener, ReplicationOperation.Replicas<ReplicaRequest> replicas, org.apache.logging.log4j.Logger logger, ThreadPool threadPool, String opType, long primaryTerm, TimeValue initialRetryBackoffBound, TimeValue retryTimeout)
-
-
Method Details
-
execute
The execution is based on aRefCountingListenerthat encapsulates the pending sub-operations in this operation. A new listener is acquired when the following sub-operations start and triggered when they complete:- The operation on the primary
- The operation on each replica
- Coordination of the operation as a whole. This prevents the operation from terminating early if we haven't started any replica operations and the primary finishes.
- Throws:
Exception
-
checkActiveShardCount
Checks whether we can perform a write based on the required active shard count setting. Returns **null* if OK to proceed, or a string describing the reason to stop
-