Class ReplicationRequest<Request extends ReplicationRequest<Request>>
java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.TransportRequest
org.elasticsearch.action.ActionRequest
org.elasticsearch.action.support.replication.ReplicationRequest<Request>
- All Implemented Interfaces:
IndicesRequest,Writeable,org.elasticsearch.core.RefCounted,TaskAwareRequest
- Direct Known Subclasses:
BasicReplicationRequest,GlobalCheckpointSyncAction.Request,ReplicatedWriteRequest,RetentionLeaseBackgroundSyncAction.Request,ShardFlushRequest,TransportVerifyShardBeforeCloseAction.ShardRequest,TransportVerifyShardIndexBlockAction.ShardRequest
public abstract class ReplicationRequest<Request extends ReplicationRequest<Request>>
extends ActionRequest
implements IndicesRequest
Requests that are run on a particular replica, first on the primary and then on the replicas like
IndexRequest or
TransportShardRefreshAction.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportRequest
TransportRequest.EmptyNested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.ReplaceableNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic org.elasticsearch.core.TimeValueprotected Stringprotected ShardIdTarget shard the request should execute on.protected org.elasticsearch.core.TimeValueprotected ActiveShardCountThe number of shard copies that must be active before proceeding with the replication action. -
Constructor Summary
ConstructorsConstructorDescriptionReplicationRequest(ShardId shardId)Creates a new request with resolved shard idReplicationRequest(ShardId shardId, StreamInput in) -
Method Summary
Modifier and TypeMethodDescriptionReturns the task object that should be used to keep track of the processing of the request.Returns optional description of the request to be displayed by the task managerindex()String[]indices()Returns the array of indices that the action relates toReturns the indices options used to resolve indices.voidonRetry()This method is called before this replication request is retried the first time.protected RequestroutedBasedOnClusterVersion(long routedBasedOnClusterVersion)Sets the minimum version of the cluster state that is required on the next node before we redirect to another primary.shardId()org.elasticsearch.core.TimeValuetimeout()A timeout to wait if the index operation can't be performed immediately.timeout(org.elasticsearch.core.TimeValue timeout)A timeout to wait if the index operation can't be performed immediately.abstract StringtoString()validate()waitForActiveShards(int waitForActiveShards)A shortcut forwaitForActiveShards(ActiveShardCount)where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)to get the ActiveShardCount.waitForActiveShards(ActiveShardCount waitForActiveShards)Sets the number of shard copies that must be active before proceeding with the replication operation.voidwriteThin(StreamOutput out)voidwriteTo(StreamOutput out)Write this into the StreamOutput.Methods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResultMethods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTaskMethods inherited from class org.elasticsearch.transport.TransportMessage
decRef, incRef, remoteAddress, remoteAddress, tryIncRefMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.action.IndicesRequest
allowsRemoteIndices, includeDataStreamsMethods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
setParentTask
-
Field Details
-
DEFAULT_TIMEOUT
public static final org.elasticsearch.core.TimeValue DEFAULT_TIMEOUT -
shardId
Target shard the request should execute on. In case of index and delete requests, shard id gets resolved by the transport action before performing request operation and at request creation time for shard-level bulk, refresh and flush requests. -
timeout
protected org.elasticsearch.core.TimeValue timeout -
index
-
waitForActiveShards
The number of shard copies that must be active before proceeding with the replication action.
-
-
Constructor Details
-
ReplicationRequest
- Throws:
IOException
-
ReplicationRequest
- Throws:
IOException
-
ReplicationRequest
Creates a new request with resolved shard id
-
-
Method Details
-
timeout
A timeout to wait if the index operation can't be performed immediately. Defaults to1m. -
timeout
A timeout to wait if the index operation can't be performed immediately. Defaults to1m. -
timeout
public org.elasticsearch.core.TimeValue timeout() -
index
-
index
-
indices
Description copied from interface:IndicesRequestReturns the array of indices that the action relates to- Specified by:
indicesin interfaceIndicesRequest
-
indicesOptions
Description copied from interface:IndicesRequestReturns the indices options used to resolve indices. They tell for instance whether a single index is accepted, whether an empty array will be converted to _all, and how wildcards will be expanded if needed.- Specified by:
indicesOptionsin interfaceIndicesRequest
-
waitForActiveShards
-
shardId
- Returns:
- the shardId of the shard where this operation should be executed on. can be null if the shardID has not yet been resolved
-
waitForActiveShards
Sets the number of shard copies that must be active before proceeding with the replication operation. Defaults toActiveShardCount.DEFAULT, which requires one shard copy (the primary) to be active. Set this value toActiveShardCount.ALLto wait for all shards (primary and all replicas) to be active. Otherwise, useActiveShardCount.from(int)to set this value to any non-negative integer, up to the total number of shard copies (number of replicas + 1). -
waitForActiveShards
A shortcut forwaitForActiveShards(ActiveShardCount)where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)to get the ActiveShardCount. -
routedBasedOnClusterVersion
Sets the minimum version of the cluster state that is required on the next node before we redirect to another primary. Used to prevent redirect loops, see alsoAbstractRunnable.doRun() -
validate
- Specified by:
validatein classActionRequest
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classActionRequest- Throws:
IOException
-
writeThin
Thin serialization that does not writeshardIdand will only writeindexif it is different from the index name inshardId.- Throws:
IOException
-
createTask
public Task createTask(long id, String type, String action, TaskId parentTaskId, Map<String,String> headers)Description copied from interface:TaskAwareRequestReturns the task object that should be used to keep track of the processing of the request.- Specified by:
createTaskin interfaceTaskAwareRequest
-
toString
- Overrides:
toStringin classTransportRequest
-
getDescription
Description copied from interface:TaskAwareRequestReturns optional description of the request to be displayed by the task manager- Specified by:
getDescriptionin interfaceTaskAwareRequest
-
onRetry
public void onRetry()This method is called before this replication request is retried the first time.
-