Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5A1E9200D41 for ; Wed, 22 Nov 2017 11:20:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 53C1B160C0F; Wed, 22 Nov 2017 10:20:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 55850160BDA for ; Wed, 22 Nov 2017 11:20:05 +0100 (CET) Received: (qmail 48421 invoked by uid 500); 22 Nov 2017 10:20:04 -0000 Mailing-List: contact issues-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list issues@ignite.apache.org Received: (qmail 48375 invoked by uid 99); 22 Nov 2017 10:20:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Nov 2017 10:20:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id B95EC1A0B3A for ; Wed, 22 Nov 2017 10:20:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id J-UwTI-ek0uZ for ; Wed, 22 Nov 2017 10:20:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 6C4A05F30B for ; Wed, 22 Nov 2017 10:20:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id E8741E0BCB for ; Wed, 22 Nov 2017 10:20:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4993D23F05 for ; Wed, 22 Nov 2017 10:20:00 +0000 (UTC) Date: Wed, 22 Nov 2017 10:20:00 +0000 (UTC) From: "Semen Boikov (JIRA)" To: issues@ignite.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (IGNITE-6973) Node restarts with enabled persistence lead to affinity assignment mismatch on different nodes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 22 Nov 2017 10:20:06 -0000 [ https://issues.apache.org/jira/browse/IGNITE-6973?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Semen Boikov resolved IGNITE-6973. ---------------------------------- Resolution: Fixed There was a bug with deploymentId assigned to caches started during activation, fixed in master. > Node restarts with enabled persistence lead to affinity assignment mismatch on different nodes. > ----------------------------------------------------------------------------------------------- > > Key: IGNITE-6973 > URL: https://issues.apache.org/jira/browse/IGNITE-6973 > Project: Ignite > Issue Type: Bug > Affects Versions: 2.3 > Reporter: Alexei Scherbakov > Assignee: Semen Boikov > Fix For: 2.4 > > > Most probably this is caused by deploymentId reassign after grid restart. > All nodes must have same deploymentId in such case. > 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.Arrays; > import java.util.Collection; > import java.util.HashMap; > import java.util.List; > import java.util.Map; > import java.util.concurrent.Callable; > import java.util.concurrent.atomic.AtomicInteger; > import org.apache.ignite.Ignite; > import org.apache.ignite.IgniteCache; > import org.apache.ignite.cache.CacheAtomicityMode; > import org.apache.ignite.cache.CacheMode; > import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; > 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.IgniteInternalFuture; > import org.apache.ignite.internal.IgniteKernal; > import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; > import org.apache.ignite.internal.processors.cache.CacheGroupDescriptor; > 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.lang.IgniteUuid; > 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.GridTestUtils; > import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; > import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; > import static org.apache.ignite.cache.CacheMode.PARTITIONED; > import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; > import static org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC; > /** > * The test validates assignment after nodes restart with enabled persistence. > */ > public class IgnitePdsCacheAssignmentNodeRestartsTest 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); > 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(); > } > /** > * @param name Name. > * @param atomicityMode Atomicity mode. > * @param cacheMode Cache mode. > * @param backups Backups. > * @param grp Group. > */ > private CacheConfiguration cacheConfiguration(String name, > CacheAtomicityMode atomicityMode, > CacheMode cacheMode, > int backups, > String grp) > { > CacheConfiguration ccfg = new CacheConfiguration(name); > ccfg.setAtomicityMode(atomicityMode); > ccfg.setWriteSynchronizationMode(FULL_SYNC); > ccfg.setCacheMode(cacheMode); > ccfg.setGroupName(grp); > ccfg.setAffinity(new RendezvousAffinityFunction(false, 128)); > if (cacheMode == PARTITIONED) > ccfg.setBackups(backups); > return ccfg; > } > /** > * > */ > public void testAssignmentAfterRestarts() throws Exception { > try { > System.setProperty(IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC, "true"); > final int gridsCnt = 5; > final int groupsCnt = 2; > final IgniteEx node = (IgniteEx)startGridsMultiThreaded(gridsCnt); > final List cfgs = Arrays.asList( > cacheConfiguration("g1c1", TRANSACTIONAL, PARTITIONED, gridsCnt, "testGrp1"), > cacheConfiguration("g1c2", TRANSACTIONAL, PARTITIONED, gridsCnt, "testGrp1"), > cacheConfiguration("g2c1", TRANSACTIONAL, PARTITIONED, gridsCnt, "testGrp2"), > cacheConfiguration("g2c2", TRANSACTIONAL, PARTITIONED, gridsCnt, "testGrp2")); > final Collection caches = node.getOrCreateCaches(cfgs); > validateDepIds(groupsCnt); > stopAllGrids(); > IgniteEx node2 = (IgniteEx)startGridsMultiThreaded(gridsCnt); > validateDepIds(groupsCnt); // Deployment ids must be the same on all nodes. > final int restartIdxFrom = 2; > final AtomicInteger idx = new AtomicInteger(restartIdxFrom); > IgniteInternalFuture fut = GridTestUtils.runMultiThreadedAsync(new Callable() { > @Override public Void call() throws Exception { > int nodeIdx = idx.getAndIncrement(); > stopGrid(nodeIdx); > return null; > } > }, gridsCnt - restartIdxFrom, "stop-node"); > fut.get(); > awaitPartitionMapExchange(); > checkAffinity(); > idx.set(restartIdxFrom); > fut = GridTestUtils.runMultiThreadedAsync(new Callable() { > @Override public Void call() throws Exception { > int nodeIdx = idx.getAndIncrement(); > startGrid(nodeIdx); > return null; > } > }, gridsCnt - restartIdxFrom, "start-node"); > fut.get(); > awaitPartitionMapExchange(); > AffinityTopologyVersion topVer = node2.context().cache().context().exchange().readyAffinityVersion(); > log.info("Using version: " + topVer); > checkAffinity(); > } > finally { > System.clearProperty(IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC); > } > } > /** > * @param grpCnt Group count. > */ > private void validateDepIds(int grpCnt) { > Map depIds = new HashMap<>(); > for (Ignite ignite : G.allGrids()) { > final Map descMap = ((IgniteEx)ignite).context().cache().cacheGroupDescriptors(); > for (Map.Entry entry : descMap.entrySet()) { > final IgniteUuid u = entry.getValue().deploymentId(); > final IgniteUuid u0 = depIds.get(entry.getKey()); > if (u0 == null) > depIds.put(entry.getKey(), u); > else > assertEquals("Descriptors do not match", u0, u); > } > } > assertEquals(grpCnt + 1, depIds.size()); > } > /** > * @throws Exception If failed. > */ > private void checkAffinity() throws Exception { > List 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>> affMap = new HashMap<>(); > for (Ignite node : nodes) { > IgniteKernal node0 = (IgniteKernal)node; > for (IgniteInternalCache cache : node0.context().cache().caches()) { > List> aff = affMap.get(cache.name()); > List> 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)