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

Revert primary permits changes and add hook #120398

Merged
merged 2 commits into from
Jan 20, 2025

Conversation

kingherc
Copy link
Contributor

We would like to avoid using directly primary permits for hollow shards. So we revert relevant changes, and add a hook into the function that gets a primary permit with the purpose of a plugin being able to extend the behavior.

Relates ES-10537

@kingherc kingherc added >non-issue :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. v9.0.0 Team:Distributed Indexing Meta label for Distributed Indexing team labels Jan 17, 2025
@kingherc kingherc self-assigned this Jan 17, 2025
@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Jan 17, 2025
@kingherc kingherc force-pushed the non-issue/ES-10537-hollow-permits branch from af0481e to bcd04fc Compare January 17, 2025 15:24
We would like to avoid using directly primary permits for hollow
shards. So we revert relevant changes, and add a hook into the
function that gets a primary permit with the purpose of a plugin
being able to extend the behavior.

Relates ES-10537
@kingherc kingherc force-pushed the non-issue/ES-10537-hollow-permits branch from bcd04fc to 275f5c0 Compare January 17, 2025 15:55
@kingherc kingherc marked this pull request as ready for review January 17, 2025 17:00
@kingherc kingherc requested review from arteam and fcofdez January 17, 2025 17:00
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@arteam arteam left a comment

Choose a reason for hiding this comment

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

LGTM

Looks like mostly reverts of #119794 and #120098 plus extending IndexEventListener with onAcquirePrimaryOperationPermit during acquisition of primary permits

Copy link
Contributor

@fcofdez fcofdez left a comment

Choose a reason for hiding this comment

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

LGTM. Looks great, I left a couple of small comments.

);

ActionListener<Releasable> onPermitAcquiredWrapped = onPermitAcquired.delegateFailureAndWrap((delegate, releasable) -> {
final ActionListener<Releasable> wrappedListener = indexShardOperationPermits.wrapContextPreservingActionListener(
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to do the context preserving in all cases? I don't think so? i.e. during normal operations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fcofdez I'm not familiar with what operations need the context. I saw it in IndexShardOperationPermits.java and assumed it's needed here as well.

Note that before this PR, the IndexShardOperationPermits.java was the one potentially triggering the final listener of the operation. However, with this PR, we potentially add another blocking step in the plugin (the additional RefCountingListener here). So we can't be sure whatever thread finally triggers the RefCountingListener has the context, thus I elected to made sure we preserve the context as well to "replicate" the original behavior of IndexShardOperationPermits.java.

After this explanation, do you believe we can safely skip the context?

@kingherc kingherc merged commit b3b059c into elastic:main Jan 20, 2025
16 checks passed
@kingherc kingherc deleted the non-issue/ES-10537-hollow-permits branch January 20, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >non-issue serverless-linked Added by automation, don't add manually Team:Distributed Indexing Meta label for Distributed Indexing team v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants