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 |
---|---|
static class |
TransportReplicationAction.ConcreteShardRequest<R extends TransportRequest>
a wrapper class to encapsulate a request when being sent to a specific allocation id
|
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 void |
acquirePrimaryShardReference(ShardId shardId,
java.lang.String allocationId,
ActionListener<org.elasticsearch.action.support.replication.TransportReplicationAction.PrimaryShardReference> onReferenceAcquired)
tries to acquire reference to
IndexShard to perform a primary operation. |
protected void |
acquireReplicaOperationLock(ShardId shardId,
long primaryTerm,
java.lang.String allocationId,
ActionListener<Releasable> onLockAcquired)
tries to acquire an operation on replicas.
|
protected void |
doExecute(Request request,
ActionListener<Response> listener) |
protected void |
doExecute(Task task,
Request request,
ActionListener<Response> listener) |
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, String, ActionListener)
.protected ClusterBlockLevel globalBlockLevel()
protected ClusterBlockLevel indexBlockLevel()
protected boolean resolveIndex()
protected TransportRequestOptions transportOptions()
protected boolean retryPrimaryException(java.lang.Throwable e)
protected void acquirePrimaryShardReference(ShardId shardId, java.lang.String allocationId, ActionListener<org.elasticsearch.action.support.replication.TransportReplicationAction.PrimaryShardReference> onReferenceAcquired)
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 void acquireReplicaOperationLock(ShardId shardId, long primaryTerm, java.lang.String allocationId, ActionListener<Releasable> onLockAcquired)
protected boolean shouldExecuteReplication(Settings settings)