ascherbakoff commented on a change in pull request #6942: IGNITE-9913
URL: https://github.com/apache/ignite/pull/6942#discussion_r334228120
 
 

 ##########
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
 ##########
 @@ -1798,6 +1799,24 @@ public int size() {
         return resolveDiscoCache(CU.cacheId(null), topVer).baselineNodes();
     }
 
+    /**
+     * Compares baselines at different topologies.
+     *
+     * @param topVer1 Topology version 1.
+     * @param topVer2 Topology version 2.
+     */
+    public boolean baselineChanged(AffinityTopologyVersion topVer1, 
AffinityTopologyVersion topVer2) {
+        assert !topVer1.equals(topVer2);
+
+        DiscoCache disco1 = discoCache(topVer1);
+        DiscoCache disco2 = discoCache(topVer2);
+
+        BaselineTopology baseline1 = disco1 != null ? 
disco1.state().baselineTopology() : null;
+        BaselineTopology baseline2 = disco2 != null ? 
disco2.state().baselineTopology() : null;
+
+        return !Objects.equals(baseline1, baseline2);
+    }
+
 
 Review comment:
   Looks like we only care about baseline change comparing to previous version. 
Better to add a flag to DiscoCache indicating what baseline is changed 
comparing to previous version and get rid of internal collections comparison.
   See 
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager#createDiscoCache.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to