rpuch commented on code in PR #1604:
URL: https://github.com/apache/ignite-3/pull/1604#discussion_r1094423789
##########
modules/cluster-management/src/main/java/org/apache/ignite/internal/cluster/management/ClusterManagementGroupManager.java:
##########
@@ -664,6 +679,26 @@ private void sendWithRetry(ClusterNode node,
NetworkMessage msg, CompletableFutu
});
}
+ @Override
+ public void beforeNodeStop() {
+ CompletableFuture<CmgRaftService> serviceFuture = raftService;
+
+ if (serviceFuture != null) {
+ tryToLeaveLogicalTopologyGracefully(serviceFuture);
+ }
+ }
+
+ private void
tryToLeaveLogicalTopologyGracefully(CompletableFuture<CmgRaftService>
serviceFuture) {
+ serviceFuture.thenCompose(service ->
service.removeFromCluster(Set.of(clusterService.topologyService().localMember())))
+ .orTimeout(GRACEFUL_LEAVE_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS)
+ .exceptionally(ex -> {
+ LOG.info("Was not able to send a bye-bye in time", ex);
+
+ return null;
+ })
+ .join();
Review Comment:
We probably want to give the 'bye-bye' message a chance to be delivered. If
we don't wait, we could cut ourselves from RAFT services (or even network),
which would prevent it to be delivered. We'll wait for at most 1 second, this
does not seem too bad.
WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]