Skip to content

Remove some unused dependencies from Reindex transport actions #104307

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

original-brownbear
Copy link
Contributor

We didn't use the cluster state in one spot, from that it followed that we can do away with the clusterservice as a dependency in many spots. Also we already pass around clients that reference the thread-pool, no need to separately pass it around either.

We didn't use the cluster state in one spot, from that it followed that
we can do away with the clusterservice as a dependency in many spots.
Also we already pass around clients that reference the thread-pool, no
need to separately pass it around either.
@original-brownbear original-brownbear added >non-issue :Distributed Indexing/Reindex Issues relating to reindex that are not caused by issues further down labels Jan 12, 2024
@elasticsearchmachine elasticsearchmachine added Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.13.0 labels Jan 12, 2024
@elasticsearchmachine
Copy link
Collaborator

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

@@ -167,7 +161,7 @@ public abstract class AbstractAsyncBulkByScrollAction<
this.logger = logger;
this.searchClient = searchClient;
this.bulkClient = bulkClient;
this.threadPool = threadPool;
this.threadPool = searchClient.threadPool();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a difference between the searchClient.threadPool() and choosing bulkClient.threadPool()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No not really :) it's always the same instance.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to add an assertion that their thread pools are the same just to ensure

Copy link
Contributor

@idegtiarenko idegtiarenko Jan 16, 2024

Choose a reason for hiding this comment

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

I think that is org.elasticsearch.threadpool.ThreadPool that allows to access any actual ExecutorService.

Not sure I like this change. It hides the fact that we depend on the ThreadPool and instead "steals" it from the other dependency. Hypothetically, what happens if we change searchClient to not have the threadPool or at least not expose it any more?

Copy link
Contributor

Choose a reason for hiding this comment

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

After seeing @idegtiarenko 's comment, I'm removing my approval, just to confirm the implications around thread pool is OK.

@original-brownbear , checking also other actions, I see that thread pool is indeed passed around a lot, even if there's a client argument. I am unaware of why there's both passed, if conceptually we could have taken the thread pool from the client. I just would like to ensure it's not a problem as well. I cannot think of any problems at the moment, only that perhaps the thread pools might be different (a different one is passed, different than the client's), but I'm not sure that's happening anywhere?

kingherc
kingherc previously approved these changes Jan 15, 2024
Copy link
Contributor

@kingherc kingherc left a comment

Choose a reason for hiding this comment

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

LGTM but it's hard for me to understand from this PR where the previous threadPool argument was coming from in all the involved actions, so I trust you @original-brownbear when saying it's equivalent to use the client's thread pool. If you're not 100% certain, please tell me to look further or seek more reviewers.

@@ -167,7 +161,7 @@ public abstract class AbstractAsyncBulkByScrollAction<
this.logger = logger;
this.searchClient = searchClient;
this.bulkClient = bulkClient;
this.threadPool = threadPool;
this.threadPool = searchClient.threadPool();
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to add an assertion that their thread pools are the same just to ensure

@@ -53,7 +53,6 @@ public TransportEnrichReindexAction(
super(
EnrichReindexAction.NAME,
settings,
threadPool,
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove it from the constructor as well then?

@kingherc kingherc dismissed their stale review January 16, 2024 08:59

Removing approval until we're completely sure we should access the thread pool from the client

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

There is only one threadpool instance in a production node. However, I think it's a bug that the Client carries a threadpool along with it, I've been looking at removing that dependency, so I'd rather not add more usages as suggested here. Let's keep on passing it around explicitly please.

@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Reindex Issues relating to reindex that are not caused by issues further down >non-issue Team:Distributed Indexing Meta label for Distributed Indexing team Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants