-
Notifications
You must be signed in to change notification settings - Fork 620
HDDS-15715. Add helpful CLI flags to finalization CLIs #10678
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
base: HDDS-14496-zdu
Are you sure you want to change the base?
Changes from 3 commits
1e897ff
aa874a8
a90ae08
2468e4a
a681033
2207f8d
01d7035
cee0669
f1468a0
928dce6
5424316
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,6 +154,8 @@ default int getAllNodeCount() { | |
| default DatanodeFinalizationCounts getDatanodeFinalizationCounts() { | ||
| int finalizedNodes = 0; | ||
| int totalHealthyNodes = 0; | ||
| int minApparentVersion = 0; | ||
|
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. This should either be initialized to
Contributor
Author
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. Nice catch, changed it and added unit test for it. If there is no healthy DN reporting apparent versions it is changed to 0 in the end. |
||
| int maxApparentVersion = 0; | ||
|
|
||
| for (DatanodeDetails dn : getAllNodes()) { | ||
| try { | ||
|
|
@@ -180,6 +182,14 @@ default DatanodeFinalizationCounts getDatanodeFinalizationCounts() { | |
| ComponentVersion dnApparentVersion = datanodeInfo.getLastKnownApparentVersion(); | ||
| ComponentVersion dnSoftwareVersion = datanodeInfo.getLastKnownSoftwareVersion(); | ||
|
|
||
| int dnApparentVersionInt = dnApparentVersion.serialize(); | ||
| if (dnApparentVersionInt < minApparentVersion) { | ||
| minApparentVersion = dnApparentVersionInt; | ||
| } | ||
| if (dnApparentVersionInt > maxApparentVersion) { | ||
| maxApparentVersion = dnApparentVersionInt; | ||
| } | ||
|
errose28 marked this conversation as resolved.
Outdated
|
||
|
|
||
| if (!dnApparentVersion.equals(dnSoftwareVersion)) { | ||
| // Datanode has not yet finalized | ||
| LOG.debug("Datanode {} has not yet finalized: apparent version={}, software version={}", | ||
|
|
@@ -194,7 +204,8 @@ default DatanodeFinalizationCounts getDatanodeFinalizationCounts() { | |
| } | ||
| } | ||
|
|
||
| return new DatanodeFinalizationCounts(finalizedNodes, totalHealthyNodes); | ||
| return new DatanodeFinalizationCounts(finalizedNodes, totalHealthyNodes, | ||
| minApparentVersion, maxApparentVersion); | ||
|
errose28 marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -489,11 +500,17 @@ default void removeNode(DatanodeDetails datanodeDetails) throws NodeNotFoundExce | |
| final class DatanodeFinalizationCounts { | ||
| private final int numFinalizedDatanodes; | ||
| private final int totalHealthyDatanodes; | ||
| private final int minApparentVersion; | ||
| private final int maxApparentVersion; | ||
|
|
||
| public DatanodeFinalizationCounts(int numFinalizedDatanodes, | ||
| int totalHealthyDatanodes) { | ||
| int totalHealthyDatanodes, | ||
| int minApparentVersion, | ||
| int maxApparentVersion) { | ||
| this.numFinalizedDatanodes = numFinalizedDatanodes; | ||
| this.totalHealthyDatanodes = totalHealthyDatanodes; | ||
| this.minApparentVersion = minApparentVersion; | ||
| this.maxApparentVersion = maxApparentVersion; | ||
| } | ||
|
|
||
| public int getNumFinalizedDatanodes() { | ||
|
|
@@ -507,5 +524,13 @@ public int getTotalHealthyDatanodes() { | |
| public boolean allNodesFinalized() { | ||
| return numFinalizedDatanodes == totalHealthyDatanodes; | ||
| } | ||
|
|
||
| public Integer getMinApparentVersion() { | ||
|
errose28 marked this conversation as resolved.
Outdated
|
||
| return minApparentVersion; | ||
| } | ||
|
|
||
| public Integer getMaxApparentVersion() { | ||
| return maxApparentVersion; | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.