fmorg-git commented on code in PR #12137:
URL: https://github.com/apache/ozone/pull/12137#discussion_r4675007041


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeManager.java:
##########
@@ -177,22 +177,25 @@ default DatanodeFinalizationCounts 
getDatanodeFinalizationCounts() {
 
         ComponentVersion dnApparentVersion = dn.getLastKnownApparentVersion();
         ComponentVersion dnSoftwareVersion = dn.getLastKnownSoftwareVersion();
+        boolean softwareVersionMatchesScm = 
HDDSVersion.SOFTWARE_VERSION.equals(dnSoftwareVersion);
 
         int dnApparentVersionInt = dnApparentVersion.serialize();
         minApparentVersion = Math.min(minApparentVersion, 
dnApparentVersionInt);
         maxApparentVersion = Math.max(maxApparentVersion, 
dnApparentVersionInt);
 
-        if (!dnApparentVersion.equals(dnSoftwareVersion)) {
-          // Datanode has not yet finalized
-          LOG.debug("Datanode {} has not yet finalized: apparent version={}, 
software version={}",
-              dn.getHostName(), dnApparentVersion, dnSoftwareVersion);
-        } else {
+        // A datanode is counted as finalized only if it's software and 
apparent versions match each other

Review Comment:
   ```suggestion
           // A datanode is counted as finalized only if its software and 
apparent versions match each other
   ```



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeManager.java:
##########
@@ -177,22 +177,25 @@ default DatanodeFinalizationCounts 
getDatanodeFinalizationCounts() {
 
         ComponentVersion dnApparentVersion = dn.getLastKnownApparentVersion();
         ComponentVersion dnSoftwareVersion = dn.getLastKnownSoftwareVersion();
+        boolean softwareVersionMatchesScm = 
HDDSVersion.SOFTWARE_VERSION.equals(dnSoftwareVersion);
 
         int dnApparentVersionInt = dnApparentVersion.serialize();
         minApparentVersion = Math.min(minApparentVersion, 
dnApparentVersionInt);
         maxApparentVersion = Math.max(maxApparentVersion, 
dnApparentVersionInt);
 
-        if (!dnApparentVersion.equals(dnSoftwareVersion)) {
-          // Datanode has not yet finalized
-          LOG.debug("Datanode {} has not yet finalized: apparent version={}, 
software version={}",
-              dn.getHostName(), dnApparentVersion, dnSoftwareVersion);
-        } else {
+        // A datanode is counted as finalized only if it's software and 
apparent versions match each other
+        // and SCM's software version
+        if (softwareVersionMatchesScm && 
dnApparentVersion.equals(dnSoftwareVersion)) {
           finalizedNodes++;
+        } else {
+          LOG.debug("Datanode {} has not yet finalized: apparent version={}, 
software version={}, " +

Review Comment:
   nit: should there be a check if `LOG` is debugEnabled?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to