public abstract class TransportReplicationAction<Request extends ReplicationRequest<Request>,ReplicaRequest extends ReplicationRequest<ReplicaRequest>,Response extends ReplicationResponse> extends TransportAction<Request,Response>
Modifier and Type | Class and Description |
---|---|
protected class |
TransportReplicationAction.PrimaryResult |
protected class |
TransportReplicationAction.ReplicaResult |
static class |
TransportReplicationAction.RetryOnReplicaException |
Modifier and Type | Field and Description |
---|---|
protected ClusterService |
clusterService |
protected IndicesService |
indicesService |
protected TransportService |
transportService |
actionName, indexNameExpressionResolver, parseFieldMatcher, taskManager, threadPool
deprecationLogger, logger, settings
Modifier | Constructor and Description |
---|---|
protected |
TransportReplicationAction(Settings settings,
java.lang.String actionName,
TransportService transportService,
ClusterService clusterService,
IndicesService indicesService,
ThreadPool threadPool,
ShardStateAction shardStateAction,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
java.util.function.Supplier<Request> request,
java.util.function.Supplier<ReplicaRequest> replicaRequest,
java.lang.String executor) |
Modifier and Type | Method and Description |
---|---|
protected Releasable |
acquireReplicaOperationLock(ShardId shardId,
long primaryTerm)
Acquire an operation on replicas.
|
protected boolean |
checkWriteConsistency()
True if write consistency should be checked for an implementation
|
protected void |
doExecute(Request request,
ActionListener<Response> listener) |
protected void |
doExecute(Task task,
Request request,
ActionListener<Response> listener) |
protected org.elasticsearch.action.support.replication.TransportReplicationAction.PrimaryShardReference |
getPrimaryShardReference(ShardId shardId)
returns a new reference to
IndexShard to perform a primary operation. |
protected ClusterBlockLevel |
globalBlockLevel()
Cluster level block to check before request execution
|
protected ClusterBlockLevel |
indexBlockLevel()
Index level block to check before request execution
|
protected abstract Response |
newResponseInstance() |
protected boolean |
resolveIndex()
True if provided index should be resolved when resolving request
|
protected void |
resolveRequest(MetaData metaData,
IndexMetaData indexMetaData,
Request request)
Resolves derived values in the request.
|
protected boolean |
retryPrimaryException(java.lang.Throwable e) |
protected abstract TransportReplicationAction.PrimaryResult |
shardOperationOnPrimary(Request shardRequest)
Primary operation on node with primary copy.
|
protected abstract TransportReplicationAction.ReplicaResult |
shardOperationOnReplica(ReplicaRequest shardRequest)
Synchronous replica operation on nodes with replica copies.
|
protected boolean |
shouldExecuteReplication(Settings settings)
Indicated whether this operation should be replicated to shadow replicas or not.
|
protected TransportRequestOptions |
transportOptions() |
execute, execute, execute, execute
logDeprecatedSetting, logRemovedSetting, nodeName
protected final TransportService transportService
protected final ClusterService clusterService
protected final IndicesService indicesService
protected TransportReplicationAction(Settings settings, java.lang.String actionName, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, java.util.function.Supplier<Request> request, java.util.function.Supplier<ReplicaRequest> replicaRequest, java.lang.String executor)
protected final void doExecute(Request request, ActionListener<Response> listener)
doExecute
in class TransportAction<Request extends ReplicationRequest<Request>,Response extends ReplicationResponse>
protected void doExecute(Task task, Request request, ActionListener<Response> listener)
doExecute
in class TransportAction<Request extends ReplicationRequest<Request>,Response extends ReplicationResponse>
protected abstract Response newResponseInstance()
protected void resolveRequest(MetaData metaData, IndexMetaData indexMetaData, Request request)
metaData
- cluster state metadataindexMetaData
- index metadata of the concrete index this request is going to operate onrequest
- the request to resolveprotected abstract TransportReplicationAction.PrimaryResult shardOperationOnPrimary(Request shardRequest) throws java.lang.Exception
shardRequest
- the request to the primary shardjava.lang.Exception
protected abstract TransportReplicationAction.ReplicaResult shardOperationOnReplica(ReplicaRequest shardRequest)
acquireReplicaOperationLock(ShardId, long)
.protected boolean checkWriteConsistency()
protected ClusterBlockLevel globalBlockLevel()
protected ClusterBlockLevel indexBlockLevel()
protected boolean resolveIndex()
protected TransportRequestOptions transportOptions()
protected boolean retryPrimaryException(java.lang.Throwable e)
protected org.elasticsearch.action.support.replication.TransportReplicationAction.PrimaryShardReference getPrimaryShardReference(ShardId shardId)
IndexShard
to perform a primary operation. Released after performing primary operation locally
and replication of the operation to all replica shards is completed / failed (see ReplicationOperation
).protected Releasable acquireReplicaOperationLock(ShardId shardId, long primaryTerm)
protected boolean shouldExecuteReplication(Settings settings)