From 3034f2637a99dca92fc7ab200e7d8a938f57916f Mon Sep 17 00:00:00 2001 From: greyp9 Date: Wed, 13 Apr 2022 13:44:28 -0400 Subject: [PATCH] NIFI-9893 - Ensure orderly cluster node removal on node delete via UI (#5946) --- .../cluster/coordination/node/NodeClusterCoordinator.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java index c0034ce492..19678ed1db 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java @@ -613,11 +613,12 @@ public class NodeClusterCoordinator implements ClusterCoordinator, ProtocolHandl @Override public void removeNode(final NodeIdentifier nodeId, final String userDn) { + // Remove the node from the cluster state before any notifications are sent to the cluster participants. This + // ensures that potential communication failures do not cause the operation to fail. + removeNode(nodeId); + storeState(); reportEvent(nodeId, Severity.INFO, "User " + userDn + " requested that node be removed from cluster"); notifyOthersOfNodeStatusChange(new NodeConnectionStatus(nodeId, NodeConnectionState.REMOVED)); - removeNode(nodeId); - - storeState(); } private void onNodeRemoved(final NodeIdentifier nodeId) {