This is an automated email from the ASF dual-hosted git repository. av pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push: new f809525 IGNITE-13051 still validate MVCC if cache will not start (#7852) f809525 is described below commit f809525f31ed595b9304b9832bdd92fe1b9de984 Author: Maxim <timonin.mak...@mail.ru> AuthorDate: Wed Jun 3 11:56:17 2020 +0300 IGNITE-13051 still validate MVCC if cache will not start (#7852) --- .../cache/CacheAffinitySharedManager.java | 3 +++ .../mvcc/CacheMvccConfigurationValidationTest.java | 30 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java index f9edf86..94d6bed 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java @@ -1351,6 +1351,9 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap ) throws IgniteCheckedException { IgniteInternalFuture<?> res = cachesRegistry.addUnregistered(descs); + for (DynamicCacheDescriptor d: descs) + cctx.coordinators().validateCacheConfiguration(d.cacheConfiguration()); + if (fut.context().mergeExchanges()) return res; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java index fb83ae0..a8dba15 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java @@ -37,10 +37,13 @@ import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.apache.ignite.util.AttributeNodeFilter; import org.jetbrains.annotations.Nullable; import org.junit.Test; @@ -323,6 +326,33 @@ public class CacheMvccConfigurationValidationTest extends GridCommonAbstractTest } /** + * Check that node in client mode (filtered by AttributeNodeFilter) correctly works with MVCC. + */ + @SuppressWarnings("unchecked") + @Test + public void testMvccEnabledForClientMode() throws Exception { + String attrName = "has_cache"; + Object attrVal = Boolean.TRUE; + + final IgniteEx crd = (IgniteEx) startGrid(getTestIgniteInstanceName(0), getConfiguration()); + + // Do not start cache on non-affinity node. + CacheConfiguration ccfg = defaultCacheConfiguration() + .setNearConfiguration(null) + .setNodeFilter(new AttributeNodeFilter(attrName, attrVal)) + .setAtomicityMode(TRANSACTIONAL_SNAPSHOT); + + final IgniteEx node = (IgniteEx) startGrid(getTestIgniteInstanceName(1), getConfiguration() + .setCacheConfiguration(ccfg) + .setUserAttributes(F.asMap(attrName, attrVal))); + + checkTopology(2); + + assertTrue(crd.context().coordinators().mvccEnabled()); + assertTrue(node.context().coordinators().mvccEnabled()); + } + + /** * Checks if passed in {@code 'Throwable'} has given class in {@code 'cause'} hierarchy * <b>including</b> that throwable itself and it contains passed message. * <p>