Package org.elasticsearch.index.seqno
Class RetentionLeaseSyncAction
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractComponent
-
- org.elasticsearch.action.support.TransportAction<Request,Response>
-
- org.elasticsearch.action.support.replication.TransportReplicationAction<Request,ReplicaRequest,Response>
-
- org.elasticsearch.action.support.replication.TransportWriteAction<RetentionLeaseSyncAction.Request,RetentionLeaseSyncAction.Request,RetentionLeaseSyncAction.Response>
-
- org.elasticsearch.index.seqno.RetentionLeaseSyncAction
-
public class RetentionLeaseSyncAction extends TransportWriteAction<RetentionLeaseSyncAction.Request,RetentionLeaseSyncAction.Request,RetentionLeaseSyncAction.Response>
Write action responsible for syncing retention leases to replicas. This action is deliberately a write action so that if a replica misses a retention lease sync then that shard will be marked as stale.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RetentionLeaseSyncAction.Request
static class
RetentionLeaseSyncAction.Response
-
Nested classes/interfaces inherited from class org.elasticsearch.action.support.replication.TransportWriteAction
TransportWriteAction.WritePrimaryResult<ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>,Response extends ReplicationResponse & WriteResponse>, TransportWriteAction.WriteReplicaResult<ReplicaRequest extends ReplicatedWriteRequest<ReplicaRequest>>
-
Nested classes/interfaces inherited from class org.elasticsearch.action.support.replication.TransportReplicationAction
TransportReplicationAction.ConcreteReplicaRequest<R extends TransportRequest>, TransportReplicationAction.ConcreteShardRequest<R extends TransportRequest>, TransportReplicationAction.OperationTransportHandler, TransportReplicationAction.PrimaryOperationTransportHandler, TransportReplicationAction.PrimaryResult<ReplicaRequest extends ReplicationRequest<ReplicaRequest>,Response extends ReplicationResponse>, TransportReplicationAction.ReplicaOperationTransportHandler, TransportReplicationAction.ReplicaResponse, TransportReplicationAction.ReplicaResult, TransportReplicationAction.ReplicasProxy, TransportReplicationAction.RetryOnReplicaException
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ACTION_NAME
-
Fields inherited from class org.elasticsearch.action.support.replication.TransportReplicationAction
clusterService, executor, indicesService, shardStateAction, transportOptions, transportPrimaryAction, transportReplicaAction, transportService
-
Fields inherited from class org.elasticsearch.action.support.TransportAction
actionName, indexNameExpressionResolver, taskManager, threadPool
-
Fields inherited from class org.elasticsearch.common.component.AbstractComponent
logger
-
-
Constructor Summary
Constructors Constructor Description RetentionLeaseSyncAction(Settings settings, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver)
-
Method Summary
-
Methods inherited from class org.elasticsearch.action.support.replication.TransportWriteAction
globalBlockLevel, locationToSync, newReplicasProxy, syncOperationResultOrThrow
-
Methods inherited from class org.elasticsearch.action.support.replication.TransportReplicationAction
acquirePrimaryOperationPermit, acquireReplicaOperationPermit, doExecute, doExecute, getIndexShard, registerRequestHandlers, resolveIndex, resolveRequest, retryPrimaryException, transportOptions
-
Methods inherited from class org.elasticsearch.action.support.TransportAction
execute, execute, execute, execute
-
-
-
-
Constructor Detail
-
RetentionLeaseSyncAction
@Inject public RetentionLeaseSyncAction(Settings settings, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver)
-
-
Method Detail
-
getLogger
protected org.apache.logging.log4j.Logger getLogger()
-
sync
public void sync(ShardId shardId, RetentionLeases retentionLeases, ActionListener<ReplicationResponse> listener)
Sync the specified retention leases for the specified shard. The callback is invoked when the sync succeeds or fails.- Parameters:
shardId
- the shard to syncretentionLeases
- the retention leases to synclistener
- the callback to invoke when the sync completes normally or abnormally
-
shardOperationOnPrimary
protected TransportWriteAction.WritePrimaryResult<RetentionLeaseSyncAction.Request,RetentionLeaseSyncAction.Response> shardOperationOnPrimary(RetentionLeaseSyncAction.Request request, IndexShard primary) throws java.io.IOException
Description copied from class:TransportWriteAction
Called on the primary with a reference to the primary IndexShard to modify.- Specified by:
shardOperationOnPrimary
in classTransportWriteAction<RetentionLeaseSyncAction.Request,RetentionLeaseSyncAction.Request,RetentionLeaseSyncAction.Response>
- Parameters:
request
- the request to the primary shardprimary
- the primary shard to perform the operation on- Returns:
- the result of the operation on primary, including current translog location and operation response and failure
async refresh is performed on the
primary
shard according to theRequest
refresh policy - Throws:
java.io.IOException
-
sendReplicaRequest
protected void sendReplicaRequest(TransportReplicationAction.ConcreteReplicaRequest<RetentionLeaseSyncAction.Request> replicaRequest, DiscoveryNode node, ActionListener<ReplicationOperation.ReplicaResponse> listener)
Description copied from class:TransportReplicationAction
Sends the specified replica request to the specified node.- Overrides:
sendReplicaRequest
in classTransportReplicationAction<RetentionLeaseSyncAction.Request,RetentionLeaseSyncAction.Request,RetentionLeaseSyncAction.Response>
- Parameters:
replicaRequest
- the replica requestnode
- the node to send the request tolistener
- callback for handling the response or failure
-
shardOperationOnReplica
protected TransportWriteAction.WriteReplicaResult<RetentionLeaseSyncAction.Request> shardOperationOnReplica(RetentionLeaseSyncAction.Request request, IndexShard replica) throws java.io.IOException
Description copied from class:TransportWriteAction
Called once per replica with a reference to the replica IndexShard to modify.- Specified by:
shardOperationOnReplica
in classTransportWriteAction<RetentionLeaseSyncAction.Request,RetentionLeaseSyncAction.Request,RetentionLeaseSyncAction.Response>
- Parameters:
request
- the request to the replica shardreplica
- the replica shard to perform the operation on- Returns:
- the result of the operation on replica, including current translog location and operation response and failure
async refresh is performed on the
replica
shard according to theReplicaRequest
refresh policy - Throws:
java.io.IOException
-
indexBlockLevel
public ClusterBlockLevel indexBlockLevel()
Description copied from class:TransportReplicationAction
Index level block to check before request execution. Returning null means that no blocks need to be checked.
-
newResponseInstance
protected RetentionLeaseSyncAction.Response newResponseInstance()
-
-