Skip to content
Merged
Changes from 2 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 @@ -391,17 +391,21 @@ private synchronized boolean checkIfDecommissionPossible(List<DatanodeDetails> d
int numDecom = dns.size();
List<DatanodeDetails> validDns = new ArrayList<>(dns);
int inServiceTotal = nodeManager.getNodeCount(NodeStatus.inServiceHealthy());
int unHealthyTotal = nodeManager.getNodeCount(NodeStatus.inServiceStale()) +
nodeManager.getNodeCount(NodeStatus.inServiceDead());
Comment thread
VarshaRaviCV marked this conversation as resolved.
Outdated
for (DatanodeDetails dn : dns) {
try {
NodeStatus nodeStatus = getNodeStatus(dn);
NodeOperationalState opState = nodeStatus.getOperationalState();
if (opState != NodeOperationalState.IN_SERVICE) {
numDecom--;
validDns.remove(dn);
LOG.warn("Cannot decommission " + dn.getHostName() + " because it is not IN-SERVICE");
Comment thread
VarshaRaviCV marked this conversation as resolved.
Outdated
}
} catch (NodeNotFoundException ex) {
numDecom--;
validDns.remove(dn);
LOG.warn("Cannot decommission " + dn.getHostName() + " because it is not found in SCM");
Comment thread
VarshaRaviCV marked this conversation as resolved.
Outdated
}
}

Expand Down Expand Up @@ -431,8 +435,9 @@ private synchronized boolean checkIfDecommissionPossible(List<DatanodeDetails> d
int reqNodes = cif.getReplicationConfig().getRequiredNodes();
if ((inServiceTotal - numDecom) < reqNodes) {
String errorMsg = "Insufficient nodes. Tried to decommission " + dns.size() +
" nodes of which " + numDecom + " nodes were valid. Cluster has " + inServiceTotal +
" IN-SERVICE nodes, " + reqNodes + " of which are required for minimum replication. ";
" nodes out of " + inServiceTotal + " IN-SERVICE HEALTHY and " + unHealthyTotal +
" UNHEALTHY nodes. Cannot decommission as a minimum of " + reqNodes +
Comment thread
VarshaRaviCV marked this conversation as resolved.
Outdated
" IN-SERVICE HEALTHY nodes are required to maintain replication after decommission. ";
LOG.info(errorMsg + "Failing due to datanode : {}, container : {}", dn, cid);
errors.add(new DatanodeAdminError("AllHosts", errorMsg));
return false;
Expand Down Expand Up @@ -545,17 +550,21 @@ private synchronized boolean checkIfMaintenancePossible(List<DatanodeDetails> dn
List<DatanodeDetails> validDns = dns.stream().collect(Collectors.toList());
Collections.copy(validDns, dns);
int inServiceTotal = nodeManager.getNodeCount(NodeStatus.inServiceHealthy());
int unHealthyTotal = nodeManager.getNodeCount(NodeStatus.inServiceStale()) +
nodeManager.getNodeCount(NodeStatus.inServiceDead());
for (DatanodeDetails dn : dns) {
try {
NodeStatus nodeStatus = getNodeStatus(dn);
NodeOperationalState opState = nodeStatus.getOperationalState();
if (opState != NodeOperationalState.IN_SERVICE) {
numMaintenance--;
validDns.remove(dn);
LOG.warn(dn.getHostName() + " cannot enter maintenance because it is not IN-SERVICE");
}
} catch (NodeNotFoundException ex) {
numMaintenance--;
validDns.remove(dn);
LOG.warn(dn.getHostName() + " cannot enter maintenance because it is not found in SCM");
}
}

Expand Down Expand Up @@ -595,8 +604,9 @@ private synchronized boolean checkIfMaintenancePossible(List<DatanodeDetails> dn
}
if ((inServiceTotal - numMaintenance) < minInService) {
String errorMsg = "Insufficient nodes. Tried to start maintenance for " + dns.size() +
" nodes of which " + numMaintenance + " nodes were valid. Cluster has " + inServiceTotal +
" IN-SERVICE nodes, " + minInService + " of which are required for minimum replication. ";
" nodes out of " + inServiceTotal + " IN-SERVICE HEALTHY and " + unHealthyTotal +
" UNHEALTHY nodes. Cannot enter maintenance mode as a minimum of " + minInService +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same suggestions as above

" IN-SERVICE HEALTHY nodes are required to maintain replication after maintenance. ";
LOG.info(errorMsg + "Failing due to datanode : {}, container : {}", dn, cid);
errors.add(new DatanodeAdminError("AllHosts", errorMsg));
return false;
Expand Down