sergey-chugunov-1985 commented on code in PR #13238:
URL: https://github.com/apache/ignite/pull/13238#discussion_r3504779591
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/BaselineTopology.java:
##########
@@ -274,6 +276,20 @@ public Map<String, Object> attributes(Object consId) {
return nodeMap.get(consId);
}
+ /**
+ * Calculates number of datacenters presented in current baseline.
+ *
+ * @return Number of datacenters presented in the baseline or {@code -1}
if unknown.
+ */
+ public int numberOfDatacenters() {
+ Collection<Map<String, Object>> allNodesAttrs = nodeMap.values();
+
+ if (!allNodesAttrs.isEmpty() &&
allNodesAttrs.iterator().next().get(ATTR_DATA_CENTER_ID) != null)
+ return (int)allNodesAttrs.stream().map(m ->
m.get(ATTR_DATA_CENTER_ID)).distinct().count();
+
+ return -1;
Review Comment:
I don't consider this comment as valid because we have a validation at node
join moment which guarantees that either all server nodes in the cluster have
DC_ID attribute configured or none of them.
--
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]