Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@ private boolean preChecksSuccess(DatanodeDetails nodeByUuid, Map<String, String>
AtomicBoolean isContainerOrPipeLineOpen = new AtomicBoolean(false);
try {
nodeStatus = nodeManager.getNodeStatus(nodeByUuid);
boolean isNodeDecommissioned = nodeByUuid.getPersistedOpState() == NodeOperationalState.DECOMMISSIONED;
if (isNodeDecommissioned || nodeStatus.isDead()) {
if (nodeStatus.isDead()) {
checkContainers(nodeByUuid, isContainerOrPipeLineOpen);
if (isContainerOrPipeLineOpen.get()) {
failedNodeErrorResponseMap.put(nodeByUuid.getUuidString(), "Open Containers/Pipelines");
Expand All @@ -298,8 +297,7 @@ private boolean preChecksSuccess(DatanodeDetails nodeByUuid, Map<String, String>
LOG.error("Node : {} not found", nodeByUuid);
return false;
}
failedNodeErrorResponseMap.put(nodeByUuid.getUuidString(), "DataNode should be in either DECOMMISSIONED " +
"operational state or DEAD node state.");
failedNodeErrorResponseMap.put(nodeByUuid.getUuidString(), "DataNode should be in DEAD node status.");
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1281,9 +1281,10 @@ public void testExplicitRemovalOfDecommissionedNode() throws Exception {
(RemoveDataNodesResponseWrapper) removedDNResponse.getEntity();
DatanodesResponse errorDataNodes = removeDataNodesResponseWrapper.getDatanodesResponseMap().get("failedDatanodes");
DatanodesResponse removedNodes = removeDataNodesResponseWrapper.getDatanodesResponseMap().get("removedDatanodes");
assertEquals(1, removedNodes.getTotalCount());
assertNull(errorDataNodes);
removedNodes.getDatanodes().forEach(datanodeMetadata -> {

assertEquals(1, errorDataNodes.getTotalCount());
assertNull(removedNodes);
errorDataNodes.getDatanodes().forEach(datanodeMetadata -> {
assertEquals("host3.datanode", datanodeMetadata.getHostname());
});
}
Expand All @@ -1301,7 +1302,7 @@ public void testExplicitRemovalOfInvalidStateNode() {
assertFalse(failedNodeErrorResponseMap.isEmpty());
String nodeError = failedNodeErrorResponseMap.get(dnUUID);
assertNotNull(nodeError);
assertEquals("DataNode should be in either DECOMMISSIONED operational state or DEAD node state.", nodeError);
assertEquals("DataNode should be in DEAD node status.", nodeError);
assertEquals(Response.Status.OK.getStatusCode(), removedDNResponse.getStatus());
}

Expand Down