# ignite-157
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c5481362 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c5481362 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c5481362 Branch: refs/heads/ignite-430 Commit: c54813625103ea98591acfb8fe15d5cb4dea7f1c Parents: 46dda3d Author: sboikov <sboi...@gridgain.com> Authored: Fri May 8 13:31:41 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Fri May 8 13:31:41 2015 +0300 ---------------------------------------------------------------------- .../transactions/IgniteTxLocalAdapter.java | 2 +- .../GridCacheAbstractNodeRestartSelfTest.java | 6 +- .../distributed/IgniteTxGetAfterStopTest.java | 131 +++++++++++++++++++ .../testsuites/IgniteCacheRestartTestSuite.java | 4 +- 4 files changed, 137 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5481362/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java index fc3efba..bd3a4ec 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -1760,7 +1760,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter } } - if (!missed.isEmpty() && (cacheCtx.isReplicated() || cacheCtx.isLocal())) { + if (!missed.isEmpty() && cacheCtx.isLocal()) { return checkMissed(cacheCtx, retMap, missed, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5481362/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java index 76020b8..7e65f23 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java @@ -105,9 +105,9 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs disco.setIpFinder(ipFinder); - disco.setSocketTimeout(10_000); - disco.setAckTimeout(10_000); - disco.setNetworkTimeout(10_000); + disco.setSocketTimeout(30_000); + disco.setAckTimeout(30_000); + disco.setNetworkTimeout(30_000); c.setDiscoverySpi(disco); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5481362/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxGetAfterStopTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxGetAfterStopTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxGetAfterStopTest.java new file mode 100644 index 0000000..469f513 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxGetAfterStopTest.java @@ -0,0 +1,131 @@ +/* + * 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.processors.cache.*; +import org.apache.ignite.transactions.*; +import org.jetbrains.annotations.*; + +import static org.apache.ignite.cache.CacheAtomicityMode.*; +import static org.apache.ignite.cache.CacheMode.*; + +/** + * + */ +public class IgniteTxGetAfterStopTest extends IgniteCacheAbstractTest { + /** */ + private CacheMode cacheMode; + + /** */ + private NearCacheConfiguration nearCfg; + + /** {@inheritDoc} */ + @Override protected int gridCount() { + return 4; + } + + /** {@inheritDoc} */ + @Override protected CacheMode cacheMode() { + return cacheMode; + } + + /** {@inheritDoc} */ + @Override protected CacheAtomicityMode atomicityMode() { + return TRANSACTIONAL; + } + + /** {@inheritDoc} */ + @Override protected NearCacheConfiguration nearConfiguration() { + return nearCfg; + } + + /** {@inheritDoc} */ + @Override protected void beforeTestsStarted() throws Exception { + // No-op. + } + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + super.afterTest(); + + stopAllGrids(); + } + + /** + * @throws Exception If failed. + */ + public void testReplicated() throws Exception { + getAfterStop(REPLICATED, null); + } + + /** + * @throws Exception If failed. + */ + public void testPartitioned() throws Exception { + getAfterStop(PARTITIONED, new NearCacheConfiguration()); + } + + /** + * @throws Exception If failed. + */ + public void testPartitionedNearDisabled() throws Exception { + getAfterStop(PARTITIONED, null); + } + + /** + * @param cacheMode Cache mode. + * @param nearCfg Near cache configuration. + * @throws Exception If failed. + */ + private void getAfterStop(CacheMode cacheMode, @Nullable NearCacheConfiguration nearCfg) throws Exception { + this.cacheMode = cacheMode; + this.nearCfg = nearCfg; + + startGrids(); + + IgniteCache<Integer, Integer> cache0 = jcache(0); + IgniteCache<Integer, Integer> cache1 = jcache(1); + + Integer key0 = primaryKey(cache0); + Integer key1 = primaryKey(cache1); + + try (Transaction tx = ignite(0).transactions().txStart()) { + log.info("Put: " + key0); + + cache0.put(key0, key0); + + log.info("Stop node."); + + stopGrid(3); + + log.info("Get: " + key1); + + cache0.get(key1); + + log.info("Commit."); + + tx.commit(); + } + + assertEquals(key0, cache0.get(key0)); + assertNull(cache1.get(key1)); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5481362/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java index e5372e8..983d447 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java @@ -21,6 +21,7 @@ import junit.framework.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; +import org.apache.ignite.internal.processors.cache.distributed.replicated.*; /** * In-Memory Data Grid stability test suite on changing topology. @@ -37,8 +38,7 @@ public class IgniteCacheRestartTestSuite extends TestSuite { suite.addTestSuite(GridCachePartitionedNodeRestartTest.class); suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class); - // TODO IGNITE-157. - // suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class); + suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class); suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class); // suite.addTestSuite(IgniteCacheAtomicReplicatedNodeRestartSelfTest.class); // TODO IGNITE-747