Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4FF93178F9 for ; Wed, 22 Apr 2015 14:13:47 +0000 (UTC) Received: (qmail 71816 invoked by uid 500); 22 Apr 2015 14:13:47 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 71787 invoked by uid 500); 22 Apr 2015 14:13:47 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 71778 invoked by uid 99); 22 Apr 2015 14:13:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Apr 2015 14:13:47 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [54.76.25.247] (HELO mx1-eu-west.apache.org) (54.76.25.247) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Apr 2015 14:13:20 +0000 Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id 410DD25F78 for ; Wed, 22 Apr 2015 14:13:17 +0000 (UTC) Received: (qmail 69240 invoked by uid 99); 22 Apr 2015 14:13:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Apr 2015 14:13:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E64D2E1083; Wed, 22 Apr 2015 14:13:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Wed, 22 Apr 2015 14:13:30 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [15/46] incubator-ignite git commit: # ignite-sprint-4 Fixed simple error in GridAffinityAssignmentCache.initialize X-Virus-Checked: Checked by ClamAV on apache.org # ignite-sprint-4 Fixed simple error in GridAffinityAssignmentCache.initialize Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d7e8b599 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d7e8b599 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d7e8b599 Branch: refs/heads/ignite-656 Commit: d7e8b59924265d9a1eb8e832d93d054d33ef4c9a Parents: bc025d9 Author: sboikov Authored: Tue Apr 21 11:42:00 2015 +0300 Committer: sboikov Committed: Tue Apr 21 12:27:26 2015 +0300 ---------------------------------------------------------------------- .../affinity/GridAffinityAssignmentCache.java | 7 +++- .../IgniteCachePutGetRestartAbstractTest.java | 39 ++++++++++++++------ .../IgniteCacheTxFairAffinityNodeJoinTest.java | 35 ++++++++++++++++++ .../IgniteCacheFailoverTestSuite.java | 3 +- 4 files changed, 70 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7e8b599/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java index 2d98ee0..409419c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java @@ -116,8 +116,13 @@ public class GridAffinityAssignmentCache { head.set(assignment); for (Map.Entry entry : readyFuts.entrySet()) { - if (entry.getKey().compareTo(topVer) >= 0) + if (entry.getKey().compareTo(topVer) <= 0) { + if (log.isDebugEnabled()) + log.debug("Completing topology ready future (initialized affinity) " + + "[locNodeId=" + ctx.localNodeId() + ", futVer=" + entry.getKey() + ", topVer=" + topVer + ']'); + entry.getValue().onDone(topVer); + } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7e8b599/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePutGetRestartAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePutGetRestartAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePutGetRestartAbstractTest.java index d2066ed..a56b0fa 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePutGetRestartAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePutGetRestartAbstractTest.java @@ -49,7 +49,7 @@ public abstract class IgniteCachePutGetRestartAbstractTest extends IgniteCacheAb private final Object mux = new Object(); /** */ - private CountDownLatch latch = new CountDownLatch(1); + private volatile CountDownLatch latch = new CountDownLatch(1); /** {@inheritDoc} */ @Override protected int gridCount() { @@ -70,7 +70,7 @@ public abstract class IgniteCachePutGetRestartAbstractTest extends IgniteCacheAb @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); - if (gridName.equals(getTestGridName(0))) + if (gridName.equals(getTestGridName(gridCount() - 1))) cfg.setClientMode(true); cfg.setPeerClassLoadingEnabled(false); @@ -96,9 +96,13 @@ public abstract class IgniteCachePutGetRestartAbstractTest extends IgniteCacheAb * @throws Exception If failed. */ public void testTxPutGetRestart() throws Exception { - final IgniteTransactions txs = ignite(0).transactions(); + int clientGrid = gridCount() - 1; - final IgniteCache cache = jcache(0); + assertTrue(ignite(clientGrid).configuration().isClientMode()); + + final IgniteTransactions txs = ignite(clientGrid).transactions(); + + final IgniteCache cache = jcache(clientGrid); updateCache(cache, txs); @@ -106,6 +110,8 @@ public abstract class IgniteCachePutGetRestartAbstractTest extends IgniteCacheAb IgniteInternalFuture updateFut = GridTestUtils.runAsync(new Callable() { @Override public Void call() throws Exception { + Thread.currentThread().setName("update-thread"); + assertTrue(latch.await(30_000, TimeUnit.MILLISECONDS)); int iter = 0; @@ -128,18 +134,26 @@ public abstract class IgniteCachePutGetRestartAbstractTest extends IgniteCacheAb IgniteInternalFuture restartFut = GridTestUtils.runAsync(new Callable() { @Override public Void call() throws Exception { - assertTrue(latch.await(30_000, TimeUnit.MILLISECONDS)); + Thread.currentThread().setName("restart-thread"); + + ThreadLocalRandom rnd = ThreadLocalRandom.current(); while (!stop.get()) { - log.info("Stop node."); + assertTrue(latch.await(30_000, TimeUnit.MILLISECONDS)); - stopGrid(1); + int node = rnd.nextInt(0, gridCount() - 1); + + log.info("Stop node: " + node); + + stopGrid(node); U.sleep(100); - log.info("Start node."); + log.info("Start node: " + node); - startGrid(1); + startGrid(node); + + latch = new CountDownLatch(1); U.sleep(100); } @@ -153,7 +167,7 @@ public abstract class IgniteCachePutGetRestartAbstractTest extends IgniteCacheAb try { int iter = 0; - while (System.currentTimeMillis() < endTime) { + while (System.currentTimeMillis() < endTime && !updateFut.isDone() && !restartFut.isDone()) { try { log.info("Start get: " + iter); @@ -164,14 +178,15 @@ public abstract class IgniteCachePutGetRestartAbstractTest extends IgniteCacheAb log.info("End get: " + iter++); } finally { - if (latch.getCount() > 0) - latch.countDown(); + latch.countDown(); } } log.info("Get iterations: " + iter); } finally { + latch.countDown(); + stop.set(true); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7e8b599/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxFairAffinityNodeJoinTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxFairAffinityNodeJoinTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxFairAffinityNodeJoinTest.java new file mode 100644 index 0000000..1efaf02 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxFairAffinityNodeJoinTest.java @@ -0,0 +1,35 @@ +/* + * 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.distributed; + +import org.apache.ignite.cache.affinity.fair.*; +import org.apache.ignite.configuration.*; + +/** + * + */ +public class IgniteCacheTxFairAffinityNodeJoinTest extends IgniteCacheTxNodeJoinTest { + /** {@inheritDoc} */ + @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception { + CacheConfiguration ccfg = super.cacheConfiguration(gridName); + + ccfg.setAffinity(new FairAffinityFunction(128)); + + return ccfg; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7e8b599/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java index 9c1c57c..32e4134 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java @@ -59,8 +59,9 @@ public class IgniteCacheFailoverTestSuite extends TestSuite { suite.addTestSuite(IgniteCacheAtomicNodeJoinTest.class); suite.addTestSuite(IgniteCacheTxNodeJoinTest.class); + suite.addTestSuite(IgniteCacheTxFairAffinityNodeJoinTest.class); - suite.addTestSuite(IgniteCacheTxNearDisabledPutGetRestartTest.class); + //suite.addTestSuite(IgniteCacheTxNearDisabledPutGetRestartTest.class); return suite; }