Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
[BZ 1272328] Allow undeploy of maintenance mode storageNode if other …
Browse files Browse the repository at this point in the history
…nodes are not waiting for maintenance
  • Loading branch information
Michael Burman authored and Simeon Pinder committed Jan 31, 2017
1 parent f2b9b7a commit 0f0e7f5
Showing 1 changed file with 15 additions and 0 deletions.
Expand Up @@ -343,12 +343,27 @@ public void undeployStorageNode(Subject subject, StorageNode storageNode) {
storageNodeManager.resetInNewTransaction();
storageNodeOperationsHandler.uninstall(subject, storageNode);
break;
case MAINTENANCE:
storageNodeManager.resetInNewTransaction();
if(isMaintenanceCompleted(storageNode)) {
storageNodeOperationsHandler.decommissionStorageNode(subject, storageNode);
}
break;
default:
// TODO what do we do with/about maintenance mode
throw new RuntimeException("Cannot undeploy " + storageNode);
}
}

private boolean isMaintenanceCompleted(StorageNode storageNode) {
for (StorageNode node : getClusterNodes()) {
if(!node.equals(storageNode) && (node.isMaintenancePending() || node.getOperationMode() == OperationMode.MAINTENANCE)) {
return false;
}
}
return true;
}

@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void resetInNewTransaction() {
Expand Down

0 comments on commit 0f0e7f5

Please sign in to comment.