Skip to content

Refactor: remove coreContainerWorkExecutor #3405

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 4 commits into
base: main
Choose a base branch
from

Conversation

dsmiley
Copy link
Contributor

@dsmiley dsmiley commented Jun 25, 2025

It's only used for one silly thing:
It's needless to create an executor just to asynchronously wait for another executor (coreLoadExecutor) to close. We can instead call shutdownAndAwaitTermination on coreLoadExecutor when the container shuts down.

It's only used for one silly thing:
It's needless to create an executor just to asynchronously wait for another executor (coreLoadExecutor) to close.  We can instead call shutdownAndAwaitTermination on coreLoadExecutor when the container shuts down.
@dsmiley dsmiley requested a review from HoustonPutman June 25, 2025 19:19
@github-actions github-actions bot added the tests label Jun 26, 2025
@@ -1362,7 +1347,7 @@ public void shutdown() {
zkSys.zkController.tryCancelAllElections();
}

ExecutorUtil.shutdownAndAwaitTermination(coreContainerWorkExecutor);
ExecutorUtil.shutdownAndAwaitTermination(coreLoadExecutor);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not harmful, but I'm not sure why we have to shutdown the executor once again here, since we systematically call shutdown() in the loadInternal() method.

The only case where we want to wait for its completion here is when the Solr server is being stopped before all core loads completed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh right; I should change this to awaitTermination. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But it's harmless to call shutdown again. And it's more normal to see this method call here. Only seeing awaitTermination is unusual... the reader will wonder what's going on. If I change it, I suggest then 4 lines of code:

      if (coreLoadExecutor != null) {
        assert coreLoadExecutor.isShutdown(); // set in a finally part of loadInternal
        ExecutorUtil.awaitTermination(coreLoadExecutor);
      }

Which I think is too much so lets keep this?

Copy link
Contributor

Choose a reason for hiding this comment

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

The assert might fail if we shutdown the CoreContainer before loadInternal() completed, isn't it? I don't know if this scenario may happen in practice.

But it's harmless to call shutdown again. And it's more normal to see this method call here. Only seeing awaitTermination is unusual..

Agreed! I would just add a comment that most of the time, this executor should be already stopped when we reach this statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants