Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fail retention lease sync actions due to capacity constraints #109414

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

nicktindall
Copy link
Contributor

@nicktindall nicktindall commented Jun 6, 2024

Closes #105926

RetentionLeaseSyncAction replicates the retention leases from the primary node to the replicas and persists them to disk on both the primary and replicas.

RetentionLeaseSyncAction is a TransportWriteAction. A TransportWriteAction executes an update on the primary copy of the shard then on the replica(s). If the primary operation succeeds, but the replica operation(s) do not, the shard is marked as failed and an expensive recovery process is kicked off.

One of the reasons a TransportAction can fail is due to the circuit breakers residing on each node. If a request comes in and the node is very busy it can fail an action to prevent running out of memory.

Because the RetentionLeaseSyncAction consumes a negligible amount of memory, this PR excludes the replica component of the RetentionLeaseSyncAction and BackgroundRetentionLeaseSyncAction from the circuit breaker checks. This will prevent a costly failure without significantly increasing the risk of out-of-memory errors.

Edit: It has also become apparent that the indexing pressure check can fail the retention lease sync. I've included an additional change in this PR to force execution of the action on the primary to bypass such checks. Indexing pressure checks are already bypassed on the replica by default in TransportReplicationAction

@nicktindall nicktindall force-pushed the fix/105926_do_not_trip_circuit_breakers_retention_lease_sync branch from ccb95e9 to 795287b Compare June 18, 2024 07:20
@nicktindall nicktindall added >bug :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. labels Jun 20, 2024
@elasticsearchmachine
Copy link
Collaborator

Hi @nicktindall, I've created a changelog YAML for you.

@nicktindall nicktindall marked this pull request as ready for review June 20, 2024 04:26
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team label Jun 20, 2024
nicktindall added a commit that referenced this pull request Jul 29, 2024
…ntion_lease_sync

# Conflicts:
#	server/src/main/java/org/elasticsearch/index/seqno/RetentionLeaseBackgroundSyncAction.java
#	server/src/main/java/org/elasticsearch/index/seqno/RetentionLeaseSyncAction.java
@nicktindall nicktindall changed the title Don't trip circuit breakers for retention lease sync actions Don't fail retention lease sync actions due to capacity constraints Jul 30, 2024
@@ -91,10 +91,10 @@ public RetentionLeaseSyncAction(
RetentionLeaseSyncAction.Request::new,
RetentionLeaseSyncAction.Request::new,
new ManagementOnlyExecutorFunction(threadPool),
PrimaryActionExecution.RejectOnOverload,
PrimaryActionExecution.Force,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this change is necessary on the RetentionLeaseBackgroundSyncAction because it's not a TransportWriteAction, and therefore checkPrimaryLimits (where the indexing pressure check is done) is a no-op.

Copy link
Contributor Author

@nicktindall nicktindall Jul 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we even need to make any changes to RetentionLeaseBackgroundSyncAction. It doesn't appear that its failure will have the same consequences as that of RetentionLeaseSyncAction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. Team:Distributed Meta label for distributed team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Retention lease sync actions should not trip circuit breakers
4 participants