dombizita commented on code in PR #10570:
URL: https://github.com/apache/ozone/pull/10570#discussion_r3588449045
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeManager.java:
##########
@@ -197,6 +198,31 @@ default DatanodeFinalizationCounts
getDatanodeFinalizationCounts() {
return new DatanodeFinalizationCounts(finalizedNodes, totalHealthyNodes);
}
+ /**
+ * Returns the lowest apparent (finalized) version among the given datanodes,
+ * so every node involved in an operation uses the same, mutually-supported
+ * version.
+ *
+ * @throws NodeNotFoundException if SCM has no record of one of the nodes;
+ * callers must not proceed with an operation involving a node SCM does
+ * not know about.
+ */
+ default HDDSVersion getLowestApparentVersion(DatanodeDetails... nodes)
+ throws NodeNotFoundException {
+ HDDSVersion lowest = HDDSVersion.SOFTWARE_VERSION;
+ for (DatanodeDetails dn : nodes) {
+ DatanodeInfo info = getDatanodeInfo(dn);
+ if (info == null) {
+ throw new NodeNotFoundException(dn.getID());
+ }
+ HDDSVersion version = info.getApparentHddsVersion();
+ if (version.serialize() < lowest.serialize()) {
Review Comment:
Added `ComponentVersion.min(ComponentVersion...)` method.
--
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]