-
Notifications
You must be signed in to change notification settings - Fork 624
HDDS-11380. Fixing the error message of node decommission to be more comprehensive #7155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b7adbd5
HDDS-11380. Fixing the error message of node decommission to be more …
VarshaRaviCV 314313b
Fixing the error message based on review comments
VarshaRaviCV cad5208
Making changes based on review comments
VarshaRaviCV 608b9eb
Change the unhealthy keyword to not in-service or not healthy
VarshaRaviCV cbd007f
Adding node count assertions for decomm and maintenance in existing t…
VarshaRaviCV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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()); | ||
| 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"); | ||
|
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"); | ||
|
VarshaRaviCV marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
|
|
||
|
|
@@ -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 + | ||
|
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; | ||
|
|
@@ -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"); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -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 + | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.