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

IGNITE-22118 Explicitly specify pool to execute start/stop on IgniteComponent #3784

Merged
merged 9 commits into from
May 27, 2024

Conversation

Cyrill
Copy link
Contributor

@Cyrill Cyrill commented May 17, 2024

https://issues.apache.org/jira/browse/IGNITE-22118

Added ExecutorService to IgniteComponent.startAsync and IgniteComponent.stopAsync. Any async part of start/stop is expected to run in the corresponding thread pool.
This PR is mostly the change of method signature, only a few components had their startAsync methods changed.
The ones that were changed:

  • CatalogManagerImpl
  • DistributionZoneManager (This one was partially changed. The complete transition to async start should be done in a separate task, due to the complexity of the component's startup)

* @return Future that will be completed when the asynchronous part of the start is processed.
*/
CompletableFuture<Void> startAsync();
CompletableFuture<Void> startAsync(ExecutorService startupExecutor);
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to pass something like ComponentContext instead of executor, which should provides executorservice and whatever we want later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

return updateLog.startAsync()
.thenCompose(none -> {
return updateLog.startAsync(startupExecutor)
.thenComposeAsync(none -> {
if (latestCatalogVersion() == emptyCatalog.version()) {
int initializedCatalogVersion = emptyCatalog.version() + 1;

Copy link
Contributor

Choose a reason for hiding this comment

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

Which thread will complete catalogReadyFuture?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Explicitly set to the startupExecutor pool

*
* @return Future that will be completed when the asynchronous part of the stop is processed.
*/
default CompletableFuture<Void> stopAsync() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's required for micronaut annotations on TestFactory to work.
If we are not okay with this method I can spend some time rewriting tests instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's either rewrite the tests or mark the method as TestOnly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

marked as TestOnly

@sanpwc sanpwc merged commit 061c872 into apache:main May 27, 2024
1 check passed
@Cyrill Cyrill deleted the IGNITE-22118 branch May 27, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants