yandrey321 commented on code in PR #10842:
URL: https://github.com/apache/ozone/pull/10842#discussion_r3685493472
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/protocol/DatanodeDetails.java:
##########
@@ -384,9 +385,27 @@ public synchronized boolean hasPort(Port.Name name) {
return false;
}
+ /**
+ * Whether this datanode's exposed ports differ from {@code other}'s.
+ * Compared as a set of name=value entries, since {@link Port#equals}
+ * ignores the port value.
+ *
+ * @param other another snapshot of this datanode
+ * @return true if the two port sets are not identical
+ */
+ public boolean portsChanged(DatanodeDetails other) {
+ return !portValues(this).equals(portValues(other));
+ }
+
+ private static Set<String> portValues(DatanodeDetails datanodeDetails) {
+ return datanodeDetails.getPorts().stream()
+ .map(port -> port.getName() + "=" + port.getValue())
+ .collect(Collectors.toSet());
Review Comment:
I'll fix it as part of
[HDDS-16043](https://issues.apache.org/jira/browse/HDDS-16043)
--
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]