Class TransportWriteAction<Request extends ReplicatedWriteRequest<Request>,ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>
java.lang.Object
org.opensearch.action.support.TransportAction<Request,Response>
org.opensearch.action.support.replication.TransportReplicationAction<Request,ReplicaRequest,Response>
org.opensearch.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
- Opensearch.internal:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
A proxy for write operations that need to be performed on the replicas, where a failure to execute the operation should fail the replica shard and/or mark the replica as stale.static class
TransportWriteAction.WritePrimaryResult<ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,
Response extends ReplicationResponse & WriteResponse> Result of taking the action on the primary.static class
TransportWriteAction.WriteReplicaResult<ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>>
Result of taking the action on the replica.Nested classes/interfaces inherited from class org.opensearch.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
Modifier and TypeFieldDescriptionprotected final IndexingPressureService
protected final SystemIndices
Fields inherited from class org.opensearch.action.support.replication.TransportReplicationAction
clusterService, executor, forceExecutionOnPrimary, indicesService, PRIMARY_ACTION_SUFFIX, REPLICA_ACTION_SUFFIX, REPLICATION_INITIAL_RETRY_BACKOFF_BOUND, REPLICATION_RETRY_TIMEOUT, shardStateAction, threadPool, transportOptions, transportPrimaryAction, transportReplicaAction, transportService
Fields inherited from class org.opensearch.action.support.TransportAction
actionName, logger, taskManager
-
Constructor Summary
ModifierConstructorDescriptionprotected
TransportWriteAction
(Settings settings, String actionName, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, ActionFilters actionFilters, org.opensearch.core.common.io.stream.Writeable.Reader<Request> request, org.opensearch.core.common.io.stream.Writeable.Reader<ReplicaRequest> replicaRequest, Function<IndexShard, String> executorFunction, boolean forceExecutionOnPrimary, IndexingPressureService indexingPressureService, SystemIndices systemIndices, org.opensearch.telemetry.tracing.Tracer tracer) protected
TransportWriteAction
(Settings settings, String actionName, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, ActionFilters actionFilters, org.opensearch.core.common.io.stream.Writeable.Reader<Request> request, org.opensearch.core.common.io.stream.Writeable.Reader<ReplicaRequest> replicaRequest, Function<IndexShard, String> executorFunction, boolean forceExecutionOnPrimary, IndexingPressureService indexingPressureService, SystemIndices systemIndices, org.opensearch.telemetry.tracing.Tracer tracer, AdmissionControlActionType admissionControlActionType) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.opensearch.common.lease.Releasable
checkOperationLimits
(Request request) protected org.opensearch.common.lease.Releasable
checkPrimaryLimits
(Request request, boolean rerouteWasLocal, boolean localRerouteInitiatedByNodeClient) protected org.opensearch.common.lease.Releasable
checkReplicaLimits
(ReplicaRequest request) protected abstract void
dispatchedShardOperationOnPrimary
(Request request, IndexShard primary, org.opensearch.core.action.ActionListener<TransportReplicationAction.PrimaryResult<ReplicaRequest, Response>> listener) protected abstract void
dispatchedShardOperationOnReplica
(ReplicaRequest request, IndexShard replica, org.opensearch.core.action.ActionListener<TransportReplicationAction.ReplicaResult> listener) protected String
executor
(IndexShard shard) protected boolean
force
(ReplicatedWriteRequest<?> request) protected ClusterBlockLevel
Cluster level block to check before request execution.Index level block to check before request execution.protected boolean
isSystemShard
(org.opensearch.core.index.shard.ShardId shardId) static Translog.Location
locationToSync
(Translog.Location current, Translog.Location next) protected ReplicationOperation.Replicas
<ReplicaRequest> protected long
primaryOperationSize
(Request request) protected long
replicaOperationSize
(ReplicaRequest request) protected void
shardOperationOnPrimary
(Request request, IndexShard primary, org.opensearch.core.action.ActionListener<TransportReplicationAction.PrimaryResult<ReplicaRequest, Response>> listener) Called on the primary with a reference to the primary IndexShard to modify.protected void
shardOperationOnReplica
(ReplicaRequest request, IndexShard replica, org.opensearch.core.action.ActionListener<TransportReplicationAction.ReplicaResult> listener) Called once per replica with a reference to the replica IndexShard to modify.protected static Translog.Location
syncOperationResultOrThrow
(Engine.Result operationResult, Translog.Location currentLocation) Syncs operation result to the translog or throws a shard not available failureMethods inherited from class org.opensearch.action.support.replication.TransportReplicationAction
acquirePrimaryOperationPermit, acquireReplicaOperationPermit, adaptResponse, doExecute, getIndexShard, getReplicationMode, handlePrimaryRequest, handleReplicaRequest, newResponseInstance, primaryTermValidationReplicasProxy, resolveRequest, retryPrimaryException, setPhase, transportOptions
Methods inherited from class org.opensearch.action.support.TransportAction
execute, execute, execute
-
Field Details
-
indexingPressureService
-
systemIndices
-
-
Constructor Details
-
TransportWriteAction
protected TransportWriteAction(Settings settings, String actionName, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, ActionFilters actionFilters, org.opensearch.core.common.io.stream.Writeable.Reader<Request> request, org.opensearch.core.common.io.stream.Writeable.Reader<ReplicaRequest> replicaRequest, Function<IndexShard, String> executorFunction, boolean forceExecutionOnPrimary, IndexingPressureService indexingPressureService, SystemIndices systemIndices, org.opensearch.telemetry.tracing.Tracer tracer, AdmissionControlActionType admissionControlActionType) -
TransportWriteAction
protected TransportWriteAction(Settings settings, String actionName, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, ActionFilters actionFilters, org.opensearch.core.common.io.stream.Writeable.Reader<Request> request, org.opensearch.core.common.io.stream.Writeable.Reader<ReplicaRequest> replicaRequest, Function<IndexShard, String> executorFunction, boolean forceExecutionOnPrimary, IndexingPressureService indexingPressureService, SystemIndices systemIndices, org.opensearch.telemetry.tracing.Tracer tracer)
-
-
Method Details
-
executor
-
checkOperationLimits
- Overrides:
checkOperationLimits
in classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,
ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>, Response extends ReplicationResponse & WriteResponse>
-
force
-
isSystemShard
protected boolean isSystemShard(org.opensearch.core.index.shard.ShardId shardId) -
checkPrimaryLimits
protected org.opensearch.common.lease.Releasable checkPrimaryLimits(Request request, boolean rerouteWasLocal, boolean localRerouteInitiatedByNodeClient) - Overrides:
checkPrimaryLimits
in classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,
ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>, Response extends ReplicationResponse & WriteResponse>
-
-
checkReplicaLimits
- Overrides:
checkReplicaLimits
in 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 Exception Syncs operation result to the translog or throws a shard not available failure- Throws:
Exception
-
locationToSync
-
newReplicasProxy
- Overrides:
newReplicasProxy
in classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,
ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>, Response extends ReplicationResponse & WriteResponse>
-
shardOperationOnPrimary
protected void shardOperationOnPrimary(Request request, IndexShard primary, org.opensearch.core.action.ActionListener<TransportReplicationAction.PrimaryResult<ReplicaRequest, Response>> listener) Called on the primary with a reference to the primary IndexShard to modify.- Specified by:
shardOperationOnPrimary
in classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,
ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>, Response extends ReplicationResponse & WriteResponse> - Parameters:
request
- the request to the primary shardprimary
- the primary shard to perform the operation onlistener
- listener for the result of the operation on primary, including current translog location and operation response and failure async refresh is performed on theprimary
shard according to theRequest
refresh policy
-
dispatchedShardOperationOnPrimary
protected abstract void dispatchedShardOperationOnPrimary(Request request, IndexShard primary, org.opensearch.core.action.ActionListener<TransportReplicationAction.PrimaryResult<ReplicaRequest, Response>> listener) -
shardOperationOnReplica
protected void shardOperationOnReplica(ReplicaRequest request, IndexShard replica, org.opensearch.core.action.ActionListener<TransportReplicationAction.ReplicaResult> listener) Called once per replica with a reference to the replica IndexShard to modify.- Specified by:
shardOperationOnReplica
in classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,
ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>, Response extends ReplicationResponse & WriteResponse> - Parameters:
request
- the request to the replica shardreplica
- the replica shard to perform the operation onlistener
- listener for the result of the operation on replica, including current translog location and operation response and failure async refresh is performed on thereplica
shard according to theReplicaRequest
refresh policy
-
dispatchedShardOperationOnReplica
protected abstract void dispatchedShardOperationOnReplica(ReplicaRequest request, IndexShard replica, org.opensearch.core.action.ActionListener<TransportReplicationAction.ReplicaResult> listener) -
globalBlockLevel
Description copied from class:TransportReplicationAction
Cluster level block to check before request execution. Returning null means that no blocks need to be checked.- Overrides:
globalBlockLevel
in classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,
ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>, Response extends ReplicationResponse & WriteResponse>
-
indexBlockLevel
Description copied from class:TransportReplicationAction
Index level block to check before request execution. Returning null means that no blocks need to be checked.- Overrides:
indexBlockLevel
in classTransportReplicationAction<Request extends ReplicatedWriteRequest<Request>,
ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>, Response extends ReplicationResponse & WriteResponse>
-