You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vk...@apache.org on 2015/08/05 03:46:01 UTC

[01/19] incubator-ignite git commit: Added benchmarks for jdbc.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-104 d26184ab0 -> 0551155bc


Added benchmarks for jdbc.


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

Branch: refs/heads/ignite-104
Commit: 52c1dfa32d86183c07c82bb3c34a03316d6fd7b5
Parents: b056a73
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Tue Aug 4 17:51:05 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Tue Aug 4 17:51:05 2015 +0300

----------------------------------------------------------------------
 .../yardstick/config/benchmark-query.properties |   3 +-
 modules/yardstick/config/ignite-base-config.xml |   2 -
 .../yardstick/IgniteBenchmarkArguments.java     |  11 ++
 .../cache/IgniteJdbcSqlQueryBenchmark.java      | 134 +++++++++++++++++++
 4 files changed, 147 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52c1dfa3/modules/yardstick/config/benchmark-query.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-query.properties b/modules/yardstick/config/benchmark-query.properties
index d6a8b9e..1a75926 100644
--- a/modules/yardstick/config/benchmark-query.properties
+++ b/modules/yardstick/config/benchmark-query.properties
@@ -63,5 +63,6 @@ CONFIGS="\
 -cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryJoinBenchmark -sn IgniteNode -ds sql-query-join-1-backup,\
 -cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryJoinOffHeapBenchmark -sn IgniteNode -ds sql-query-join-offheap-1-backup,\
 -cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryPutBenchmark -sn IgniteNode -ds sql-query-put-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryPutOffHeapBenchmark -sn IgniteNode -ds sql-query-put-offheap-1-backup\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryPutOffHeapBenchmark -sn IgniteNode -ds sql-query-put-offheap-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -jdbc jdbc:ignite://127.0.0.1/query -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcSqlQueryBenchmark -sn IgniteNode -ds sql-query-jdbc-1-backup\
 "

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52c1dfa3/modules/yardstick/config/ignite-base-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-base-config.xml b/modules/yardstick/config/ignite-base-config.xml
index b2c976a..c77cc9a 100644
--- a/modules/yardstick/config/ignite-base-config.xml
+++ b/modules/yardstick/config/ignite-base-config.xml
@@ -180,8 +180,6 @@
             </list>
         </property>
 
-        <property name="connectorConfiguration"><null/></property>
-
         <property name="includeEventTypes">
             <list/>
         </property>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52c1dfa3/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index 1562b26..5eb7060 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -106,6 +106,17 @@ public class IgniteBenchmarkArguments {
     @Parameter(names = {"-col", "--collocated"}, description = "Collocated")
     private boolean collocated;
 
+    /** */
+    @Parameter(names = {"-jdbc", "--jdbcUrl"}, description = "JDBC url")
+    private String jdbcUrl;
+
+    /**
+     * @return JDBC url.
+     */
+    public String jdbcUrl() {
+        return jdbcUrl;
+    }
+
     /**
      * @return Transaction concurrency.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52c1dfa3/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteJdbcSqlQueryBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteJdbcSqlQueryBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteJdbcSqlQueryBenchmark.java
new file mode 100644
index 0000000..0ded2bd
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteJdbcSqlQueryBenchmark.java
@@ -0,0 +1,134 @@
+/*
+ * 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.yardstick.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.yardstick.cache.model.Person;
+import org.yardstickframework.BenchmarkConfiguration;
+
+import javax.cache.Cache;
+import java.sql.*;
+import java.util.*;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ThreadLocalRandom;
+
+import static org.yardstickframework.BenchmarkUtils.println;
+
+/**
+ * Ignite benchmark that performs query operations.
+ */
+public class IgniteJdbcSqlQueryBenchmark extends IgniteCacheAbstractBenchmark {
+    /** Statements for closing. */
+    Set<PreparedStatement> stms = Collections.synchronizedSet(new HashSet<PreparedStatement>());
+
+    /** {@inheritDoc} */
+    @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+        super.setUp(cfg);
+
+        println(cfg, "Populating query data...");
+
+        long start = System.nanoTime();
+
+        try (IgniteDataStreamer<Integer, Person> dataLdr = ignite().dataStreamer(cache.getName())) {
+            for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted(); i++) {
+                dataLdr.addData(i, new Person(i, "firstName" + i, "lastName" + i, i * 1000));
+
+                if (i % 100000 == 0)
+                    println(cfg, "Populated persons: " + i);
+            }
+        }
+
+        println(cfg, "Finished populating query data in " + ((System.nanoTime() - start) / 1_000_000) + " ms.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+        PreparedStatement stm = (PreparedStatement)ctx.get(0);
+
+        if (stm == null) {
+            stm = createStatement();
+
+            stms.add(stm);
+
+            ctx.put(0, stm);
+        }
+
+        double salary = ThreadLocalRandom.current().nextDouble() * args.range() * 1000;
+
+        double maxSalary = salary + 1000;
+
+        stm.clearParameters();
+
+        stm.setDouble(1, salary);
+        stm.setDouble(2, maxSalary);
+
+        ResultSet rs = stm.executeQuery();
+
+        while (rs.next()) {
+            double sal = rs.getDouble("salary");
+
+            if (sal < salary || sal > maxSalary)
+                throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary + ']');
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void tearDown() throws Exception {
+        for (PreparedStatement stm : stms) {
+            try {
+                stm.getConnection().close();
+
+                stm.close();
+            }
+            catch (Exception ignore) {
+                println("Failed to close connection." + stm);
+            }
+        }
+
+        super.tearDown();
+    }
+
+    /**
+     * @return Prepared statement.
+     * @throws Exception
+     */
+    private PreparedStatement createStatement() throws Exception {
+        Class.forName("org.apache.ignite.IgniteJdbcDriver");
+
+        Connection conn = null;
+
+        try {
+            conn = DriverManager.getConnection(args.jdbcUrl());
+
+            return conn.prepareStatement("select * from Person where salary >= ? and salary <= ?");
+        }
+        catch (Exception e) {
+            if (conn != null)
+                conn.close();
+
+            throw new IgniteException("Failed to create prepare statement.", e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteCache<Integer, Object> cache() {
+        return ignite().cache("query");
+    }
+}


[19/19] incubator-ignite git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-104

Posted by vk...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-104


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

Branch: refs/heads/ignite-104
Commit: 0551155bcdab86ed3409f945db15ade564a167e0
Parents: 2918882 c087be2
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 18:45:49 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 18:45:49 2015 -0700

----------------------------------------------------------------------
 .../query/h2/twostep/GridMergeIndexUnsorted.java       |  8 +-------
 .../processors/query/h2/twostep/GridMergeTable.java    | 13 +++++++------
 2 files changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------



[07/19] incubator-ignite git commit: master - query restart tests fix2

Posted by vk...@apache.org.
master - query restart tests fix2


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

Branch: refs/heads/ignite-104
Commit: 246b94a8bdc9901935db1865a0607a9fe48f5b23
Parents: 90adeae
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Aug 4 21:05:13 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Aug 4 21:05:13 2015 +0300

----------------------------------------------------------------------
 .../query/h2/twostep/GridMergeIndex.java        |  7 +++
 .../h2/twostep/GridMergeIndexUnsorted.java      | 23 +++++++--
 .../query/h2/twostep/GridMergeTable.java        | 51 ++++++++------------
 .../h2/twostep/GridReduceQueryExecutor.java     | 28 +----------
 4 files changed, 45 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/246b94a8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
index 2b2996d..71b207d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
@@ -68,6 +68,13 @@ public abstract class GridMergeIndex extends BaseIndex {
     }
 
     /**
+     * @return Return source nodes for this merge index.
+     */
+    public Set<UUID> sources() {
+        return remainingRows.keySet();
+    }
+
+    /**
      * @param nodeId Node ID.
      * @return {@code true} If this index needs data from the given source node.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/246b94a8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
index e0a07ec..276d25b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
@@ -64,11 +64,24 @@ public class GridMergeIndexUnsorted extends GridMergeIndex {
                 while (!iter.hasNext()) {
                     GridResultPage page;
 
-                    try {
-                        page = queue.take();
-                    }
-                    catch (InterruptedException e) {
-                        throw new CacheException("Query execution was interrupted.", e);
+                    for (;;) {
+                        try {
+                            page = queue.poll(500, TimeUnit.MILLISECONDS);
+                        }
+                        catch (InterruptedException e) {
+                            throw new CacheException("Query execution was interrupted.", e);
+                        }
+
+                        if (page != null)
+                            break;
+
+                        UUID nodeId = ((GridMergeTable)table).checkSourceNodesAlive();
+
+                        if (nodeId != null) {
+                            fail(nodeId);
+
+                            assert !queue.isEmpty();
+                        }
                     }
 
                     if (page.isLast())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/246b94a8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
index c9cdff2..fd9eec3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep;
 
-import org.h2.api.*;
+import org.apache.ignite.internal.*;
 import org.h2.command.ddl.*;
 import org.h2.engine.*;
 import org.h2.index.*;
@@ -32,6 +32,9 @@ import java.util.*;
  */
 public class GridMergeTable extends TableBase {
     /** */
+    private final GridKernalContext ctx;
+
+    /** */
     private final ArrayList<Index> idxs = new ArrayList<>(1);
 
     /** */
@@ -39,15 +42,29 @@ public class GridMergeTable extends TableBase {
 
     /**
      * @param data Data.
+     * @param ctx Kernal context.
      */
-    public GridMergeTable(CreateTableData data) {
+    public GridMergeTable(CreateTableData data, GridKernalContext ctx) {
         super(data);
 
+        this.ctx = ctx;
         idx = new GridMergeIndexUnsorted(this, "merge_scan");
 
         idxs.add(idx);
     }
 
+    /**
+     * @return Failed node or {@code null} if all alive.
+     */
+    public UUID checkSourceNodesAlive() {
+        for (UUID nodeId : idx.sources()) {
+            if (!ctx.discovery().alive(nodeId))
+                return nodeId;
+        }
+
+        return null;
+    }
+
     /** {@inheritDoc} */
     @Override public void lock(Session session, boolean exclusive, boolean force) {
         // No-op.
@@ -153,34 +170,4 @@ public class GridMergeTable extends TableBase {
     @Override public void checkRename() {
         throw DbException.getUnsupportedException("rename");
     }
-
-    /**
-     * Engine.
-     */
-    public static class Engine implements TableEngine {
-        /** */
-        private static ThreadLocal<GridMergeTable> createdTbl = new ThreadLocal<>();
-
-        /**
-         * @return Created table.
-         */
-        public static GridMergeTable getCreated() {
-            GridMergeTable tbl = createdTbl.get();
-
-            assert tbl != null;
-
-            createdTbl.remove();
-
-            return tbl;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Table createTable(CreateTableData data) {
-            GridMergeTable tbl = new GridMergeTable(data);
-
-            createdTbl.set(tbl);
-
-            return tbl;
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/246b94a8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index ac269db..ad8ab34 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -1096,7 +1096,7 @@ public class GridReduceQueryExecutor {
             else
                 data.columns = planColumns();
 
-            return new GridMergeTable(data);
+            return new GridMergeTable(data, ctx);
         }
         catch (Exception e) {
             U.closeQuiet(conn);
@@ -1117,32 +1117,6 @@ public class GridReduceQueryExecutor {
     }
 
     /**
-     * @param conn Connection.
-     * @param qry Query.
-     * @return Table.
-     * @throws IgniteCheckedException If failed.
-     */
-    private GridMergeTable createTable(Connection conn, GridCacheSqlQuery qry) throws IgniteCheckedException {
-        try {
-            try (PreparedStatement s = conn.prepareStatement(
-                "CREATE LOCAL TEMPORARY TABLE " + qry.alias() +
-                " ENGINE \"" + GridMergeTable.Engine.class.getName() + "\" " +
-                " AS SELECT * FROM (" + qry.query() + ") WHERE FALSE")) {
-                h2.bindParameters(s, F.asList(qry.parameters()));
-
-                s.execute();
-            }
-
-            return GridMergeTable.Engine.getCreated();
-        }
-        catch (SQLException e) {
-            U.closeQuiet(conn);
-
-            throw new IgniteCheckedException(e);
-        }
-    }
-
-    /**
      * @param reconnectFut Reconnect future.
      */
     public void onDisconnected(IgniteFuture<?> reconnectFut) {


[02/19] incubator-ignite git commit: master - test fix

Posted by vk...@apache.org.
master - test fix


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

Branch: refs/heads/ignite-104
Commit: e1f01529fa9d19641cb276551375cd8bd739da6d
Parents: b056a73
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Aug 4 17:51:40 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Aug 4 17:51:40 2015 +0300

----------------------------------------------------------------------
 ...idCacheReduceQueryMultithreadedSelfTest.java | 21 +++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1f01529/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java
index c3290a6..f890dee 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java
@@ -21,6 +21,9 @@ import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.util.typedef.*;
+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 java.util.*;
 import java.util.concurrent.*;
@@ -39,6 +42,9 @@ public class GridCacheReduceQueryMultithreadedSelfTest extends GridCacheAbstract
     /** */
     private static final int TEST_TIMEOUT = 2 * 60 * 1000;
 
+    /** */
+    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
     /** {@inheritDoc} */
     @Override protected int gridCount() {
         return GRID_CNT;
@@ -50,8 +56,21 @@ public class GridCacheReduceQueryMultithreadedSelfTest extends GridCacheAbstract
     }
 
     /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(ipFinder);
+
+        cfg.setDiscoverySpi(disco);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
     @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
-        CacheConfiguration cfg = super.cacheConfiguration(gridName);
+        CacheConfiguration<?,?> cfg = super.cacheConfiguration(gridName);
 
         cfg.setCacheMode(PARTITIONED);
         cfg.setBackups(1);


[04/19] incubator-ignite git commit: IGNITE-104 - Ordered ATOMIC updates

Posted by vk...@apache.org.
IGNITE-104 - Ordered ATOMIC updates


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

Branch: refs/heads/ignite-104
Commit: 2421fee936c1cfefa072c00da8ebce6897c2156f
Parents: d26184a
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 10:28:24 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 10:28:24 2015 -0700

----------------------------------------------------------------------
 .../managers/communication/GridIoManager.java   | 75 +++++++++++---------
 1 file changed, 43 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2421fee9/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index a129cbe..b38106e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -980,10 +980,10 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
      * @param msgC Closure to call when message processing finished.
      */
     private void processSequentialMessage(
-        final UUID nodeId,
-        final GridIoMessage msg,
+        UUID nodeId,
+        GridIoMessage msg,
         byte plc,
-        final IgniteRunnable msgC
+        IgniteRunnable msgC
     ) throws IgniteCheckedException {
         final GridMessageListener lsnr = lsnrMap.get(msg.topic());
 
@@ -1018,39 +1018,41 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
 
         msgSet.add(nodeId, msg, msgC);
 
-        if (msgC == null) {
-            assert locNodeId.equals(nodeId);
+        if (!msgSet.reserved()) {
+            if (msgC == null) {
+                assert locNodeId.equals(nodeId);
 
-            msgSet.unwind(lsnr);
-        }
-        else {
-            assert !locNodeId.equals(nodeId);
+                msgSet.unwind(lsnr);
+            }
+            else {
+                assert !locNodeId.equals(nodeId);
 
-            final SequentialMessageSet msgSet0 = msgSet;
+                final SequentialMessageSet msgSet0 = msgSet;
 
-            Runnable c = new Runnable() {
-                @Override public void run() {
-                    try {
-                        threadProcessingMessage(true);
+                Runnable c = new Runnable() {
+                    @Override public void run() {
+                        try {
+                            threadProcessingMessage(true);
 
-                        msgSet0.unwind(lsnr);
-                    }
-                    finally {
-                        threadProcessingMessage(false);
+                            msgSet0.unwind(lsnr);
+                        }
+                        finally {
+                            threadProcessingMessage(false);
+                        }
                     }
-                }
-            };
+                };
 
-            try {
-                pool(plc).execute(c);
-            }
-            catch (RejectedExecutionException e) {
-                U.error(log, "Failed to process sequential message due to execution rejection. " +
-                    "Increase the upper bound on executor service provided by corresponding " +
-                    "configuration property. Will attempt to process message in the listener " +
-                    "thread instead [msgPlc=" + plc + ']', e);
+                try {
+                    pool(plc).execute(c);
+                }
+                catch (RejectedExecutionException e) {
+                    U.error(log, "Failed to process sequential message due to execution rejection. " +
+                        "Increase the upper bound on executor service provided by corresponding " +
+                        "configuration property. Will attempt to process message in the listener " +
+                        "thread instead [msgPlc=" + plc + ']', e);
 
-                c.run();
+                    c.run();
+                }
             }
         }
     }
@@ -1108,10 +1110,12 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
                 ioMsg.topicBytes(marsh.marshal(topic));
 
             try {
-                if ((CommunicationSpi)getSpi() instanceof TcpCommunicationSpi)
-                    ((TcpCommunicationSpi)(CommunicationSpi)getSpi()).sendMessage(node, ioMsg, ackClosure);
+                CommunicationSpi spi = getSpi();
+
+                if (spi instanceof TcpCommunicationSpi)
+                    ((TcpCommunicationSpi)spi).sendMessage(node, ioMsg, ackClosure);
                 else
-                    getSpi().sendMessage(node, ioMsg);
+                    spi.sendMessage(node, ioMsg);
             }
             catch (IgniteSpiException e) {
                 throw new IgniteCheckedException("Failed to send message (node may have left the grid or " +
@@ -2535,6 +2539,13 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
         private final AtomicBoolean reserve = new AtomicBoolean();
 
         /**
+         * @return {@code True} if currently reserved.
+         */
+        boolean reserved() {
+            return reserve.get();
+        }
+
+        /**
          * @param nodeId Node ID.
          * @param msg Message.
          * @param msgC Closure to call when message processing finished.


[03/19] incubator-ignite git commit: Merge remote-tracking branch 'origin/master'

Posted by vk...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/ignite-104
Commit: 38810b639fbcf6f5a07302f02c48226f4156de9d
Parents: e1f0152 52c1dfa
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Aug 4 17:52:08 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Aug 4 17:52:08 2015 +0300

----------------------------------------------------------------------
 .../yardstick/config/benchmark-query.properties |   3 +-
 modules/yardstick/config/ignite-base-config.xml |   2 -
 .../yardstick/IgniteBenchmarkArguments.java     |  11 ++
 .../cache/IgniteJdbcSqlQueryBenchmark.java      | 134 +++++++++++++++++++
 4 files changed, 147 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[14/19] incubator-ignite git commit: IGNITE-104 - Ordered ATOMIC updates

Posted by vk...@apache.org.
IGNITE-104 - Ordered ATOMIC updates


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

Branch: refs/heads/ignite-104
Commit: aeac6aaa2641a4afaa38ec57c0046649601e1184
Parents: b73fa67
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 17:11:48 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 17:11:48 2015 -0700

----------------------------------------------------------------------
 .../IgniteLocalNodeStoppedException.java        | 55 ++++++++++++++++++++
 .../processors/cache/GridCacheMvccManager.java  |  2 +-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |  2 +-
 ...heExpiredEntriesPreloadAbstractSelfTest.java |  2 +-
 .../GridCacheTransformEventSelfTest.java        | 14 +----
 ...niteCacheClientNodeChangingTopologyTest.java |  4 +-
 .../dht/GridCacheAtomicNearCacheSelfTest.java   |  4 +-
 7 files changed, 65 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/main/java/org/apache/ignite/internal/IgniteLocalNodeStoppedException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteLocalNodeStoppedException.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteLocalNodeStoppedException.java
new file mode 100644
index 0000000..bc8eb5c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteLocalNodeStoppedException.java
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.jetbrains.annotations.*;
+
+/**
+ * Exception used when local node is stopping.
+ */
+public class IgniteLocalNodeStoppedException extends IgniteCheckedException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Creates new exception with default error message.
+     */
+    public IgniteLocalNodeStoppedException() {
+        super("Local node is stopping.");
+    }
+
+    /**
+     * Creates new exception with given error message.
+     *
+     * @param msg Error message.
+     */
+    public IgniteLocalNodeStoppedException(String msg) {
+        super(msg);
+    }
+
+    /**
+     * Creates a new exception with given error message and optional nested cause exception.
+     *
+     * @param msg Error message.
+     * @param cause Optional nested exception (can be {@code null}).
+     */
+    public IgniteLocalNodeStoppedException(String msg, @Nullable Throwable cause) {
+        super(msg, cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index 6a8c6fe..7416672 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -296,7 +296,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
      * Cancels all client futures.
      */
     public void cancelClientFutures() {
-        cancelClientFutures(new IgniteCheckedException("Operation has been cancelled (node is stopping)."));
+        cancelClientFutures(new IgniteLocalNodeStoppedException());
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 52d59ed..7823a52 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -324,7 +324,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
         if (super.onDone(res, err)) {
             cctx.mvcc().removeAtomicFuture(version());
 
-            if (updateReq.writeSynchronizationMode() == FULL_SYNC)
+            if (updateReq.writeSynchronizationMode() == FULL_SYNC && !(err instanceof IgniteLocalNodeStoppedException))
                 completionCb.apply(updateReq, updateRes);
 
             return true;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
index ccc9b64..8b9373d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
@@ -105,7 +105,7 @@ public abstract class GridCacheExpiredEntriesPreloadAbstractSelfTest extends Gri
 
         Collection<Event> evts = g1.events().localQuery(F.<Event>alwaysTrue(), EVT_CACHE_REBALANCE_OBJECT_LOADED);
 
-        assertEquals("Expected all entries are preloaded.", KEYS_NUM, evts.size());
+        assertEquals("Expected all entries are preloaded.", cache1.isDhtAtomic() ? 0 : KEYS_NUM, evts.size());
 
         boolean rmv = GridTestUtils.waitForCondition(new PAX() {
             @Override public boolean applyx() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
index 459e015..31edb8f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
@@ -457,13 +457,13 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
 
         caches[0].invoke(key1, new Transformer());
 
-        checkEventNodeIdsStrict(primaryIdsForKeys(key1));
+        checkEventNodeIdsStrict(idsForKeys(key1));
 
         assert evts.isEmpty();
 
         caches[0].invokeAll(keys, new Transformer());
 
-        checkEventNodeIdsStrict(primaryIdsForKeys(key1, key2));
+        checkEventNodeIdsStrict(idsForKeys(key1, key2));
     }
 
     /**
@@ -505,16 +505,6 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
     }
 
     /**
-     * Get primary node IDs where the given keys must reside.
-     *
-     * @param keys Keys.
-     * @return Node IDs.
-     */
-    private UUID[] primaryIdsForKeys(int... keys) {
-        return idsForKeys(true, keys);
-    }
-
-    /**
      * Get node IDs where the given keys must reside.
      *
      * @param primaryOnly Primary only flag.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 58c5f95..3c6e5e4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -295,6 +295,8 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         IgniteEx ignite1 = startGrid(1);
         IgniteEx ignite2 = startGrid(2);
 
+        awaitPartitionMapExchange();
+
         client = true;
 
         Ignite ignite3 = startGrid(3);
@@ -348,7 +350,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         List<Object> msgs = spi.recordedMessages();
 
-        assertEquals(3, msgs.size());
+        assertEquals(6, msgs.size());
 
         for (Object msg : msgs)
             assertTrue(((GridNearAtomicUpdateRequest)msg).clientRequest());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
index 2d28328..6d12f5e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
@@ -668,7 +668,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         cache0.remove(nearKey); // Remove from grid0, this should remove readers on primary node.
 
         for (int i = 0; i < GRID_CNT; i++)
-            checkEntry(grid(i), nearKey, null, i == 0);
+            checkEntry(grid(i), nearKey, null, false);
 
         Ignite primaryNode = G.ignite((String) aff.mapKeyToNode(nearKey).attribute(ATTR_GRID_NAME));
 
@@ -698,7 +698,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
 
         GridCacheEntryEx nearEntry = near.peekEx(key);
 
-        boolean expectDht = near.affinity().isPrimaryOrBackup(ignite.cluster().localNode(), key);
+        boolean expectDht = val != null && near.affinity().isPrimaryOrBackup(ignite.cluster().localNode(), key);
 
         if (expectNear) {
             assertNotNull("No near entry for: " + key + ", grid: " + ignite.name(), nearEntry);


[10/19] incubator-ignite git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-104

Posted by vk...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-104


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

Branch: refs/heads/ignite-104
Commit: 6f042aeef97b1624394bca06b7659c4c835b4a89
Parents: e3ebcb9 01c3e09
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 11:26:13 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 11:26:13 2015 -0700

----------------------------------------------------------------------
 .../cache/GridCacheSwapPreloadSelfTest.java     |  2 +
 .../query/h2/twostep/GridMergeIndex.java        |  7 +++
 .../h2/twostep/GridMergeIndexUnsorted.java      | 23 +++++++--
 .../query/h2/twostep/GridMergeTable.java        | 51 ++++++++------------
 .../h2/twostep/GridReduceQueryExecutor.java     | 28 +----------
 5 files changed, 47 insertions(+), 64 deletions(-)
----------------------------------------------------------------------



[17/19] incubator-ignite git commit: IGNITE-104 - Ordered ATOMIC updates

Posted by vk...@apache.org.
IGNITE-104 - Ordered ATOMIC updates


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

Branch: refs/heads/ignite-104
Commit: 19ff9a5688ac198f380e0373e9ff961717d13072
Parents: 3be215d
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 18:24:23 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 18:24:23 2015 -0700

----------------------------------------------------------------------
 .../cache/integration/IgniteCacheLoaderWriterAbstractTest.java     | 2 +-
 .../ignite/testframework/junits/common/GridCommonAbstractTest.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/19ff9a56/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
index 4812b3b..3291bdd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
@@ -184,7 +184,7 @@ public abstract class IgniteCacheLoaderWriterAbstractTest extends IgniteCacheAbs
 
         IgniteCache<Object, Object> cache = jcache(0);
 
-        for (Object key : primaryKeys(cache, 100, 0))
+        for (Object key : primaryKeys(cache, 100, 0, true))
             vals.put(key, key);
 
         assertTrue(cache.getAll(vals.keySet()).isEmpty());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/19ff9a56/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 247a99e..f05af4b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -524,7 +524,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
 
         int part = -1;
 
-        for (int i = startFrom; i < startFrom + 100_000; i++) {
+        for (int i = startFrom; i < startFrom + 1_000_000; i++) {
             Integer key = i;
 
             boolean add = part == -1 ? aff.isPrimary(locNode, key) : aff.partition(key) == part;


[05/19] incubator-ignite git commit: master - query restart tests fix

Posted by vk...@apache.org.
master - query restart tests fix


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

Branch: refs/heads/ignite-104
Commit: 90adeae9dd57f0aaaabe5f244d5167853a0b48dc
Parents: 38810b6
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Aug 4 20:30:00 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Aug 4 20:30:00 2015 +0300

----------------------------------------------------------------------
 .../h2/twostep/GridReduceQueryExecutor.java     | 34 ++++++++++++++++++--
 1 file changed, 31 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/90adeae9/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index cde3288..ac269db 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -150,8 +150,7 @@ public class GridReduceQueryExecutor {
                 for (QueryRun r : runs.values()) {
                     for (GridMergeTable tbl : r.tbls) {
                         if (tbl.getScanIndex(null).hasSource(nodeId)) {
-                            // Will attempt to retry. If reduce query was started it will fail on next page fetching.
-                            retry(r, h2.readyTopologyVersion(), nodeId);
+                            handleNodeLeft(r, nodeId);
 
                             break;
                         }
@@ -162,6 +161,15 @@ public class GridReduceQueryExecutor {
     }
 
     /**
+     * @param r Query run.
+     * @param nodeId Left node ID.
+     */
+    private void handleNodeLeft(QueryRun r, UUID nodeId) {
+        // Will attempt to retry. If reduce query was started it will fail on next page fetching.
+        retry(r, h2.readyTopologyVersion(), nodeId);
+    }
+
+    /**
      * @param nodeId Node ID.
      * @param msg Message.
      */
@@ -515,7 +523,7 @@ public class GridReduceQueryExecutor {
 
                 if (send(nodes,
                     new GridQueryRequest(qryReqId, r.pageSize, space, mapQrys, topVer, extraSpaces, null), partsMap)) {
-                    U.await(r.latch);
+                    awaitAllReplies(r, nodes);
 
                     Object state = r.state.get();
 
@@ -595,6 +603,26 @@ public class GridReduceQueryExecutor {
     }
 
     /**
+     * @param r Query run.
+     * @param nodes Nodes to check periodically if they alive.
+     * @throws IgniteInterruptedCheckedException If interrupted.
+     */
+    private void awaitAllReplies(QueryRun r, Collection<ClusterNode> nodes)
+        throws IgniteInterruptedCheckedException {
+        while (!U.await(r.latch, 500, TimeUnit.MILLISECONDS)) {
+            for (ClusterNode node : nodes) {
+                if (!ctx.discovery().alive(node)) {
+                    handleNodeLeft(r, node.id());
+
+                    assert r.latch.getCount() == 0;
+
+                    return;
+                }
+            }
+        }
+    }
+
+    /**
      * Calculates data nodes for replicated caches on unstable topology.
      *
      * @param cctx Cache context for main space.


[18/19] incubator-ignite git commit: IGNITE-104 - Ordered ATOMIC updates

Posted by vk...@apache.org.
IGNITE-104 - Ordered ATOMIC updates


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

Branch: refs/heads/ignite-104
Commit: 29188822bc4154b0a6abfc4a215a5aedc5c4206b
Parents: 19ff9a5
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 18:28:58 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 18:28:58 2015 -0700

----------------------------------------------------------------------
 .../cache/GridCacheAbstractFullApiSelfTest.java          | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/29188822/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index fb004bf..b6348f2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -2317,7 +2317,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
                             GridCacheEntryEx entry = cctx.isNear() ? cctx.near().dht().peekEx(key) :
                                 cctx.cache().peekEx(key);
 
-                            if (grid(idx).affinity(null).mapKeyToPrimaryAndBackups(key).contains(grid(idx).localNode())) {
+                            if (atomicityMode() != ATOMIC &&
+                                grid(idx).affinity(null).mapKeyToPrimaryAndBackups(key).contains(grid(idx).localNode())) {
                                 assertNotNull(entry);
                                 assertTrue(entry.deleted());
                             }
@@ -3394,8 +3395,12 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         // Ensure that old TTL and expire time are not longer "visible".
         entry = internalCache.peekEx(key);
 
-        assertEquals(0, entry.ttl());
-        assertEquals(0, entry.expireTime());
+        if (atomicityMode() == ATOMIC)
+            assertNull(entry);
+        else {
+            assertEquals(0, entry.ttl());
+            assertEquals(0, entry.expireTime());
+        }
 
         // Ensure that next update will not pick old expire time.
 


[08/19] incubator-ignite git commit: IGNITE-104 - Ordered ATOMIC updates

Posted by vk...@apache.org.
IGNITE-104 - Ordered ATOMIC updates


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

Branch: refs/heads/ignite-104
Commit: e3ebcb96efd469dd162b5b0e8cd3904ab7003a67
Parents: 98ad892
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 11:08:45 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 11:08:45 2015 -0700

----------------------------------------------------------------------
 .../configuration/CacheConfiguration.java       | 22 ------------
 .../processors/cache/GridCacheContext.java      |  8 ++---
 .../dht/atomic/GridDhtAtomicCache.java          | 35 +++++---------------
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |  8 ++---
 .../dht/atomic/GridNearAtomicUpdateFuture.java  | 30 ++++++-----------
 5 files changed, 24 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ebcb96/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index ff32551..3ad0f01 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -219,10 +219,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     /** Write ordering mode. */
     private CacheAtomicWriteOrderMode atomicWriteOrderMode;
 
-    /** Ordered updates mode. */
-    // TODO: IGNITE-104 - Switch default to false
-    private boolean atomicOrderedUpdates = true;
-
     /** Number of backups for cache. */
     private int backups = DFLT_BACKUPS;
 
@@ -349,7 +345,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
         aff = cc.getAffinity();
         affMapper = cc.getAffinityMapper();
         atomicityMode = cc.getAtomicityMode();
-        atomicOrderedUpdates = cc.isAtomicOrderedUpdates();
         atomicWriteOrderMode = cc.getAtomicWriteOrderMode();
         backups = cc.getBackups();
         cacheLoaderFactory = cc.getCacheLoaderFactory();
@@ -901,23 +896,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     }
 
     /**
-     * @return Ordered updates mode.
-     */
-    public boolean isAtomicOrderedUpdates() {
-        return atomicOrderedUpdates;
-    }
-
-    /**
-     * @param atomicOrderedUpdates Ordered updates mode.
-     * @return {@code this} for chaining.
-     */
-    public CacheConfiguration<K, V> setAtomicOrderedUpdates(boolean atomicOrderedUpdates) {
-        this.atomicOrderedUpdates = atomicOrderedUpdates;
-
-        return this;
-    }
-
-    /**
      * Gets number of nodes used to back up single partition for {@link CacheMode#PARTITIONED} cache.
      * <p>
      * If not set, default value is {@link #DFLT_BACKUPS}.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ebcb96/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 05ce183..db62f20 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -537,12 +537,8 @@ public class GridCacheContext<K, V> implements Externalizable {
      * @return {@code True} if entries should not be deleted from cache immediately.
      */
     public boolean deferredDelete(GridCacheAdapter<?, ?> cache) {
-        boolean nearAtomic = cache.isNear() && cache.configuration().getAtomicityMode() == ATOMIC;
-        boolean orderedUpdates = cache.configuration().isAtomicOrderedUpdates();
-
-        return cache.isDht() || cache.isColocated() ||
-            (cache.isDhtAtomic() && !orderedUpdates) ||
-            (nearAtomic && !orderedUpdates);
+        // Only TRANSACTIONAL caches.
+        return cache.isDht() || cache.isColocated();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ebcb96/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index f5119f6..01694d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -187,33 +187,18 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        if (ctx.config().isAtomicOrderedUpdates()) {
-            for (int part = 0; part < ctx.affinity().partitions(); part++) {
-                Object nearTopic = new GridAtomicRequestTopic(ctx.cacheId(), part, true);
+        for (int part = 0; part < ctx.affinity().partitions(); part++) {
+            Object nearTopic = new GridAtomicRequestTopic(ctx.cacheId(), part, true);
 
-                ctx.io().addPerTopicHandler(nearTopic, new CI2<UUID, GridNearAtomicUpdateRequest>() {
-                    @Override public void apply(UUID nodeId, GridNearAtomicUpdateRequest req) {
-                        processNearAtomicUpdateRequest(nodeId, req);
-                    }
-                });
-
-                Object dhtTopic = new GridAtomicRequestTopic(ctx.cacheId(), part, false);
-
-                ctx.io().addPerTopicHandler(dhtTopic, new CI2<UUID, GridDhtAtomicUpdateRequest>() {
-                    @Override public void apply(UUID nodeId, GridDhtAtomicUpdateRequest req) {
-                        processDhtAtomicUpdateRequest(nodeId, req);
-                    }
-                });
-            }
-        }
-        else {
-            ctx.io().addHandler(ctx.cacheId(), GridNearAtomicUpdateRequest.class, new CI2<UUID, GridNearAtomicUpdateRequest>() {
+            ctx.io().addPerTopicHandler(nearTopic, new CI2<UUID, GridNearAtomicUpdateRequest>() {
                 @Override public void apply(UUID nodeId, GridNearAtomicUpdateRequest req) {
                     processNearAtomicUpdateRequest(nodeId, req);
                 }
             });
 
-            ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicUpdateRequest.class, new CI2<UUID, GridDhtAtomicUpdateRequest>() {
+            Object dhtTopic = new GridAtomicRequestTopic(ctx.cacheId(), part, false);
+
+            ctx.io().addPerTopicHandler(dhtTopic, new CI2<UUID, GridDhtAtomicUpdateRequest>() {
                 @Override public void apply(UUID nodeId, GridDhtAtomicUpdateRequest req) {
                     processDhtAtomicUpdateRequest(nodeId, req);
                 }
@@ -253,11 +238,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         for (DeferredResponseBuffer buf : pendingResponses.values())
             buf.finish();
 
-        if (ctx.config().isAtomicOrderedUpdates()) {
-            for (int part = 0; part < ctx.affinity().partitions(); part++) {
-                ctx.io().removePerTopicHandler(new GridAtomicRequestTopic(ctx.cacheId(), part, true));
-                ctx.io().removePerTopicHandler(new GridAtomicRequestTopic(ctx.cacheId(), part, false));
-            }
+        for (int part = 0; part < ctx.affinity().partitions(); part++) {
+            ctx.io().removePerTopicHandler(new GridAtomicRequestTopic(ctx.cacheId(), part, true));
+            ctx.io().removePerTopicHandler(new GridAtomicRequestTopic(ctx.cacheId(), part, false));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ebcb96/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 5c22b3b..52d59ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -123,8 +123,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
         waitForExchange = !topLocked;
 
         // We can send entry processor instead of value to backup if updates are ordered.
-        forceTransformBackups = updateReq.operation() == GridCacheOperation.TRANSFORM &&
-            cctx.config().isAtomicOrderedUpdates();
+        forceTransformBackups = updateReq.operation() == GridCacheOperation.TRANSFORM;
     }
 
     /** {@inheritDoc} */
@@ -218,9 +217,6 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
 
         Collection<ClusterNode> dhtNodes = cctx.dht().topology().nodes(part, topVer);
 
-        if (!cctx.config().isAtomicOrderedUpdates())
-            part = -1;
-
         if (log.isDebugEnabled())
             log.debug("Mapping entry to DHT nodes [nodes=" + U.nodeIds(dhtNodes) + ", entry=" + entry + ']');
 
@@ -281,7 +277,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
 
         AffinityTopologyVersion topVer = updateReq.topologyVersion();
 
-        int part = cctx.config().isAtomicOrderedUpdates() ? entry.partition() : -1;
+        int part = entry.partition();
 
         for (UUID nodeId : readers) {
             GridAtomicMappingKey mappingKey = new GridAtomicMappingKey(nodeId, part);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ebcb96/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index 5150113..c4704cf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -512,7 +512,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
 
             Collection<KeyCacheObject> remapKeys = fastMap ? null : res.remapKeys();
 
-            mapOnTopology(remapKeys, true, nodeId);
+            mapOnTopology(remapKeys, true, new GridAtomicMappingKey(nodeId, res.partition()));
 
             return;
         }
@@ -591,9 +591,9 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
      *
      * @param keys Keys to map.
      * @param remap Boolean flag indicating if this is partial future remap.
-     * @param oldNodeId Old node ID if remap.
+     * @param remapKey Mapping key (if remap).
      */
-    private void mapOnTopology(final Collection<?> keys, final boolean remap, final UUID oldNodeId) {
+    private void mapOnTopology(final Collection<?> keys, final boolean remap, final GridAtomicMappingKey remapKey) {
         cache.topology().readLock();
 
         AffinityTopologyVersion topVer = null;
@@ -624,7 +624,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
                         @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> t) {
                             cctx.kernalContext().closure().runLocalSafe(new Runnable() {
                                 @Override public void run() {
-                                    mapOnTopology(keys, remap, oldNodeId);
+                                    mapOnTopology(keys, remap, remapKey);
                                 }
                             });
                         }
@@ -640,7 +640,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
             cache.topology().readUnlock();
         }
 
-        map0(topVer, keys, remap, oldNodeId);
+        map0(topVer, keys, remap, remapKey);
     }
 
     /**
@@ -683,14 +683,14 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
      * @param topVer Topology version.
      * @param remapKeys Keys to remap or {@code null} to map all keys.
      * @param remap Flag indicating if this is partial remap for this future.
-     * @param oldNodeId Old node ID if was remap.
+     * @param remapKey Mapping key (if remap).
      */
     private void map0(
         AffinityTopologyVersion topVer,
         @Nullable Collection<?> remapKeys,
         boolean remap,
-        @Nullable UUID oldNodeId) {
-        assert oldNodeId == null || remap || fastMapRemap;
+        @Nullable GridAtomicMappingKey remapKey) {
+        assert remapKey == null || remap || fastMapRemap;
 
         Collection<ClusterNode> topNodes = CU.affinityNodes(cctx, topVer);
 
@@ -783,9 +783,6 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
             int part = cctx.affinity().partition(cacheKey);
             ClusterNode primary = cctx.affinity().primary(part, topVer);
 
-            if (!ccfg.isAtomicOrderedUpdates())
-                part = -1;
-
             if (primary == null) {
                 onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
                     "left the grid)."));
@@ -852,13 +849,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
         // Must do this in synchronized block because we need to atomically remove and add mapping.
         // Otherwise checkComplete() may see empty intermediate state.
         synchronized (this) {
-            if (oldNodeId != null) {
-                // TODO: IGNITE-104 - Try to avoid iteration.
-                for (Map.Entry<GridAtomicMappingKey, GridNearAtomicUpdateRequest> e : mappings.entrySet()) {
-                    if (e.getKey().nodeId().equals(oldNodeId))
-                        mappings.remove(e.getKey());
-                }
-            }
+            if (remapKey != null)
+                mappings.remove(remapKey);
 
             // For fastMap mode wait for all responses before remapping.
             if (remap && fastMap && !mappings.isEmpty()) {
@@ -930,7 +922,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
 
                 T2<Integer, Collection<ClusterNode>> t = mapKey(cacheKey, topVer, fastMap);
 
-                int part = ccfg.isAtomicOrderedUpdates() ? t.get1() : -1;
+                int part = t.get1();
                 Collection<ClusterNode> affNodes = t.get2();
 
                 if (affNodes.isEmpty()) {


[12/19] incubator-ignite git commit: master - minor refactoring

Posted by vk...@apache.org.
master - minor refactoring


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

Branch: refs/heads/ignite-104
Commit: b683b8f80b59696933d52ad2c79321b374e4e6b4
Parents: 246b94a
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Aug 5 00:27:18 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Aug 5 00:27:18 2015 +0300

----------------------------------------------------------------------
 .../query/h2/twostep/GridMergeIndexUnsorted.java       |  8 +-------
 .../processors/query/h2/twostep/GridMergeTable.java    | 13 +++++++------
 2 files changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b683b8f8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
index 276d25b..61aaa80 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
@@ -75,13 +75,7 @@ public class GridMergeIndexUnsorted extends GridMergeIndex {
                         if (page != null)
                             break;
 
-                        UUID nodeId = ((GridMergeTable)table).checkSourceNodesAlive();
-
-                        if (nodeId != null) {
-                            fail(nodeId);
-
-                            assert !queue.isEmpty();
-                        }
+                        ((GridMergeTable)table).checkSourceNodesAlive();
                     }
 
                     if (page.isLast())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b683b8f8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
index fd9eec3..0b335d3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
@@ -54,15 +54,16 @@ public class GridMergeTable extends TableBase {
     }
 
     /**
-     * @return Failed node or {@code null} if all alive.
+     * Fails merge table if any source node is left.
      */
-    public UUID checkSourceNodesAlive() {
+    public void checkSourceNodesAlive() {
         for (UUID nodeId : idx.sources()) {
-            if (!ctx.discovery().alive(nodeId))
-                return nodeId;
-        }
+            if (!ctx.discovery().alive(nodeId)) {
+                idx.fail(nodeId);
 
-        return null;
+                return;
+            }
+        }
     }
 
     /** {@inheritDoc} */


[15/19] incubator-ignite git commit: IGNITE-104 - Ordered ATOMIC updates

Posted by vk...@apache.org.
IGNITE-104 - Ordered ATOMIC updates


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

Branch: refs/heads/ignite-104
Commit: 7d9ea018b28dedaece1f71598921232829fecdb8
Parents: aeac6aa
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 18:02:46 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 18:02:46 2015 -0700

----------------------------------------------------------------------
 .../processors/cache/distributed/near/GridNearAtomicCache.java   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7d9ea018/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index b3f4a1d..2255988 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -285,8 +285,6 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
 
         Collection<KeyCacheObject> backupKeys = req.keys();
 
-        boolean intercept = req.forceTransformBackups() && ctx.config().getInterceptor() != null;
-
         String taskName = ctx.kernalContext().task().resolveTaskName(req.taskNameHash());
 
         for (int i = 0; i < req.nearSize(); i++) {
@@ -341,7 +339,7 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
                             expireTime,
                             null,
                             false,
-                            intercept,
+                            /*intercept*/false,
                             req.subjectId(),
                             taskName);
 


[06/19] incubator-ignite git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-104

Posted by vk...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-104


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

Branch: refs/heads/ignite-104
Commit: 98ad89253b8e252d36a2e3c45d44466cb5b97d02
Parents: 2421fee 90adeae
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 10:35:34 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 10:35:34 2015 -0700

----------------------------------------------------------------------
 .../h2/twostep/GridReduceQueryExecutor.java     |  34 ++++-
 ...idCacheReduceQueryMultithreadedSelfTest.java |  21 ++-
 .../yardstick/config/benchmark-query.properties |   3 +-
 modules/yardstick/config/ignite-base-config.xml |   2 -
 .../yardstick/IgniteBenchmarkArguments.java     |  11 ++
 .../cache/IgniteJdbcSqlQueryBenchmark.java      | 134 +++++++++++++++++++
 6 files changed, 198 insertions(+), 7 deletions(-)
----------------------------------------------------------------------



[09/19] incubator-ignite git commit: # Muted hanging test

Posted by vk...@apache.org.
# Muted hanging test


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

Branch: refs/heads/ignite-104
Commit: 01c3e0928fbba8d1dfa24b97d4e2506816472703
Parents: 246b94a
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 11:25:48 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 11:25:48 2015 -0700

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheSwapPreloadSelfTest.java    | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c3e092/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
index 6176da4..f8e1bff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
@@ -153,6 +153,8 @@ public class GridCacheSwapPreloadSelfTest extends GridCommonAbstractTest {
 
     /** @throws Exception If failed. */
     private void checkSwapMultithreaded() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-614");
+
         final AtomicBoolean done = new AtomicBoolean();
         IgniteInternalFuture<?> fut = null;
 


[16/19] incubator-ignite git commit: IGNITE-104 - Ordered ATOMIC updates

Posted by vk...@apache.org.
IGNITE-104 - Ordered ATOMIC updates


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

Branch: refs/heads/ignite-104
Commit: 3be215d941011283868b5d4ccaae2c8c6d1289df
Parents: 7d9ea01
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 18:22:30 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 18:22:30 2015 -0700

----------------------------------------------------------------------
 .../IgniteCacheStoreSessionAbstractTest.java    |  2 +-
 .../junits/common/GridCommonAbstractTest.java   | 20 +++++++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3be215d9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
index 7784003..c6150f8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
@@ -115,7 +115,7 @@ public abstract class IgniteCacheStoreSessionAbstractTest extends IgniteCacheAbs
      * @throws Exception If failed.
      */
     private void testStoreSession(IgniteCache<Object, Object> cache) throws Exception {
-        Set<Integer> keys = new HashSet<>(primaryKeys(cache, 3, 100_000));
+        Set<Integer> keys = new HashSet<>(primaryKeys(cache, 3, 100_000, true));
 
         Integer key = keys.iterator().next();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3be215d9/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 8698b4a..247a99e 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -503,6 +503,17 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
      * @return Collection of keys for which given cache is primary.
      */
     protected List<Integer> primaryKeys(IgniteCache<?, ?> cache, int cnt, int startFrom) {
+        return primaryKeys(cache, cnt, startFrom, false);
+    }
+
+    /**
+     * @param cache Cache.
+     * @param cnt Keys count.
+     * @param startFrom Start value for keys search.
+     * @param singlePart Single partition.
+     * @return Collection of keys for which given cache is primary.
+     */
+    protected List<Integer> primaryKeys(IgniteCache<?, ?> cache, int cnt, int startFrom, boolean singlePart) {
         assert cnt > 0 : cnt;
 
         List<Integer> found = new ArrayList<>(cnt);
@@ -511,10 +522,17 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
 
         Affinity<Integer> aff = (Affinity<Integer>)affinity(cache);
 
+        int part = -1;
+
         for (int i = startFrom; i < startFrom + 100_000; i++) {
             Integer key = i;
 
-            if (aff.isPrimary(locNode, key)) {
+            boolean add = part == -1 ? aff.isPrimary(locNode, key) : aff.partition(key) == part;
+
+            if (add) {
+                if (singlePart)
+                    part = aff.partition(key);
+
                 found.add(key);
 
                 if (found.size() == cnt)


[13/19] incubator-ignite git commit: Merge remote-tracking branch 'origin/master'

Posted by vk...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/ignite-104
Commit: c087be21760dd8ab34a0b2a43f7f10f7a5203e41
Parents: b683b8f 01c3e09
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Aug 5 00:27:37 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Aug 5 00:27:37 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheSwapPreloadSelfTest.java    | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------



[11/19] incubator-ignite git commit: IGNITE-104 - Ordered ATOMIC updates

Posted by vk...@apache.org.
IGNITE-104 - Ordered ATOMIC updates


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

Branch: refs/heads/ignite-104
Commit: b73fa67ffb2c86c4a09efe554bfc738a21a52d3b
Parents: 6f042ae
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 11:28:31 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 11:28:31 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b73fa67f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index aa84346..bafdfef 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -103,7 +103,7 @@ public class IgniteCacheTestSuite extends TestSuite {
         suite.addTestSuite(IgniteClientNodeAffinityTest.class);
 
         // Swap tests.
-//        suite.addTestSuite(GridCacheSwapPreloadSelfTest.class); // TODO: IGNITE-104
+        suite.addTestSuite(GridCacheSwapPreloadSelfTest.class);
         suite.addTestSuite(GridCacheSwapReloadSelfTest.class);
 
         // Common tests.