Class TransportWriteAction<Request extends ReplicatedWriteRequest<Request>,ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>
java.lang.Object
org.elasticsearch.action.support.TransportAction<Request,Response>
org.elasticsearch.action.support.replication.TransportReplicationAction<Request,ReplicaRequest,Response>
org.elasticsearch.action.support.replication.TransportWriteAction<Request,ReplicaRequest,Response>
- Direct Known Subclasses:
RetentionLeaseSyncAction,TransportResyncReplicationAction,TransportShardBulkAction
public abstract class TransportWriteAction<Request extends ReplicatedWriteRequest<Request>,ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>
extends TransportReplicationAction<Request,ReplicaRequest,Response>
Base class for transport actions that modify data in some shard like index, delete, and shardBulk.
Allows performing async actions (e.g. refresh) after performing write operations on primary and replica shards
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTransportWriteAction.WritePrimaryResult<ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>Result of taking the action on the primary.static classTransportWriteAction.WriteReplicaResult<ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>>Result of taking the action on the replica.Nested classes/interfaces inherited from class org.elasticsearch.action.support.replication.TransportReplicationAction
TransportReplicationAction.ConcreteReplicaRequest<R extends TransportRequest>, TransportReplicationAction.ConcreteShardRequest<R extends TransportRequest>, TransportReplicationAction.PrimaryResult<ReplicaRequest extends ReplicationRequest<ReplicaRequest>,Response extends ReplicationResponse>, TransportReplicationAction.ReplicaResponse, TransportReplicationAction.ReplicaResult, TransportReplicationAction.ReplicasProxy, TransportReplicationAction.RetryOnReplicaException -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ExecutorSelectorprotected IndexingPressureprotected SystemIndicesFields inherited from class org.elasticsearch.action.support.replication.TransportReplicationAction
clusterService, executor, forceExecutionOnPrimary, indicesService, REPLICATION_INITIAL_RETRY_BACKOFF_BOUND, REPLICATION_RETRY_TIMEOUT, shardStateAction, threadPool, transportOptions, transportPrimaryAction, transportReplicaAction, transportServiceFields inherited from class org.elasticsearch.action.support.TransportAction
actionName, localConnection, logger, taskManager -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTransportWriteAction(Settings settings, String actionName, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, ActionFilters actionFilters, Writeable.Reader<Request> request, Writeable.Reader<ReplicaRequest> replicaRequest, BiFunction<ExecutorSelector,IndexShard,String> executorFunction, boolean forceExecutionOnPrimary, IndexingPressure indexingPressure, SystemIndices systemIndices) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.elasticsearch.core.ReleasablecheckOperationLimits(Request request)protected org.elasticsearch.core.ReleasablecheckPrimaryLimits(Request request, boolean rerouteWasLocal, boolean localRerouteInitiatedByNodeClient)protected org.elasticsearch.core.ReleasablecheckReplicaLimits(ReplicaRequest request)protected abstract voiddispatchedShardOperationOnPrimary(Request request, IndexShard primary, ActionListener<TransportReplicationAction.PrimaryResult<ReplicaRequest,Response>> listener)protected abstract voiddispatchedShardOperationOnReplica(ReplicaRequest request, IndexShard replica, ActionListener<TransportReplicationAction.ReplicaResult> listener)protected Stringexecutor(IndexShard shard)protected booleanforce(ReplicatedWriteRequest<?> request)protected ClusterBlockLevelCluster level block to check before request execution.Index level block to check before request execution.protected booleanisSystemShard(ShardId shardId)static Translog.LocationlocationToSync(Translog.Location current, Translog.Location next)protected ReplicationOperation.Replicas<ReplicaRequest>protected longprimaryOperationSize(Request request)protected longreplicaOperationSize(ReplicaRequest request)protected voidshardOperationOnPrimary(Request request, IndexShard primary, ActionListener<TransportReplicationAction.PrimaryResult<ReplicaRequest,Response>> listener)Called on the primary with a reference to the primary IndexShard to modify.protected voidshardOperationOnReplica(ReplicaRequest request, IndexShard replica, ActionListener<TransportReplicationAction.ReplicaResult> listener)Called once per replica with a reference to the replica IndexShard to modify.protected static Translog.LocationsyncOperationResultOrThrow(Engine.Result operationResult, Translog.Location currentLocation)Syncs operation result to the translog or throws a shard not available failureMethods inherited from class org.elasticsearch.action.support.replication.TransportReplicationAction
acquirePrimaryOperationPermit, acquireReplicaOperationPermit, adaptResponse, doExecute, handlePrimaryRequest, handleReplicaRequest, newResponseInstance, resolveRequest, retryPrimaryException, transportOptionsMethods inherited from class org.elasticsearch.action.support.TransportAction
execute, execute, execute
-
Field Details
-
indexingPressure
-
systemIndices
-
executorSelector
-
-
Constructor Details
-
TransportWriteAction
protected TransportWriteAction(Settings settings, String actionName, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, ActionFilters actionFilters, Writeable.Reader<Request> request, Writeable.Reader<ReplicaRequest> replicaRequest, BiFunction<ExecutorSelector,IndexShard,String> executorFunction, boolean forceExecutionOnPrimary, IndexingPressure indexingPressure, SystemIndices systemIndices)
-
-
Method Details
-
executor
-
checkOperationLimits
- Overrides:
checkOperationLimitsin classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>
-
force
-
isSystemShard
-
checkPrimaryLimits
protected org.elasticsearch.core.Releasable checkPrimaryLimits(Request request, boolean rerouteWasLocal, boolean localRerouteInitiatedByNodeClient)- Overrides:
checkPrimaryLimitsin classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>
-
-
checkReplicaLimits
- Overrides:
checkReplicaLimitsin classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>
-
replicaOperationSize
-
syncOperationResultOrThrow
protected static Translog.Location syncOperationResultOrThrow(Engine.Result operationResult, Translog.Location currentLocation) throws ExceptionSyncs operation result to the translog or throws a shard not available failure- Throws:
Exception
-
locationToSync
-
newReplicasProxy
- Overrides:
newReplicasProxyin classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>
-
shardOperationOnPrimary
protected void shardOperationOnPrimary(Request request, IndexShard primary, ActionListener<TransportReplicationAction.PrimaryResult<ReplicaRequest,Response>> listener)Called on the primary with a reference to the primary IndexShard to modify.- Specified by:
shardOperationOnPrimaryin classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>- Parameters:
listener- listener for the result of the operation on primary, including current translog location and operation response and failure async refresh is performed on theprimaryshard according to theRequestrefresh policyrequest- the request to the primary shardprimary- the primary shard to perform the operation on
-
dispatchedShardOperationOnPrimary
protected abstract void dispatchedShardOperationOnPrimary(Request request, IndexShard primary, ActionListener<TransportReplicationAction.PrimaryResult<ReplicaRequest,Response>> listener) -
shardOperationOnReplica
protected void shardOperationOnReplica(ReplicaRequest request, IndexShard replica, ActionListener<TransportReplicationAction.ReplicaResult> listener)Called once per replica with a reference to the replica IndexShard to modify.- Specified by:
shardOperationOnReplicain classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>- Parameters:
listener- listener for the result of the operation on replica, including current translog location and operation response and failure async refresh is performed on thereplicashard according to theReplicaRequestrefresh policyrequest- the request to the replica shardreplica- the replica shard to perform the operation on
-
dispatchedShardOperationOnReplica
protected abstract void dispatchedShardOperationOnReplica(ReplicaRequest request, IndexShard replica, ActionListener<TransportReplicationAction.ReplicaResult> listener) -
globalBlockLevel
Description copied from class:TransportReplicationActionCluster level block to check before request execution. Returning null means that no blocks need to be checked.- Overrides:
globalBlockLevelin classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>
-
indexBlockLevel
Description copied from class:TransportReplicationActionIndex level block to check before request execution. Returning null means that no blocks need to be checked.- Overrides:
indexBlockLevelin classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>
-