You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/02/03 11:21:11 UTC

[1/2] ignite git commit: ignite-2407

Repository: ignite
Updated Branches:
  refs/heads/ignite-2407 ba722d10f -> 21e181395


ignite-2407


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/61cfe1d3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/61cfe1d3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/61cfe1d3

Branch: refs/heads/ignite-2407
Commit: 61cfe1d3fadd4664d003cfeb4630de01b794fc8f
Parents: ba722d1
Author: sboikov <sb...@gridgain.com>
Authored: Wed Feb 3 12:21:59 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Feb 3 12:21:59 2016 +0300

----------------------------------------------------------------------
 .../IgniteCachePrimarySyncTxsTest.java          | 128 +++++++++++++++++++
 1 file changed, 128 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/61cfe1d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTxsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTxsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTxsTest.java
new file mode 100644
index 0000000..61bf8a5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTxsTest.java
@@ -0,0 +1,128 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+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;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
+
+/**
+ *
+ */
+public class IgniteCachePrimarySyncTxsTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final int SRVS = 4;
+
+    /** */
+    private static final int NODES = SRVS + 1;
+
+    /** */
+    private boolean clientMode;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+        cfg.setClientMode(clientMode);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        startGrids(SRVS);
+
+        clientMode = true;
+
+        Ignite client = startGrid(SRVS);
+
+        assertTrue(client.configuration().isClientMode());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTxSyncMode() throws Exception {
+        Ignite ignite = ignite(0);
+
+        List<IgniteCache<Object, Object>> caches = new ArrayList<>();
+
+        try {
+            caches.add(ignite.createCache(cacheConfiguration("fullSync1", FULL_SYNC, 1)));
+            caches.add(ignite.createCache(cacheConfiguration("fullSync2", FULL_SYNC, 1)));
+            caches.add(ignite.createCache(cacheConfiguration("fullAsync1", FULL_ASYNC, 1)));
+            caches.add(ignite.createCache(cacheConfiguration("fullAsync2", FULL_ASYNC, 1)));
+            caches.add(ignite.createCache(cacheConfiguration("primarySync1", PRIMARY_SYNC, 1)));
+            caches.add(ignite.createCache(cacheConfiguration("primarySync2", PRIMARY_SYNC, 1)));
+
+            for (int i = 0; i < NODES; i++)
+                checkTxSyncMode(ignite(i));
+        }
+        finally {
+            for (IgniteCache<Object, Object> cache : caches)
+                ignite.destroyCache(cache.getName());
+        }
+    }
+
+    private void checkTxSyncMode(Ignite ignite) {
+
+    }
+
+    /**
+     * @param name Cache name.
+     * @param syncMode Write synchronization mode.
+     * @param backups Number of backups.
+     * @return Cache configuration.
+     */
+    private CacheConfiguration<Object, Object> cacheConfiguration(String name,
+        CacheWriteSynchronizationMode syncMode,
+        int backups) {
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+
+        ccfg.setName(name);
+        ccfg.setAtomicityMode(TRANSACTIONAL);
+        ccfg.setWriteSynchronizationMode(syncMode);
+        ccfg.setBackups(backups);
+
+        return ccfg;
+    }
+
+    public void testPrimarySyncMessages() throws Exception {
+
+    }
+}


[2/2] ignite git commit: ignite-2407

Posted by sb...@apache.org.
ignite-2407


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/21e18139
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/21e18139
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/21e18139

Branch: refs/heads/ignite-2407
Commit: 21e1813959de4ac270778d6e681aba5ce1202ebf
Parents: 61cfe1d
Author: sboikov <sb...@gridgain.com>
Authored: Wed Feb 3 13:20:58 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Feb 3 13:20:58 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/distributed/dht/GridDhtTxFinishFuture.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/21e18139/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
index 1cf00a1..ecf04bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
@@ -46,6 +46,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteUuid;
 
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
 import static org.apache.ignite.transactions.TransactionState.COMMITTING;
 
 /**
@@ -217,7 +218,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
                 if (finishErr == null)
                     finishErr = this.tx.commitError();
 
-                if (tx.syncMode() == FULL_SYNC)
+                if (tx.syncMode() != PRIMARY_SYNC)
                     this.tx.sendFinishReply(commit, finishErr);
 
                 // Don't forget to clean up.