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 1E56518CF5 for ; Wed, 19 Aug 2015 07:40:20 +0000 (UTC) Received: (qmail 69688 invoked by uid 500); 19 Aug 2015 07:40:20 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 69658 invoked by uid 500); 19 Aug 2015 07:40:20 -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 69649 invoked by uid 99); 19 Aug 2015 07:40:20 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Aug 2015 07:40:19 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 8CF54C0BCF for ; Wed, 19 Aug 2015 07:40:19 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.775 X-Spam-Level: X-Spam-Status: No, score=0.775 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.006, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 5ZG22miaUXfi for ; Wed, 19 Aug 2015 07:40:07 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 85419215F1 for ; Wed, 19 Aug 2015 07:39:56 +0000 (UTC) Received: (qmail 67554 invoked by uid 99); 19 Aug 2015 07:39:56 -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, 19 Aug 2015 07:39:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2F190E17FC; Wed, 19 Aug 2015 07:39:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.incubator.apache.org Date: Wed, 19 Aug 2015 07:40:25 -0000 Message-Id: <52c58e15650c43b58e78b17c16ece1b4@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [31/50] incubator-ignite git commit: # Fix TopologyVersionAwareJob # Fix TopologyVersionAwareJob Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a3301b35 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a3301b35 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a3301b35 Branch: refs/heads/ignite-gg-9615-1 Commit: a3301b3511a742c7c2cc013a4e31a1a838482938 Parents: 51dcd51 Author: sboikov Authored: Fri Aug 14 11:27:29 2015 +0300 Committer: sboikov Committed: Fri Aug 14 11:37:47 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheAdapter.java | 9 +- .../IgniteCacheSizeFailoverTest.java | 115 +++++++++++++++++++ .../IgniteCachePutRetryAbstractSelfTest.java | 19 ++- ...PutRetryAtomicPrimaryWriteOrderSelfTest.java | 32 ++++++ .../tcp/IgniteCacheSslStartStopSelfTest.java | 1 + .../IgniteCacheFailoverTestSuite.java | 3 + 6 files changed, 175 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index 18f4004..47ede5b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -5597,9 +5597,12 @@ public abstract class GridCacheAdapter implements IgniteInternalCache>() { - @Override - public void apply(IgniteInternalFuture t) { - jobCtx.callcc(); + @Override public void apply(IgniteInternalFuture t) { + ((IgniteKernal)ignite).context().closure().runLocalSafe(new Runnable() { + @Override public void run() { + jobCtx.callcc(); + } + }, false); } }); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java new file mode 100644 index 0000000..a76d894 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java @@ -0,0 +1,115 @@ +/* + * 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.*; +import org.apache.ignite.cache.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.*; +import org.apache.ignite.spi.discovery.tcp.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.testframework.junits.common.*; + +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; + +import static org.apache.ignite.cache.CacheAtomicityMode.*; +import static org.apache.ignite.cache.CacheMode.*; +import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; + +/** + * + */ +public class IgniteCacheSizeFailoverTest extends GridCommonAbstractTest { + /** */ + private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder); + + CacheConfiguration ccfg = new CacheConfiguration(); + + ccfg.setCacheMode(PARTITIONED); + ccfg.setAtomicityMode(ATOMIC); + ccfg.setWriteSynchronizationMode(FULL_SYNC); + ccfg.setBackups(1); + + cfg.setCacheConfiguration(ccfg); + + return cfg; + } + + /** + * @throws Exception If failed. + */ + public void testSize() throws Exception { + startGrids(2); + + final AtomicBoolean stop = new AtomicBoolean(); + + final AtomicInteger cntr = new AtomicInteger(); + + IgniteInternalFuture fut = GridTestUtils.runMultiThreadedAsync(new Callable() { + @Override public Object call() throws Exception { + int idx = cntr.getAndIncrement(); + + IgniteCache cache = ignite(idx).cache(null); + + long cntr = 0; + + while (!stop.get()) { + cache.size(); + + if (cntr++ % 1000 == 0) + log.info("Iteration: " + cntr); + } + + return null; + } + }, 2, "size-thread"); + + try { + for (int i = 0; i < 10; i++) { + log.info("Start node: " + i); + + Ignite node = startGrid(3); + + IgniteCache cache = node.cache(null); + + for (int j = 0; j < 100; j++) + assertTrue(cache.size() >= 0); + + log.info("Stop node: " + i); + + stopGrid(3); + } + } + finally { + stop.set(true); + } + + log.info("Stop test."); + + fut.get(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java index bfddbe7..dcba325 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; +import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; @@ -29,6 +30,9 @@ import org.apache.ignite.testframework.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; +import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*; +import static org.apache.ignite.cache.CacheAtomicityMode.*; + /** * */ @@ -47,6 +51,7 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception { CacheConfiguration cfg = super.cacheConfiguration(gridName); + cfg.setAtomicWriteOrderMode(writeOrderMode()); cfg.setBackups(1); return cfg; @@ -66,6 +71,13 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr } /** + * @return Write order mode. + */ + protected CacheAtomicWriteOrderMode writeOrderMode() { + return CLOCK; + } + + /** * @throws Exception If failed. */ public void testPut() throws Exception { @@ -87,8 +99,13 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr int keysCnt = keysCount(); + IgniteCache cache = ignite(0).cache(null); + + if (atomicityMode() == ATOMIC) + assertEquals(writeOrderMode(), cache.getConfiguration(CacheConfiguration.class).getAtomicWriteOrderMode()); + for (int i = 0; i < keysCnt; i++) - ignite(0).cache(null).put(i, i); + cache.put(i, i); finished.set(true); fut.get(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java new file mode 100644 index 0000000..e9682c5 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java @@ -0,0 +1,32 @@ +/* + * 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.dht.atomic; + +import org.apache.ignite.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; + +import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*; + +/** + * + */ +public class IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest extends IgniteCachePutRetryAtomicSelfTest { + /** {@inheritDoc} */ + @Override protected CacheAtomicWriteOrderMode writeOrderMode() { + return PRIMARY; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java index 9bf6caa..5b9af4f 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java @@ -26,6 +26,7 @@ import org.apache.ignite.testframework.*; * */ public class IgniteCacheSslStartStopSelfTest extends IgniteCachePutRetryAbstractSelfTest { + /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/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 524bfb3..af2b85c 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 @@ -73,10 +73,13 @@ public class IgniteCacheFailoverTestSuite extends TestSuite { suite.addTestSuite(IgniteCacheTxNearDisabledFairAffinityPutGetRestartTest.class); suite.addTestSuite(IgniteCachePutRetryAtomicSelfTest.class); + suite.addTestSuite(IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.class); suite.addTestSuite(IgniteCachePutRetryTransactionalSelfTest.class); suite.addTestSuite(IgniteCacheSslStartStopSelfTest.class); + suite.addTestSuite(IgniteCacheSizeFailoverTest.class); + return suite; } }