Skip to content

Repro and fix recoveryStats double decrement - #149348

Merged
inespot merged 5 commits into
elastic:mainfrom
inespot:fix/recoverystats
May 20, 2026
Merged

inespot merged 5 commits into
elastic:mainfrom
inespot:fix/recoverystats

Conversation

@inespot

@inespot inespot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Encountered while working on: #149319. Relates to https://github.com/elastic/elasticsearch-team/issues/2809.

When OngoingRecoveries.cancel(IndexShard) is called during shard close, it decrements recoveryStats.currentAsSource() in a finally block for each active handler. However, since cancel() does not remove handlers from the internal map, they remain registered and are subsequently removed via their completion listeners, which call OngoingRecoveries.remove(), triggering a second decrement of the same counter and making the currentAsSource recovery stat go negative.

See repro in gradle

@inespot
inespot marked this pull request as ready for review May 19, 2026 03:02
@elasticsearchmachine elasticsearchmachine added the needs:triage Requires assignment of a team area label label May 19, 2026
@inespot inespot added :Distributed/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. >bug labels May 19, 2026
@elasticsearchmachine elasticsearchmachine added Team:Distributed Meta label for distributed team. and removed needs:triage Requires assignment of a team area label labels May 19, 2026
@elasticsearchmachine

Copy link
Copy Markdown
Collaborator

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

@elasticsearchmachine

Copy link
Copy Markdown
Collaborator

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

@github-actions

github-actions Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

🔍 Preview links for changed docs

⏳ Building and deploying preview... View progress

This comment will be updated with preview links when the build is complete.

@github-actions

Copy link
Copy Markdown
Contributor

ℹ️ Important: Docs version tagging

👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version.

We use applies_to tags to mark version-specific features and changes.

Expand for a quick overview

When to use applies_to tags:

✅ At the page level to indicate which products/deployments the content applies to (mandatory)
✅ When features change state (e.g. preview, ga) in a specific version
✅ When availability differs across deployments and environments

What NOT to do:

❌ Don't remove or replace information that applies to an older version
❌ Don't add new information that applies to a specific version without an applies_to tag
❌ Don't forget that applies_to tags can be used at the page, section, and inline level

🤔 Need help?

@inespot
inespot requested review from DaveCTurner and burqen May 19, 2026 04:38

@burqen burqen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good to me. Nice repro and simple fix!

@inespot
inespot merged commit 786cc45 into elastic:main May 20, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Distributed/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. Team:Distributed Meta label for distributed team. v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants