Package org.elasticsearch.index.seqno
Class RetentionLeaseBackgroundSyncAction
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractComponent
-
- org.elasticsearch.action.support.TransportAction<Request,Response>
-
- org.elasticsearch.action.support.replication.TransportReplicationAction<RetentionLeaseBackgroundSyncAction.Request,RetentionLeaseBackgroundSyncAction.Request,ReplicationResponse>
-
- org.elasticsearch.index.seqno.RetentionLeaseBackgroundSyncAction
-
public class RetentionLeaseBackgroundSyncAction extends TransportReplicationAction<RetentionLeaseBackgroundSyncAction.Request,RetentionLeaseBackgroundSyncAction.Request,ReplicationResponse>
Replication action responsible for background syncing retention leases to replicas. This action is deliberately a replication action so that if a replica misses a background retention lease sync then that shard will not be marked as stale. We have some tolerance for a shard copy missing renewals of retention leases since the background sync interval is much smaller than the expected lifetime of retention leases.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RetentionLeaseBackgroundSyncAction.Request
-
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 RetentionLeaseBackgroundSyncAction(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.TransportReplicationAction
acquirePrimaryOperationPermit, acquireReplicaOperationPermit, doExecute, doExecute, getIndexShard, globalBlockLevel, indexBlockLevel, newReplicasProxy, registerRequestHandlers, resolveIndex, resolveRequest, retryPrimaryException, transportOptions
-
Methods inherited from class org.elasticsearch.action.support.TransportAction
execute, execute, execute, execute
-
-
-
-
Constructor Detail
-
RetentionLeaseBackgroundSyncAction
@Inject public RetentionLeaseBackgroundSyncAction(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()
-
backgroundSync
public void backgroundSync(ShardId shardId, RetentionLeases retentionLeases)
Background sync the specified retention leases for the specified shard.- Parameters:
shardId
- the shard to syncretentionLeases
- the retention leases to sync
-
shardOperationOnPrimary
protected TransportReplicationAction.PrimaryResult<RetentionLeaseBackgroundSyncAction.Request,ReplicationResponse> shardOperationOnPrimary(RetentionLeaseBackgroundSyncAction.Request request, IndexShard primary) throws java.io.IOException
Description copied from class:TransportReplicationAction
Primary operation on node with primary copy.- Specified by:
shardOperationOnPrimary
in classTransportReplicationAction<RetentionLeaseBackgroundSyncAction.Request,RetentionLeaseBackgroundSyncAction.Request,ReplicationResponse>
- Parameters:
request
- the request to the primary shardprimary
- the primary shard to perform the operation on- Throws:
java.io.IOException
-
sendReplicaRequest
protected void sendReplicaRequest(TransportReplicationAction.ConcreteReplicaRequest<RetentionLeaseBackgroundSyncAction.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<RetentionLeaseBackgroundSyncAction.Request,RetentionLeaseBackgroundSyncAction.Request,ReplicationResponse>
- Parameters:
replicaRequest
- the replica requestnode
- the node to send the request tolistener
- callback for handling the response or failure
-
shardOperationOnReplica
protected TransportReplicationAction.ReplicaResult shardOperationOnReplica(RetentionLeaseBackgroundSyncAction.Request request, IndexShard replica) throws java.io.IOException
Description copied from class:TransportReplicationAction
Synchronously execute the specified replica operation. This is done under a permit fromIndexShard.acquireReplicaOperationPermit(long, long, long, ActionListener, String, Object)
.- Specified by:
shardOperationOnReplica
in classTransportReplicationAction<RetentionLeaseBackgroundSyncAction.Request,RetentionLeaseBackgroundSyncAction.Request,ReplicationResponse>
- Parameters:
request
- the request to the replica shardreplica
- the replica shard to perform the operation on- Throws:
java.io.IOException
-
newResponseInstance
protected ReplicationResponse newResponseInstance()
-
-