ivandika3 commented on code in PR #6960:
URL: https://github.com/apache/ozone/pull/6960#discussion_r1760774709
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -447,6 +449,8 @@ public RegisteredCommand register(
processNodeReport(datanodeDetails, nodeReport);
LOG.info("Updated datanode to: {}", dn);
scmNodeEventPublisher.fireEvent(SCMEvents.NODE_ADDRESS_UPDATE, dn);
+ } else if (isVersionChange(oldNode.getVersion(),
datanodeDetails.getVersion())) {
+ nodeStateManager.updateNode(datanodeDetails, layoutInfo);
Review Comment:
Seems this change is not really related to the SCM WebUI improvement since
this will trigger the change of the layout version. Not really sure if we can
simply changing the layout version DN is supposed to trigger SCM to update the
layout version for the particular DN.
Seems this will also get rejected by the previous validation.
```java
if (layoutInfo.getSoftwareLayoutVersion() !=
scmLayoutVersionManager.getSoftwareLayoutVersion()) {
return RegisteredCommand.newBuilder()
.setErrorCode(ErrorCode.errorNodeNotPermitted)
.setDatanode(datanodeDetails)
.setClusterID(this.scmStorageConfig.getClusterID())
.build();
}
```
I think it's better to address this in another ticket? Maybe need @errose28
input for this case.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -508,6 +512,18 @@ private boolean updateDnsToUuidMap(
return ipChanged || hostNameChanged;
}
+ /**
+ * Check if the version has been updated.
+ *
+ * @param oldVersion datanode oldVersion
+ * @param newVersion datanode newVersion
+ * @return true means replacement is needed, while false means replacement
is not needed.
+ */
+ private boolean isVersionChange(String oldVersion, String newVersion) {
+ final boolean ipChanged = !Objects.equals(oldVersion, newVersion);
+ return ipChanged;
+ }
Review Comment:
From the previous comment, IMO we can address this in another ticket. Also
`ipChanged` should be `versionChanged`.
##########
hadoop-hdds/server-scm/src/main/resources/webapps/scm/scm-overview.html:
##########
@@ -235,6 +237,34 @@ <h2>Meta-Data Volume Information</h2>
</tbody>
</table>
+<h2 ng-show="$ctrl.overview.jmx.RatisRoles.length > 1">SCM Roles (HA)</h2>
Review Comment:
From my previous comment regarding re-adding the line
`<h4 ng-show="$ctrl.overview.jmx.RatisRoles.length == 1 &&
$ctrl.overview.jmx.RatisRoles[0].length ==
1">{{$ctrl.overview.jmx.RatisRoles[0][0]}}</h4>`
We can also remove the conditional since to still show the header even
during exception.
```suggestion
<h2>SCM Roles (HA)</h2>
```
We can basically copy the implementation for OM HA UI.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java:
##########
@@ -2137,6 +2142,74 @@ public String getScmRatisRoles() {
HddsUtils.format(server.getRatisRoles()) : "STANDALONE";
}
+ @Override
+ public List<List<String>> getRatisRoles() {
+ final SCMRatisServer server = getScmHAManager().getRatisServer();
+
+ // If Ratis is enabled
+ if (server != null) {
Review Comment:
Nit: let's reduce nesting by moving the "Ratis is disabled" at the start.
```suggestion
// If Ratis is disabled
if (server == null) {
return getRatisRolesException("Ratis is disabled")
}
...
```
##########
hadoop-hdds/server-scm/src/main/resources/webapps/scm/scm-overview.html:
##########
@@ -153,6 +155,35 @@ <h2>Meta-Data Volume Information</h2>
</tbody>
</table>
+<h2>SCM Roles (HA)</h2>
+<h4 ng-show="$ctrl.overview.jmx.RatisRoles.length == 1 &&
$ctrl.overview.jmx.RatisRoles[0].length ==
1">{{$ctrl.overview.jmx.RatisRoles[0][0]}}</h4>
Review Comment:
> I carefully readed both the SCM and OM code, and found that integrating
OzoneManager#getRatisRoles with StorageContainerManager#getRatisRoles is not
very straightforward.
Thanks for addressing the review. I think the latest change is fine, there
is no need to completely reduce duplication, standardizing the implementation
should be fine.
Now that `getRatisRoles` returns an exception in case of some exception, I
think this line does not need to be removed.
`<h4 ng-show="$ctrl.overview.jmx.RatisRoles.length == 1 &&
$ctrl.overview.jmx.RatisRoles[0].length ==
1">{{$ctrl.overview.jmx.RatisRoles[0][0]}}</h4>`
This line will print the exception in case the SCM service is a STANDALONE
cluster.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMMXBean.java:
##########
@@ -74,6 +75,8 @@ public interface SCMMXBean extends ServiceRuntimeInfo {
String getScmRatisRoles();
+ List<List<String>> getRatisRoles();
Review Comment:
`getScmRatisRoles` seems to be only used for UI so I think we can replace
`getScmRatisRoles` with `getRatisRoles`.
--
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]