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

Reduce number of get method variants in ShardGetService #122175

Merged
merged 3 commits into from
Feb 11, 2025

Conversation

tlrx
Copy link
Member

@tlrx tlrx commented Feb 10, 2025

ShardGetService contains multiple get*() methods
with different visibility.

One getForUpdate is only used in a test so it
can be moved there.

An innerGet private method is only called by
the private get() method so it can be folded in
there to remove one more undocumented get
variant.

A public get method is only used in
TransportShardMultiGetAction so we can rename
it to mget to avoid confusion with other get.

Finally the private get is renamed to doGet
to indicate it's an "inner" private method.

ShardGetService contains multiple get*() methods
with different visibility.

One `getForUpdate` is only used in a test so it
can be moved there.

An `innerGet` private method is only called by
the private get() method so it can be folded in
there to remove one more undocumented `get`
variant.

A public `get` method is only used in
TransportShardMultiGetAction so we can rename
it to `mget` to avoid confusion with other `get`.

Finally the private `get` is renamed to `doGet`
to indicate it's an "inner" private method.
@tlrx tlrx added >non-issue :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. v9.0.1 v9.1.0 labels Feb 10, 2025
@tlrx tlrx requested review from fcofdez, arteam and kingherc February 10, 2025 13:44
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Indexing Meta label for Distributed Indexing team label Feb 10, 2025
@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 much more intuitive now

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. Thanks for cleaning this 👍

@@ -131,7 +130,7 @@ public GetResult get(
);
}

private GetResult get(
private GetResult doGet(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit I see the rest of the class uses inner instead of do for private functions, feel free to see if renaming to innerGet might be more conforming.

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to make a distinction with the other innerGetAndFetch method.

@tlrx tlrx added the auto-backport Automatically create backport pull requests when merged label Feb 11, 2025
@tlrx tlrx merged commit e706193 into elastic:main Feb 11, 2025
17 checks passed
@tlrx tlrx deleted the 2025/02/10/ShardGetService-methods branch February 11, 2025 08:40
@tlrx
Copy link
Member Author

tlrx commented Feb 11, 2025

Thanks all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >non-issue Team:Distributed Indexing Meta label for Distributed Indexing team v9.0.1 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants