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.Empty
Nested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.Replaceable
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic org.elasticsearch.core.TimeValue
protected String
protected ShardId
Target shard the request should execute on.protected org.elasticsearch.core.TimeValue
protected ActiveShardCount
The number of shard copies that must be active before proceeding with the replication action. -
Constructor Summary
ConstructorDescriptionReplicationRequest(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.void
onRetry()
This method is called before this replication request is retried the first time.protected Request
routedBasedOnClusterVersion(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.TimeValue
timeout()
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 String
toString()
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.void
writeThin(StreamOutput out)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResult
Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTask
Methods inherited from class org.elasticsearch.transport.TransportMessage
decRef, incRef, remoteAddress, remoteAddress, tryIncRef
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.action.IndicesRequest
allowsRemoteIndices, includeDataStreams
Methods 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:IndicesRequest
Returns the array of indices that the action relates to- Specified by:
indices
in interfaceIndicesRequest
-
indicesOptions
Description copied from interface:IndicesRequest
Returns 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:
indicesOptions
in 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.ALL
to 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:
validate
in classActionRequest
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Overrides:
writeTo
in classActionRequest
- Throws:
IOException
-
writeThin
Thin serialization that does not writeshardId
and will only writeindex
if 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:TaskAwareRequest
Returns the task object that should be used to keep track of the processing of the request.- Specified by:
createTask
in interfaceTaskAwareRequest
-
toString
- Overrides:
toString
in classTransportRequest
-
getDescription
Description copied from interface:TaskAwareRequest
Returns optional description of the request to be displayed by the task manager- Specified by:
getDescription
in interfaceTaskAwareRequest
-
onRetry
public void onRetry()This method is called before this replication request is retried the first time.
-