-
Notifications
You must be signed in to change notification settings - Fork 90
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-22241 Make ClusterManagementGroupManager extensible #3756
Conversation
** Introduced ClusterManagerGroupEvents event to ClusterManagementGroup.
Hey @rpuch and @sashapolo, would you mind having a look at these changes? |
@@ -434,6 +441,12 @@ private void handleCancelInit(CancelInitMessage msg) { | |||
* Completely destroys the local CMG Raft service. | |||
*/ | |||
private void destroyCmg() { | |||
try { | |||
fireEvent(ClusterManagerGroupEvent.BEFORE_RAFT_GROUP_DESTROY, EmptyEventParams.INSTANCE).join(); |
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.
It's better to use get
with a timeout. Also, this method is called inside a network thread, we should probably dispatch it onto a thread pool or make it asynchronous.
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 have a few doubts about this suggestion.
Currently, the destroyCmg
method runs and blocks the same thread as the message handler. I believe this is what you called network thread.
When you say to put it on a thread pool or make it asynchronous are you suggesting that we don't wait for the destroy to finish, i.e. let it run in the background without calling get
or join
since it would still block the network thread??
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.
How about not using get/join at all? Just collect the listeners' futures to one using CompletableFuture#allOf()
and than on that aggregated future make .thenRun()
doing the rest of the method; destroyCmg()
would return a CompletableFuture
as well; the code that calls it and needs to execute some logic strictly after the CMG has been destroyed can just chain on the future it returns.
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.
Currently, there's no code after destoryCmg
just the error handling message and the busyLock unlock.
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.
In handleClusterState()
, there is a call to destroyCmg()
, and there is a initCmgRaftService(state)
call that probably relies on the CMG being destroyed at the moment when it's made.
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.
Yeah, I saw that afterwards. Missed that one on the first iteration.
...main/java/org/apache/ignite/internal/cluster/management/events/ClusterManagerGroupEvent.java
Outdated
Show resolved
Hide resolved
...main/java/org/apache/ignite/internal/cluster/management/events/ClusterManagerGroupEvent.java
Outdated
Show resolved
Hide resolved
...main/java/org/apache/ignite/internal/cluster/management/events/ClusterManagerGroupEvent.java
Outdated
Show resolved
Hide resolved
...ent/src/main/java/org/apache/ignite/internal/cluster/management/events/EmptyEventParams.java
Outdated
Show resolved
Hide resolved
...ent/src/main/java/org/apache/ignite/internal/cluster/management/events/EmptyEventParams.java
Outdated
Show resolved
Hide resolved
...rg/apache/ignite/internal/cluster/management/events/BeforeStartRaftGroupEventParameters.java
Outdated
Show resolved
Hide resolved
...rg/apache/ignite/internal/cluster/management/events/BeforeStartRaftGroupEventParameters.java
Outdated
Show resolved
Hide resolved
** Renamed EmptyEventParameters ** Renamed BEFORE_RAFT_GROUP_DESTROY to BEFORE_DESTROY_RAFT_GROUP ** Replaced HashSet::new in favour ot Set::copyOf
...c/main/java/org/apache/ignite/internal/cluster/management/ClusterManagementGroupManager.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/ignite/internal/cluster/management/ClusterManagementGroupManager.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/ignite/internal/cluster/management/ClusterManagementGroupManager.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/ignite/internal/cluster/management/ClusterManagementGroupManager.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/ignite/internal/cluster/management/ClusterManagementGroupManager.java
Outdated
Show resolved
Hide resolved
** Removed helper function to convert Consumer to Function ** Replaced handle with whenComplete in destroyCmgWithEvents future ** Start calling desctroyCmg() in the scheduledThreadPool
** They are no longer needed. #fixes (73779cb) Start handling ClusterManagementGroupManager in an async way
** Most of the changes are updating dependencies in tests. It would be great to have DI or fixtures for not replicating so much and be more consistent across tests.
Thank you for submitting the pull request.
To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:
The Review Checklist
- There is a single JIRA ticket related to the pull request.
- The web-link to the pull request is attached to the JIRA ticket.
- The JIRA ticket has the Patch Available state.
- The description of the JIRA ticket explains WHAT was made, WHY and HOW.
- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
Notes