mirror of https://github.com/apache/nifi.git
NIFI-3295 - ensures node is disconnected before trying to remove it. This closes #1444
This commit is contained in:
parent
e113511fef
commit
1a6802a016
|
@ -49,6 +49,7 @@ import org.apache.nifi.cluster.coordination.node.DisconnectionCode;
|
|||
import org.apache.nifi.cluster.coordination.node.NodeConnectionState;
|
||||
import org.apache.nifi.cluster.coordination.node.NodeConnectionStatus;
|
||||
import org.apache.nifi.cluster.event.NodeEvent;
|
||||
import org.apache.nifi.cluster.manager.exception.IllegalNodeDeletionException;
|
||||
import org.apache.nifi.cluster.manager.exception.UnknownNodeException;
|
||||
import org.apache.nifi.cluster.protocol.NodeIdentifier;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
|
@ -3335,6 +3336,11 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
|
|||
throw new UnknownNodeException("Cannot remove Node with ID " + nodeId + " because it is not part of the cluster");
|
||||
}
|
||||
|
||||
final NodeConnectionStatus nodeConnectionStatus = clusterCoordinator.getConnectionStatus(nodeIdentifier);
|
||||
if (!nodeConnectionStatus.getState().equals(NodeConnectionState.DISCONNECTED)) {
|
||||
throw new IllegalNodeDeletionException("Cannot remove Node with ID " + nodeId + " because it is not disconnected, current state = " + nodeConnectionStatus.getState());
|
||||
}
|
||||
|
||||
clusterCoordinator.removeNode(nodeIdentifier, userDn);
|
||||
heartbeatMonitor.removeHeartbeat(nodeIdentifier);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue