[ https://issues.apache.org/jira/browse/IGNITE-6998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrey Gura updated IGNITE-6998: -------------------------------- Fix Version/s: (was: 2.5) 2.6 > Activation on bigger topology with enabled persistence doesn't work as > expected. > -------------------------------------------------------------------------------- > > Key: IGNITE-6998 > URL: https://issues.apache.org/jira/browse/IGNITE-6998 > Project: Ignite > Issue Type: Bug > Components: cache, persistence > Affects Versions: 2.3 > Reporter: Alexei Scherbakov > Priority: Major > Fix For: 2.6 > > > Reproducer: > {noformat} > /* > * Licensed to the Apache Software Foundation (ASF) under one or more > * contributor license agreements. See the NOTICE file distributed with > * this work for additional information regarding copyright ownership. > * The ASF licenses this file to You under the Apache License, Version 2.0 > * (the "License"); you may not use this file except in compliance with > * the License. You may obtain a copy of the License at > * > * http://www.apache.org/licenses/LICENSE-2.0 > * > * Unless required by applicable law or agreed to in writing, software > * distributed under the License is distributed on an "AS IS" BASIS, > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > * See the License for the specific language governing permissions and > * limitations under the License. > */ > package org.apache.ignite.internal.processors.cache.persistence; > import java.util.HashMap; > import java.util.List; > import java.util.Map; > import org.apache.ignite.Ignite; > import org.apache.ignite.IgniteCheckedException; > import org.apache.ignite.cache.CacheWriteSynchronizationMode; > import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; > import org.apache.ignite.cache.query.ScanQuery; > import org.apache.ignite.cluster.ClusterNode; > import org.apache.ignite.configuration.CacheConfiguration; > import org.apache.ignite.configuration.IgniteConfiguration; > import org.apache.ignite.configuration.MemoryConfiguration; > import org.apache.ignite.configuration.MemoryPolicyConfiguration; > import org.apache.ignite.configuration.PersistentStoreConfiguration; > import org.apache.ignite.configuration.WALMode; > import org.apache.ignite.internal.IgniteEx; > import org.apache.ignite.internal.IgniteKernal; > import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; > import org.apache.ignite.internal.processors.cache.IgniteInternalCache; > import org.apache.ignite.internal.util.typedef.G; > import org.apache.ignite.internal.util.typedef.internal.U; > import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; > import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; > import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; > import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; > /** > * Check correctness of activation on bigger topology. > */ > public class IgnitePdsActivationOnBiggerTopologyTest extends > GridCommonAbstractTest { > /** */ > private static TcpDiscoveryIpFinder ipFinder = new > TcpDiscoveryVmIpFinder(true); > /** {@inheritDoc} */ > @Override protected IgniteConfiguration getConfiguration(String > igniteInstanceName) throws Exception { > IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); > cfg.setMemoryConfiguration(new > MemoryConfiguration().setDefaultMemoryPolicyName("d"). > setPageSize(1024).setMemoryPolicies(new > MemoryPolicyConfiguration().setName("d"). > setInitialSize(50 * 1024 * 1024L).setMaxSize(50 * 1024 * 1024))); > cfg.setPersistentStoreConfiguration(new > PersistentStoreConfiguration().setWalMode(WALMode.LOG_ONLY)); > ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder); > CacheConfiguration<Integer, Integer> ccfg = new > CacheConfiguration<>(DEFAULT_CACHE_NAME); > > ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); > ccfg.setAffinity(new RendezvousAffinityFunction(false, 64)); > cfg.setCacheConfiguration(ccfg); > return cfg; > } > /** {@inheritDoc} */ > @Override protected void beforeTest() throws Exception { > super.beforeTest(); > deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), > "db", false)); > } > /** {@inheritDoc} */ > @Override protected void afterTest() throws Exception { > stopAllGrids(); > deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), > "db", false)); > super.afterTest(); > } > /** */ > public void testActivationOnBiggerTopology() throws Exception { > IgniteEx ignite = (IgniteEx)startGridsMultiThreaded(2); > final int keysCnt = 1_000; > for (int i = 0; i < keysCnt; i++) > ignite.cache(DEFAULT_CACHE_NAME).put(i, i); > forceCheckpoint(); > assertEquals("Wrong size (before restart)", keysCnt, > ignite.cache(DEFAULT_CACHE_NAME).size()); > assertEquals("Wrong size for scan (before restart)", keysCnt, > ignite.cache(DEFAULT_CACHE_NAME).query(new ScanQuery<>()).getAll().size()); > stopAllGrids(); > ignite = startGrid(0); > startGrid(1); > startGrid(2); > startGrid(3); > ignite.active(true); > checkAffinity(); > awaitPartitionMapExchange(true, true, null); > checkAffinity(); > forceCheckpoint(); > assertEquals("Wrong size", keysCnt, > ignite.cache(DEFAULT_CACHE_NAME).size()); > assertEquals("Wrong size for scan", keysCnt, > ignite.cache(DEFAULT_CACHE_NAME).query(new ScanQuery<>()).getAll().size()); > } > /** */ > private void forceCheckpoint() throws IgniteCheckedException { > for (Ignite ig : G.allGrids()) > > ((IgniteEx)ig).context().cache().context().database().wakeupForCheckpoint("test").get(); > } > /** > * @throws Exception If failed. > */ > private void checkAffinity() throws Exception { > List<Ignite> nodes = G.allGrids(); > ClusterNode crdNode = null; > for (Ignite node : nodes) { > ClusterNode locNode = node.cluster().localNode(); > if (crdNode == null || locNode.order() < crdNode.order()) > crdNode = locNode; > } > AffinityTopologyVersion topVer = ((IgniteKernal)grid(crdNode)). > context().cache().context().exchange().readyAffinityVersion(); > Map<String, List<List<ClusterNode>>> affMap = new HashMap<>(); > for (Ignite node : nodes) { > IgniteKernal node0 = (IgniteKernal)node; > for (IgniteInternalCache cache : > node0.context().cache().caches()) { > List<List<ClusterNode>> aff = affMap.get(cache.name()); > List<List<ClusterNode>> aff0 = > cache.context().affinity().assignments(topVer); > if (aff != null) > assertEquals(aff, aff0); > else > affMap.put(cache.name(), aff0); > } > } > } > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)