sergey-chugunov-1985 commented on code in PR #13238:
URL: https://github.com/apache/ignite/pull/13238#discussion_r3527478011
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java:
##########
@@ -631,6 +637,33 @@ private static void checkMemoryConfiguration(ClusterNode
rmt, GridKernalContext
return null;
}
+ /**
+ * Analyzes affinity settings of a provided {@link CacheConfiguration} to
inspect if it provides guarantees
+ * that partitions of the cache will be spread across all datacenters
presented in cluster.
+ *
+ * @return {@code true} if affinity settings guarantee spreading
partitions across all datacenters and {@code false} otherwise.
+ */
+ static boolean isAffinityConfigurationMdcSafe(CacheConfiguration cc) {
+ if (cc.getCacheMode() == REPLICATED)
+ return true;
+
+ AffinityFunction affFunc = cc.getAffinity();
+
+ if (affFunc instanceof RendezvousAffinityFunction) {
+ IgniteBiPredicate<ClusterNode, List<ClusterNode>> filter =
((RendezvousAffinityFunction)affFunc).getAffinityBackupFilter();
+
+ if (filter instanceof ClusterNodeAttributeAffinityBackupFilter
attrFilter) {
+ if
(!F.asList(attrFilter.getAttributeNames()).contains(ATTR_DATA_CENTER_ID))
+ return false;
+ }
+
+ if (!(filter instanceof MdcAffinityBackupFilter) && !(filter
instanceof ClusterNodeAttributeColocatedBackupFilter))
+ return false;
Review Comment:
Accepted.
--
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]