-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
base: main
Are you sure you want to change the base?
Remove some unused dependencies from Reindex transport actions #104307
Conversation
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.
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(); |
There was a problem hiding this comment.
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()
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this 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(); |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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?
Removing approval until we're completely sure we should access the thread pool from the client
There was a problem hiding this 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.
Pinging @elastic/es-distributed-obsolete (Team:Distributed (Obsolete)) |
Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing) |
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.