ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Lantukh (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (IGNITE-6998) Activation on bigger topology with enabled persistence doesn't work as expected.
Date Fri, 29 Dec 2017 04:00:00 GMT

    [ https://issues.apache.org/jira/browse/IGNITE-6998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16305953#comment-16305953
] 

Ilya Lantukh edited comment on IGNITE-6998 at 12/29/17 3:59 AM:
----------------------------------------------------------------

This issue still exists in the 'master' branch.

It happens because local mappings in GridDhtPartitionTopologyImpl.node2part are calculated
without considering which partitions actually exist in ignite persistence (see GridDhtPartitionTopologyImpl.initPartitions0(...)
method), and so all partitions that in new topology are assigned to different nodes will get
state == EVICTED.

In means, you will lose data in the following example scenario:
- start 2 nodes
- activate
- create cache with persistence and 0 backup
- load data
- shutdown
- start 3 nodes
- activate
- all data in partitions that are now assigned by affinity to node 3 (new one) is lost


was (Author: ilantukh):
This issue still exists in the 'master' branch.

It happens because local mappings in GridDhtPartitionTopologyImpl.node2part are calculated
without considering which partitions actually exist in ignite persistence (see GridDhtPartitionTopologyImpl.initPartitions0(...)
method), and so all partitions that in new topology are assigned to different nodes will get
state == EVICTED.

In means, you will lose data in the following example scenario:
- start 2 nodes
- activate
- create cache with persistence and 0 backup
- load data
- shutdown
- start 3 nodes
- activate
- all data in partitions that are now assigned to node 3 (new one) is lost

> 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
>             Fix For: 2.4
>
>
> 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
(v6.4.14#64029)

Mime
View raw message