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 2015/06/19 12:34:47 UTC

[01/50] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-1020

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-950 74017faa5 -> 10b022602


Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-1020


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

Branch: refs/heads/ignite-950
Commit: e507f030998c98851f97affa14667b64ebdb236e
Parents: a75b868 01eee2d
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 17 12:10:41 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 17 12:10:41 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    | 13 +-----------
 .../client/GridClientConfiguration.java         |  4 ++--
 .../GridClientOptimizedMarshaller.java          | 21 ++++++++++++++++++++
 .../impl/GridTcpRouterNioListenerAdapter.java   |  2 +-
 .../rest/protocols/tcp/GridTcpRestProtocol.java |  3 ++-
 .../ignite/internal/util/IgniteUtils.java       | 21 ++++++++++++++++++++
 6 files changed, 48 insertions(+), 16 deletions(-)
----------------------------------------------------------------------



[48/50] incubator-ignite git commit: ignite-950: fixed fields queiries

Posted by sb...@apache.org.
ignite-950: fixed fields queiries


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

Branch: refs/heads/ignite-950
Commit: 6e413729d3e7ca292173fd6e3491eb79664eb12b
Parents: 41a821f
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jun 19 13:10:36 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Jun 19 13:10:36 2015 +0300

----------------------------------------------------------------------
 .../cache/CacheOptimizedObjectImpl.java         |  2 +-
 ...acheOptimizedMarshallerExtQuerySelfTest.java | 25 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e413729/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOptimizedObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOptimizedObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOptimizedObjectImpl.java
index fe5a644..f07344c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOptimizedObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOptimizedObjectImpl.java
@@ -130,7 +130,7 @@ public class CacheOptimizedObjectImpl extends CacheObjectAdapter {
         assert val != null || valBytes != null;
 
         if (val == null && ctx.storeValue())
-            val = ctx.processor().unmarshal(ctx, valBytes, ldr);
+            val = ctx.processor().unmarshal(ctx, valBytes, start, len, ldr);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e413729/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOptimizedMarshallerExtQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOptimizedMarshallerExtQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOptimizedMarshallerExtQuerySelfTest.java
index d9f85aa..010f3e6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOptimizedMarshallerExtQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOptimizedMarshallerExtQuerySelfTest.java
@@ -21,6 +21,8 @@ import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.query.*;
 import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.cache.query.*;
+import org.apache.ignite.internal.processors.query.*;
 import org.apache.ignite.marshaller.optimized.ext.*;
 
 import javax.cache.*;
@@ -127,6 +129,29 @@ public class IgniteCacheOptimizedMarshallerExtQuerySelfTest extends GridCacheAbs
     }
 
     /**
+     * @throws Exception In case of error.
+     */
+    public void testFieldsQuery() throws Exception {
+        IgniteCache<Integer, Person> cache = grid(0).cache(null);
+
+        QueryCursor<List<?>> cur = cache.query(new SqlFieldsQuery("select name, address, zip" +
+            " from Person where zip IN (1,2)"));
+
+        List<?> result = cur.getAll();
+
+        assertTrue(result.size() == 2);
+
+        for (Object row : result) {
+            ArrayList<Object> list = (ArrayList<Object>)row;
+
+            Address addr = (Address)list.get(1);
+            int zip = (int)list.get(2);
+
+            assertEquals(addr.zip, zip);
+        }
+    }
+
+    /**
      * @return Cache type metadata.
      */
     private Collection<CacheTypeMetadata> cacheTypeMetadata() {


[05/50] incubator-ignite git commit: ignite-484-1 - minor

Posted by sb...@apache.org.
ignite-484-1 - minor


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

Branch: refs/heads/ignite-950
Commit: c1fc7b5d6d7deb895bdf13d3b7e199161d494277
Parents: ca253a8
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 17 13:44:36 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 17 13:44:36 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtLocalPartition.java  |  8 +++-----
 .../dht/GridDhtPartitionsReservation.java       | 20 ++++++++++++++------
 .../IgniteCacheQueryNodeRestartSelfTest2.java   |  8 ++++++--
 3 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1fc7b5d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 5938fc8..1392f5e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -505,14 +505,12 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
      * @return {@code true} If there is a group reservation.
      */
     private boolean groupReserved() {
-        boolean reserved = false;
-
         for (GridDhtPartitionsReservation reservation : reservations) {
-            if (!reservation.canEvict())
-                reserved = true; // Calling all the reservations to allow them unregister themselves.
+            if (!reservation.invalidate())
+                return true; // Failed to invalidate reservation -> we are reserved.
         }
 
-        return reserved;
+        return false;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1fc7b5d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionsReservation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionsReservation.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionsReservation.java
index a32946a..aced999 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionsReservation.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionsReservation.java
@@ -34,6 +34,13 @@ public class GridDhtPartitionsReservation implements GridReservable {
     private static final GridDhtLocalPartition[] EMPTY = {};
 
     /** */
+    private static final CI1<GridDhtPartitionsReservation> NO_OP = new CI1<GridDhtPartitionsReservation>() {
+        @Override public void apply(GridDhtPartitionsReservation gridDhtPartitionsReservation) {
+            throw new IllegalStateException();
+        }
+    };
+
+    /** */
     private final Object appKey;
 
     /** */
@@ -154,7 +161,7 @@ public class GridDhtPartitionsReservation implements GridReservable {
         for (;;) {
             int r = reservations.get();
 
-            if (r == -1) // Invalidated by successful canEvict call.
+            if (r == -1) // Invalidated.
                 return false;
 
             assert r >= 0 : r;
@@ -224,20 +231,21 @@ public class GridDhtPartitionsReservation implements GridReservable {
         // Unpublish.
         CI1<GridDhtPartitionsReservation> u = unpublish.get();
 
-        if (u != null && unpublish.compareAndSet(u, null))
+        if (u != null && u != NO_OP && unpublish.compareAndSet(u, NO_OP))
             u.apply(this);
     }
 
     /**
      * Must be checked in {@link GridDhtLocalPartition#tryEvict(boolean)}.
-     * If returns {@code true} then probably partition will be evicted (or at least cleared),
-     * so this reservation object becomes invalid and must be dropped from the partition.
+     * If returns {@code true} this reservation object becomes invalid and partitions
+     * can be evicted or at least cleared.
      * Also this means that after returning {@code true} here method {@link #reserve()} can not
      * return {@code true} anymore.
      *
-     * @return {@code true} If this reservation is NOT reserved and partition CAN be evicted.
+     * @return {@code true} If this reservation was successfully invalidated because it was not
+     *          reserved and partitions can be evicted.
      */
-    public boolean canEvict() {
+    public boolean invalidate() {
         assert parts.get() != null : "all parts must be reserved before registration";
 
         int r = reservations.get();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1fc7b5d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
index d440b13..527dfea 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
@@ -177,7 +177,7 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
      * @throws Exception If failed.
      */
     public void testRestarts() throws Exception {
-        int duration = 150 * 1000;
+        int duration = 90 * 1000;
         int qryThreadNum = 4;
         int restartThreadsNum = 2; // 4 + 2 = 6 nodes
         final int nodeLifeTime = 2 * 1000;
@@ -197,6 +197,9 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
 
         final List<List<?>> rRes = grid(0).cache("co").query(new SqlFieldsQuery(REPLICATED_QRY)).getAll();
 
+        assertFalse(pRes.isEmpty());
+        assertFalse(rRes.isEmpty());
+
         final AtomicInteger qryCnt = new AtomicInteger();
 
         final AtomicBoolean qrysDone = new AtomicBoolean();
@@ -235,7 +238,8 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
                                 if (!(th instanceof CacheException))
                                     continue;
 
-                                if (th.getMessage().startsWith("Failed to fetch data from node:")) {
+                                if (th.getMessage() != null &&
+                                    th.getMessage().startsWith("Failed to fetch data from node:")) {
                                     failedOnRemoteFetch = true;
 
                                     break;


[35/50] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6


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

Branch: refs/heads/ignite-950
Commit: cb862b65ffc1e0ecfc9a93b6af10881586df1ede
Parents: 5011c2b ca81476
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 18 14:50:56 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 18 14:50:56 2015 +0300

----------------------------------------------------------------------
 .../datastreamer/DataStreamerMultiThreadedSelfTest.java           | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------



[46/50] incubator-ignite git commit: 1.1.4-SNAPSHOT

Posted by sb...@apache.org.
1.1.4-SNAPSHOT


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

Branch: refs/heads/ignite-950
Commit: 4d9868a0efd8a55cc7ec4abc9472053bf17c05be
Parents: ad0a026
Author: Ignite Teamcity <ig...@apache.org>
Authored: Fri Jun 19 12:24:27 2015 +0300
Committer: Ignite Teamcity <ig...@apache.org>
Committed: Fri Jun 19 12:24:27 2015 +0300

----------------------------------------------------------------------
 examples/pom.xml                                  | 2 +-
 modules/aop/pom.xml                               | 2 +-
 modules/aws/pom.xml                               | 2 +-
 modules/clients/pom.xml                           | 2 +-
 modules/cloud/pom.xml                             | 2 +-
 modules/codegen/pom.xml                           | 2 +-
 modules/core/pom.xml                              | 2 +-
 modules/core/src/main/resources/ignite.properties | 2 +-
 modules/extdata/p2p/pom.xml                       | 2 +-
 modules/extdata/uri/pom.xml                       | 2 +-
 modules/gce/pom.xml                               | 2 +-
 modules/geospatial/pom.xml                        | 2 +-
 modules/hadoop/pom.xml                            | 2 +-
 modules/hibernate/pom.xml                         | 2 +-
 modules/indexing/pom.xml                          | 2 +-
 modules/jcl/pom.xml                               | 2 +-
 modules/jta/pom.xml                               | 2 +-
 modules/log4j/pom.xml                             | 2 +-
 modules/mesos/pom.xml                             | 2 +-
 modules/rest-http/pom.xml                         | 2 +-
 modules/scalar-2.10/pom.xml                       | 2 +-
 modules/scalar/pom.xml                            | 2 +-
 modules/schedule/pom.xml                          | 2 +-
 modules/schema-import/pom.xml                     | 2 +-
 modules/slf4j/pom.xml                             | 2 +-
 modules/spark-2.10/pom.xml                        | 2 +-
 modules/spark/pom.xml                             | 2 +-
 modules/spring/pom.xml                            | 2 +-
 modules/ssh/pom.xml                               | 2 +-
 modules/tools/pom.xml                             | 2 +-
 modules/urideploy/pom.xml                         | 2 +-
 modules/visor-console-2.10/pom.xml                | 2 +-
 modules/visor-console/pom.xml                     | 2 +-
 modules/visor-plugins/pom.xml                     | 2 +-
 modules/web/pom.xml                               | 2 +-
 modules/yardstick/pom.xml                         | 2 +-
 pom.xml                                           | 2 +-
 37 files changed, 37 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 8422402..834b5b4 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -28,7 +28,7 @@
     </parent>
 
     <artifactId>ignite-examples</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/aop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/aop/pom.xml b/modules/aop/pom.xml
index 1119301..e9cc980 100644
--- a/modules/aop/pom.xml
+++ b/modules/aop/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-aop</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/aws/pom.xml
----------------------------------------------------------------------
diff --git a/modules/aws/pom.xml b/modules/aws/pom.xml
index 3b1f3c6..1d3b1f3 100644
--- a/modules/aws/pom.xml
+++ b/modules/aws/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-aws</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/clients/pom.xml
----------------------------------------------------------------------
diff --git a/modules/clients/pom.xml b/modules/clients/pom.xml
index dfde946..6b28630 100644
--- a/modules/clients/pom.xml
+++ b/modules/clients/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-clients</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/cloud/pom.xml
----------------------------------------------------------------------
diff --git a/modules/cloud/pom.xml b/modules/cloud/pom.xml
index b45b503..0c9cd3d 100644
--- a/modules/cloud/pom.xml
+++ b/modules/cloud/pom.xml
@@ -29,7 +29,7 @@
     </parent>
 
     <artifactId>ignite-cloud</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <properties>
         <jcloud.version>1.9.0</jcloud.version>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/codegen/pom.xml
----------------------------------------------------------------------
diff --git a/modules/codegen/pom.xml b/modules/codegen/pom.xml
index 94154ea..5b7f518 100644
--- a/modules/codegen/pom.xml
+++ b/modules/codegen/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-codegen</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index b81cc63..d84cef0 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-core</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/core/src/main/resources/ignite.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/ignite.properties b/modules/core/src/main/resources/ignite.properties
index 32d6d1f..1be362f 100644
--- a/modules/core/src/main/resources/ignite.properties
+++ b/modules/core/src/main/resources/ignite.properties
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-ignite.version=1.1.3-SNAPSHOT
+ignite.version=1.1.4-SNAPSHOT
 ignite.build=0
 ignite.revision=DEV
 ignite.rel.date=01011970

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/extdata/p2p/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/pom.xml b/modules/extdata/p2p/pom.xml
index 0ee5e75..d849117 100644
--- a/modules/extdata/p2p/pom.xml
+++ b/modules/extdata/p2p/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-extdata-p2p</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/extdata/uri/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/pom.xml b/modules/extdata/uri/pom.xml
index 633df8b..e62738e 100644
--- a/modules/extdata/uri/pom.xml
+++ b/modules/extdata/uri/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-extdata-uri</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/gce/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gce/pom.xml b/modules/gce/pom.xml
index 2da3a6c..ff582bd 100644
--- a/modules/gce/pom.xml
+++ b/modules/gce/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-gce</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/geospatial/pom.xml
----------------------------------------------------------------------
diff --git a/modules/geospatial/pom.xml b/modules/geospatial/pom.xml
index 4f71637..bcad0b0 100644
--- a/modules/geospatial/pom.xml
+++ b/modules/geospatial/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-geospatial</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index ef26445..1884271 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-hadoop</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/hibernate/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/pom.xml b/modules/hibernate/pom.xml
index b4da498..dac4b3b 100644
--- a/modules/hibernate/pom.xml
+++ b/modules/hibernate/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-hibernate</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/indexing/pom.xml
----------------------------------------------------------------------
diff --git a/modules/indexing/pom.xml b/modules/indexing/pom.xml
index 451e801..91811d2 100644
--- a/modules/indexing/pom.xml
+++ b/modules/indexing/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-indexing</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/jcl/pom.xml
----------------------------------------------------------------------
diff --git a/modules/jcl/pom.xml b/modules/jcl/pom.xml
index 0b0f2a6..d100d4a 100644
--- a/modules/jcl/pom.xml
+++ b/modules/jcl/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-jcl</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/jta/pom.xml
----------------------------------------------------------------------
diff --git a/modules/jta/pom.xml b/modules/jta/pom.xml
index b4d6a5a..d44f9a8 100644
--- a/modules/jta/pom.xml
+++ b/modules/jta/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-jta</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/log4j/pom.xml
----------------------------------------------------------------------
diff --git a/modules/log4j/pom.xml b/modules/log4j/pom.xml
index 2c5e15e..7cb43cc 100644
--- a/modules/log4j/pom.xml
+++ b/modules/log4j/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-log4j</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/mesos/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mesos/pom.xml b/modules/mesos/pom.xml
index d718a65..1c44422 100644
--- a/modules/mesos/pom.xml
+++ b/modules/mesos/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-mesos</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <properties>
         <jetty.version>9.2.10.v20150310</jetty.version>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/rest-http/pom.xml
----------------------------------------------------------------------
diff --git a/modules/rest-http/pom.xml b/modules/rest-http/pom.xml
index 18ec434..686a3ce 100644
--- a/modules/rest-http/pom.xml
+++ b/modules/rest-http/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-rest-http</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/scalar-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar-2.10/pom.xml b/modules/scalar-2.10/pom.xml
index 71c1ec9..2ce2de1 100644
--- a/modules/scalar-2.10/pom.xml
+++ b/modules/scalar-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-scalar_2.10</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/scalar/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar/pom.xml b/modules/scalar/pom.xml
index 635b874..5863f4a 100644
--- a/modules/scalar/pom.xml
+++ b/modules/scalar/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-scalar</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/schedule/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schedule/pom.xml b/modules/schedule/pom.xml
index 0c73aa0..86d0ab6 100644
--- a/modules/schedule/pom.xml
+++ b/modules/schedule/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-schedule</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import/pom.xml b/modules/schema-import/pom.xml
index 92b9da8..59c5d63 100644
--- a/modules/schema-import/pom.xml
+++ b/modules/schema-import/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-schema-import</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/slf4j/pom.xml
----------------------------------------------------------------------
diff --git a/modules/slf4j/pom.xml b/modules/slf4j/pom.xml
index 22f538f..90e7031 100644
--- a/modules/slf4j/pom.xml
+++ b/modules/slf4j/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-slf4j</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/spark-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spark-2.10/pom.xml b/modules/spark-2.10/pom.xml
index 5e5d78e..f664aa0 100644
--- a/modules/spark-2.10/pom.xml
+++ b/modules/spark-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spark_2.10</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/spark/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spark/pom.xml b/modules/spark/pom.xml
index 244fa3c..577ae57 100644
--- a/modules/spark/pom.xml
+++ b/modules/spark/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spark</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/spring/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spring/pom.xml b/modules/spring/pom.xml
index 85f57bb..d43d337 100644
--- a/modules/spring/pom.xml
+++ b/modules/spring/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spring</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/ssh/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ssh/pom.xml b/modules/ssh/pom.xml
index dcd74d8..3e9ac77 100644
--- a/modules/ssh/pom.xml
+++ b/modules/ssh/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-ssh</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/tools/pom.xml
----------------------------------------------------------------------
diff --git a/modules/tools/pom.xml b/modules/tools/pom.xml
index 41e4f8a..7b07260 100644
--- a/modules/tools/pom.xml
+++ b/modules/tools/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-tools</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/urideploy/pom.xml
----------------------------------------------------------------------
diff --git a/modules/urideploy/pom.xml b/modules/urideploy/pom.xml
index 7970f4b..5d7bf4c 100644
--- a/modules/urideploy/pom.xml
+++ b/modules/urideploy/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-urideploy</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/visor-console-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console-2.10/pom.xml b/modules/visor-console-2.10/pom.xml
index f5116bd..c3d9045 100644
--- a/modules/visor-console-2.10/pom.xml
+++ b/modules/visor-console-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-console_2.10</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/visor-console/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console/pom.xml b/modules/visor-console/pom.xml
index 885afe1..f8627da 100644
--- a/modules/visor-console/pom.xml
+++ b/modules/visor-console/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-console</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/visor-plugins/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-plugins/pom.xml b/modules/visor-plugins/pom.xml
index 51680fa..dd5cbe0 100644
--- a/modules/visor-plugins/pom.xml
+++ b/modules/visor-plugins/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-plugins</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <!-- Ignite dependencies -->

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/web/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web/pom.xml b/modules/web/pom.xml
index 97901ba..4e8a50f 100644
--- a/modules/web/pom.xml
+++ b/modules/web/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-web</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/modules/yardstick/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/pom.xml b/modules/yardstick/pom.xml
index c4cb122..84a8336 100644
--- a/modules/yardstick/pom.xml
+++ b/modules/yardstick/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-yardstick</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <properties>
         <yardstick.version>0.7.0</yardstick.version>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d9868a0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 84e1c79..64f9e25 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
 
     <groupId>org.apache.ignite</groupId>
     <artifactId>apache-ignite</artifactId>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.4-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <properties>


[26/50] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6


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

Branch: refs/heads/ignite-950
Commit: 6c683c28f5bde0cf22ac7482bc381c861a2c6a62
Parents: cc20ef6 45939ac
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jun 18 10:36:28 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jun 18 10:36:28 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java    | 2 +-
 .../apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java | 4 ++--
 .../spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java      | 2 +-
 .../ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java    | 2 +-
 .../tcp/ipfinder/s3/TcpDiscoveryS3IpFinderSelfTest.java          | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[25/50] incubator-ignite git commit: #Fixed aws tests. (Changed bucket name)

Posted by sb...@apache.org.
#Fixed aws tests. (Changed bucket name)


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

Branch: refs/heads/ignite-950
Commit: 45939ace51cd081ac1c755ca0b6076a22f00cfb5
Parents: de53189
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jun 18 10:30:33 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jun 18 10:31:31 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java    | 2 +-
 .../apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java | 4 ++--
 .../spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java      | 2 +-
 .../ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java    | 2 +-
 .../tcp/ipfinder/s3/TcpDiscoveryS3IpFinderSelfTest.java          | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45939ace/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java
index a354e67..b01ba81 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java
@@ -39,7 +39,7 @@ public class S3CheckpointManagerSelfTest extends GridCheckpointManagerAbstractSe
 
         spi.setAwsCredentials(cred);
 
-        spi.setBucketNameSuffix("test-bucket");
+        spi.setBucketNameSuffix("unit-test-bucket");
 
         cfg.setCheckpointSpi(spi);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45939ace/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java
index 5cf0f2e..5894678 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java
@@ -48,7 +48,7 @@ public class S3CheckpointSpiSelfTest extends GridSpiAbstractTest<S3CheckpointSpi
 
         spi.setAwsCredentials(cred);
 
-        spi.setBucketNameSuffix("test-bucket");
+        spi.setBucketNameSuffix("unit-test-bucket");
 
         super.spiConfigure(spi);
     }
@@ -62,7 +62,7 @@ public class S3CheckpointSpiSelfTest extends GridSpiAbstractTest<S3CheckpointSpi
 
         AmazonS3 s3 = new AmazonS3Client(cred);
 
-        String bucketName = S3CheckpointSpi.BUCKET_NAME_PREFIX + "test-bucket";
+        String bucketName = S3CheckpointSpi.BUCKET_NAME_PREFIX + "unit-test-bucket";
 
         try {
             ObjectListing list = s3.listObjects(bucketName);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45939ace/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java
index 7de2124..34f25ad 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java
@@ -34,7 +34,7 @@ public class S3CheckpointSpiStartStopSelfTest extends GridSpiStartStopAbstractTe
 
         spi.setAwsCredentials(cred);
 
-        spi.setBucketNameSuffix("test-bucket");
+        spi.setBucketNameSuffix("unit-test-bucket");
 
         super.spiConfigure(spi);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45939ace/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java
index 56f39de..c683cb3 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java
@@ -39,7 +39,7 @@ public class S3SessionCheckpointSelfTest extends GridSessionCheckpointAbstractSe
 
         spi.setAwsCredentials(cred);
 
-        spi.setBucketNameSuffix("test-bucket");
+        spi.setBucketNameSuffix("unit-test-bucket");
 
         cfg.setCheckpointSpi(spi);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45939ace/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderSelfTest.java
index 709145b..8a7b528 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderSelfTest.java
@@ -51,7 +51,7 @@ public class TcpDiscoveryS3IpFinderSelfTest
             IgniteS3TestSuite.getSecretKey()));
 
         // Bucket name should be unique for the host to parallel test run on one bucket.
-        finder.setBucketName("ip-finder-test-bucket-" + InetAddress.getLocalHost().getAddress()[3]);
+        finder.setBucketName("ip-finder-unit-test-bucket-" + InetAddress.getLocalHost().getAddress()[3]);
 
         for (int i = 0; i < 5; i++) {
             Collection<InetSocketAddress> addrs = finder.getRegisteredAddresses();


[07/50] incubator-ignite git commit: Merge branches 'ignite-484-1' and 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-484-1

Posted by sb...@apache.org.
Merge branches 'ignite-484-1' and 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-484-1


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

Branch: refs/heads/ignite-950
Commit: 0b8587ba81400a5227e8d3bb8be52f8c0d7d179f
Parents: c1fc7b5 5218210
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 17 14:40:23 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 17 14:40:23 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    | 13 +-----------
 .../client/GridClientConfiguration.java         |  2 +-
 .../GridClientOptimizedMarshaller.java          | 21 ++++++++++++++++++++
 .../impl/GridTcpRouterNioListenerAdapter.java   |  2 +-
 .../rest/protocols/tcp/GridTcpRestProtocol.java |  3 ++-
 .../ignite/internal/util/IgniteUtils.java       | 21 ++++++++++++++++++++
 6 files changed, 47 insertions(+), 15 deletions(-)
----------------------------------------------------------------------



[40/50] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6


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

Branch: refs/heads/ignite-950
Commit: 8c404f78cc264ddf43c71904b9fbac40ce0ee418
Parents: 4f3292d 4d1fa72
Author: nikolay tikhonov <nt...@gridgain.com>
Authored: Thu Jun 18 15:19:58 2015 +0300
Committer: nikolay tikhonov <nt...@gridgain.com>
Committed: Thu Jun 18 15:19:58 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheUtils.java        |  9 +++++
 .../processors/cache/IgniteCacheProxy.java      |  5 +++
 .../processors/query/GridQueryProcessor.java    |  7 ++++
 .../communication/tcp/TcpCommunicationSpi.java  | 42 ++++++++++----------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 31 +++++++++++----
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 41 +++++++++++++------
 .../tcp/internal/TcpDiscoveryNode.java          | 18 +++++++++
 .../DataStreamerMultiThreadedSelfTest.java      |  3 ++
 8 files changed, 115 insertions(+), 41 deletions(-)
----------------------------------------------------------------------



[41/50] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6


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

Branch: refs/heads/ignite-950
Commit: ad0a026f480ff67025b39737c2e068b20035feb6
Parents: fc81bcf 8c404f7
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 18 15:54:59 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 18 15:54:59 2015 +0300

----------------------------------------------------------------------
 .../communication/tcp/TcpCommunicationSpi.java  | 38 ++++++++++----------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 21 +++++++----
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  9 ++++-
 .../tcp/internal/TcpDiscoveryNode.java          | 18 ++++++++++
 .../apache/ignite/internal/GridSelfTest.java    | 20 ++++++-----
 5 files changed, 72 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad0a026f/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad0a026f/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------


[04/50] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6


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

Branch: refs/heads/ignite-950
Commit: 9c0b09c58965091e866d0ebdba8055d5471c6e9a
Parents: f173f91 dc05e88
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Wed Jun 17 12:34:04 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Wed Jun 17 12:34:04 2015 +0300

----------------------------------------------------------------------
 examples/pom.xml                                  | 2 +-
 modules/aop/pom.xml                               | 2 +-
 modules/aws/pom.xml                               | 2 +-
 modules/clients/pom.xml                           | 2 +-
 modules/cloud/pom.xml                             | 2 +-
 modules/codegen/pom.xml                           | 2 +-
 modules/core/pom.xml                              | 2 +-
 modules/core/src/main/resources/ignite.properties | 2 +-
 modules/extdata/p2p/pom.xml                       | 2 +-
 modules/extdata/uri/pom.xml                       | 2 +-
 modules/gce/pom.xml                               | 2 +-
 modules/geospatial/pom.xml                        | 2 +-
 modules/hadoop/pom.xml                            | 2 +-
 modules/hibernate/pom.xml                         | 2 +-
 modules/indexing/pom.xml                          | 2 +-
 modules/jcl/pom.xml                               | 2 +-
 modules/jta/pom.xml                               | 2 +-
 modules/log4j/pom.xml                             | 2 +-
 modules/mesos/pom.xml                             | 2 +-
 modules/rest-http/pom.xml                         | 2 +-
 modules/scalar-2.10/pom.xml                       | 2 +-
 modules/scalar/pom.xml                            | 2 +-
 modules/schedule/pom.xml                          | 2 +-
 modules/schema-import/pom.xml                     | 2 +-
 modules/slf4j/pom.xml                             | 2 +-
 modules/spark-2.10/pom.xml                        | 2 +-
 modules/spark/pom.xml                             | 2 +-
 modules/spring/pom.xml                            | 2 +-
 modules/ssh/pom.xml                               | 2 +-
 modules/tools/pom.xml                             | 2 +-
 modules/urideploy/pom.xml                         | 2 +-
 modules/visor-console-2.10/pom.xml                | 2 +-
 modules/visor-console/pom.xml                     | 2 +-
 modules/visor-plugins/pom.xml                     | 2 +-
 modules/web/pom.xml                               | 2 +-
 modules/yardstick/pom.xml                         | 2 +-
 pom.xml                                           | 2 +-
 37 files changed, 37 insertions(+), 37 deletions(-)
----------------------------------------------------------------------



[11/50] incubator-ignite git commit: ignite-484-1 - replicated cache group reservation fix + drop reservations group for dead nodes

Posted by sb...@apache.org.
ignite-484-1 - replicated cache group reservation fix + drop reservations group for dead nodes


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

Branch: refs/heads/ignite-950
Commit: 1fe215e2cc83954f25cc7c2f0974dcf312694eb8
Parents: 68c35e7
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 17 15:57:24 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 17 15:57:24 2015 +0300

----------------------------------------------------------------------
 .../query/h2/twostep/GridMapQueryExecutor.java  | 22 ++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fe215e2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 42f01cb..aaf64ee 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -123,6 +123,18 @@ public class GridMapQueryExecutor {
             }
         }, EventType.EVT_NODE_FAILED, EventType.EVT_NODE_LEFT);
 
+        // Drop group reservations for dead caches.
+        ctx.event().addLocalEventListener(new GridLocalEventListener() {
+            @Override public void onEvent(Event evt) {
+                String cacheName = ((CacheEvent)evt).cacheName();
+
+                for (T2<String,AffinityTopologyVersion> grpKey : reservations.keySet()) {
+                    if (F.eq(grpKey.get1(), cacheName))
+                        reservations.remove(grpKey);
+                }
+            }
+        }, EventType.EVT_CACHE_STOPPED);
+
         ctx.io().addMessageListener(GridTopic.TOPIC_QUERY, new GridMessageListener() {
             @Override public void onMessage(UUID nodeId, Object msg) {
                 if (!busyLock.enterBusy())
@@ -244,7 +256,9 @@ public class GridMapQueryExecutor {
             if (cctx.isLocal())
                 continue;
 
-            final T2<String,AffinityTopologyVersion> grpKey = new T2<>(cctx.name(), topVer);
+            // For replicated cache topology version does not make sense.
+            final T2<String,AffinityTopologyVersion> grpKey =
+                new T2<>(cctx.name(), cctx.isReplicated() ? null : topVer);
 
             GridReservable r = reservations.get(grpKey);
 
@@ -265,10 +279,10 @@ public class GridMapQueryExecutor {
                             // We don't need to reserve partitions because they will not be evicted in replicated caches.
                             if (part == null || part.state() != OWNING)
                                 return false;
-
-                            // Mark that we checked this replicated cache.
-                            reservations.putIfAbsent(grpKey, ReplicatedReservation.INSTANCE);
                         }
+
+                        // Mark that we checked this replicated cache.
+                        reservations.putIfAbsent(grpKey, ReplicatedReservation.INSTANCE);
                     }
                 }
                 else { // Reserve primary partitions for partitioned cache (if no explicit given).


[29/50] incubator-ignite git commit: # minor

Posted by sb...@apache.org.
# minor


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

Branch: refs/heads/ignite-950
Commit: 08d134dd43f143ee8d01f6394de27426c64a96ea
Parents: d874b00
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 18 13:46:52 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 18 13:46:52 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/cache/GridCacheUtils.java    | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/08d134dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 3bd2a45..8c26046 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -391,6 +391,15 @@ public class GridCacheUtils {
     }
 
     /**
+     * Gets public cache name substituting null name by {@code 'default'}.
+     *
+     * @return Public cache name substituting null name by {@code 'default'}.
+     */
+    public static String namexx(@Nullable String name) {
+        return name == null ? "default" : name;
+    }
+
+    /**
      * @return Partition to state transformer.
      */
     @SuppressWarnings({"unchecked"})


[16/50] incubator-ignite git commit: Merge branches 'ignite-484-1' and 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-484-1

Posted by sb...@apache.org.
Merge branches 'ignite-484-1' and 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-484-1


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

Branch: refs/heads/ignite-950
Commit: efb4244779b94c9c9f35c63708e4a41da2430bce
Parents: 94060c9 4298238 af829d0
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 17 19:50:12 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 17 19:50:12 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      |   4 +
 .../processors/cache/IgniteCacheProxy.java      |   7 +
 .../dht/GridDhtTransactionalCacheAdapter.java   |   2 +-
 .../cache/transactions/IgniteTxHandler.java     |   2 +-
 .../transactions/IgniteTxLocalAdapter.java      |  12 +-
 .../dr/IgniteDrDataStreamerCacheUpdater.java    |   7 +-
 .../CacheStoreUsageMultinodeAbstractTest.java   | 305 +++++++++++++++++++
 ...eUsageMultinodeDynamicStartAbstractTest.java | 169 ++++++++++
 ...oreUsageMultinodeDynamicStartAtomicTest.java |  32 ++
 ...heStoreUsageMultinodeDynamicStartTxTest.java |  32 ++
 ...reUsageMultinodeStaticStartAbstractTest.java | 158 ++++++++++
 ...toreUsageMultinodeStaticStartAtomicTest.java |  32 ++
 ...cheStoreUsageMultinodeStaticStartTxTest.java |  32 ++
 .../testsuites/IgniteCacheTestSuite4.java       |   4 +
 .../h2/twostep/GridReduceQueryExecutor.java     |   3 +-
 15 files changed, 793 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efb42447/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 6635dde,6c407d9,11054b7..b956167
--- 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
@@@@ -273,514 -273,477 -265,113 +273,515 @@@@ public class GridReduceQueryExecutor 
       }
   
       /**
  +     * @param r Query run.
  +     * @param retryVer Retry version.
  +     * @param nodeId Node ID.
  +     */
  +    private void retry(QueryRun r, AffinityTopologyVersion retryVer, UUID nodeId) {
  +        r.state(retryVer, nodeId);
  +    }
  +
  +    /**
  +     * @param cctx Cache context for main space.
  +     * @param extraSpaces Extra spaces.
  +     * @return {@code true} If preloading is active.
  +     */
  +    private boolean isPreloadingActive(final GridCacheContext<?,?> cctx, List<String> extraSpaces) {
  +        if (hasMovingPartitions(cctx))
  +            return true;
  +
  +        if (extraSpaces != null) {
  +            for (String extraSpace : extraSpaces) {
  +                if (hasMovingPartitions(cacheContext(extraSpace)))
  +                    return true;
  +            }
  +        }
  +
  +        return false;
  +    }
  +
  +    /**
  +     * @return {@code true} If cache context
  +     */
  +    private boolean hasMovingPartitions(GridCacheContext<?,?> cctx) {
  +        GridDhtPartitionFullMap fullMap = cctx.topology().partitionMap(false);
  +
  +        for (GridDhtPartitionMap map : fullMap.values()) {
  +            if (map.hasMovingPartitions())
  +                return true;
  +        }
  +
  +        return false;
  +    }
  +
  +    /**
  +     * @param name Cache name.
  +     * @return Cache context.
  +     */
  +    private GridCacheContext<?,?> cacheContext(String name) {
  +        return ctx.cache().internalCache(name).context();
  +    }
  +
  +    /**
  +     * @param topVer Topology version.
  +     * @param cctx Cache context for main space.
  +     * @param extraSpaces Extra spaces.
  +     * @return Data nodes or {@code null} if repartitioning started and we need to retry..
  +     */
  +    private Collection<ClusterNode> stableDataNodes(
  +        AffinityTopologyVersion topVer,
  +        final GridCacheContext<?,?> cctx,
  +        List<String> extraSpaces
  +    ) {
  +        String space = cctx.name();
  +
 -         Set<ClusterNode> nodes = new HashSet<>(ctx.discovery().cacheAffinityNodes(space, topVer));
 ++        Set<ClusterNode> nodes = new HashSet<>(dataNodes(space, topVer));
  +
  +        if (F.isEmpty(nodes))
  +            throw new CacheException("No data nodes found for cache: " + space);
  +
  +        if (!F.isEmpty(extraSpaces)) {
  +            for (String extraSpace : extraSpaces) {
  +                GridCacheContext<?,?> extraCctx = cacheContext(extraSpace);
  +
  +                if (extraCctx.isLocal())
  +                    continue; // No consistency guaranties for local caches.
  +
  +                if (cctx.isReplicated() && !extraCctx.isReplicated())
  +                    throw new CacheException("Queries running on replicated cache should not contain JOINs " +
  +                        "with partitioned tables.");
  +
 -                 Collection<ClusterNode> extraNodes = ctx.discovery().cacheAffinityNodes(extraSpace, topVer);
 ++                Collection<ClusterNode> extraNodes = dataNodes(extraSpace, topVer);
  +
  +                if (F.isEmpty(extraNodes))
  +                    throw new CacheException("No data nodes found for cache: " + extraSpace);
  +
  +                if (cctx.isReplicated() && extraCctx.isReplicated()) {
  +                    nodes.retainAll(extraNodes);
  +
  +                    if (nodes.isEmpty()) {
  +                        if (isPreloadingActive(cctx, extraSpaces))
  +                            return null; // Retry.
  +                        else
  +                            throw new CacheException("Caches '" + cctx.name() + "' and '" + extraSpace +
  +                                "' have distinct set of data nodes.");
  +                    }
  +                }
  +                else if (!cctx.isReplicated() && extraCctx.isReplicated()) {
  +                    if (!extraNodes.containsAll(nodes))
  +                        if (isPreloadingActive(cctx, extraSpaces))
  +                            return null; // Retry.
  +                        else
  +                            throw new CacheException("Caches '" + cctx.name() + "' and '" + extraSpace +
  +                                "' have distinct set of data nodes.");
  +                }
  +                else if (!cctx.isReplicated() && !extraCctx.isReplicated()) {
  +                    if (extraNodes.size() != nodes.size() || !nodes.containsAll(extraNodes))
  +                        if (isPreloadingActive(cctx, extraSpaces))
  +                            return null; // Retry.
  +                        else
  +                            throw new CacheException("Caches '" + cctx.name() + "' and '" + extraSpace +
  +                                "' have distinct set of data nodes.");
  +                }
  +                else
  +                    throw new IllegalStateException();
  +            }
  +        }
  +
  +        return nodes;
  +    }
  +
  +    /**
        * @param cctx Cache context.
        * @param qry Query.
  +     * @param keepPortable Keep portable.
        * @return Cursor.
        */
       public Iterator<List<?>> query(GridCacheContext<?,?> cctx, GridCacheTwoStepQuery qry, boolean keepPortable) {
 -         for (;;) {
  -        long qryReqId = reqIdGen.incrementAndGet();
 ++        for (int attempt = 0;; attempt++) {
 ++            if (attempt != 0) {
 ++                try {
 ++                    Thread.sleep(attempt * 10); // Wait for exchange.
 ++                }
 ++                catch (InterruptedException e) {
 ++                    Thread.currentThread().interrupt();
 + 
  -        QueryRun r = new QueryRun();
 ++                    throw new CacheException("Query was interrupted.", e);
 ++                }
 ++            }
 + 
  -        r.pageSize = qry.pageSize() <= 0 ? GridCacheTwoStepQuery.DFLT_PAGE_SIZE : qry.pageSize();
  +            long qryReqId = reqIdGen.incrementAndGet();
   
  -        r.tbls = new ArrayList<>(qry.mapQueries().size());
  +            QueryRun r = new QueryRun();
   
  -        String space = cctx.name();
  +            r.pageSize = qry.pageSize() <= 0 ? GridCacheTwoStepQuery.DFLT_PAGE_SIZE : qry.pageSize();
   
  -        r.conn = (JdbcConnection)h2.connectionForSpace(space);
  +            r.tbls = new ArrayList<>(qry.mapQueries().size());
   
  -        // TODO    Add topology version.
  -        ClusterGroup dataNodes = ctx.grid().cluster().forDataNodes(space);
  +            String space = cctx.name();
   
  -        if (cctx.isReplicated() || qry.explain()) {
  -            assert qry.explain() || dataNodes.node(ctx.localNodeId()) == null : "We must be on a client node.";
  +            r.conn = (JdbcConnection)h2.connectionForSpace(space);
   
  -            // Select random data node to run query on a replicated data or get EXPLAIN PLAN from a single node.
  -            dataNodes = dataNodes.forRandom();
  -        }
  +            AffinityTopologyVersion topVer = h2.readyTopologyVersion();
   
  -        final Collection<ClusterNode> nodes = dataNodes.nodes();
  +            List<String> extraSpaces = extraSpaces(space, qry.spaces());
   
  -        for (GridCacheSqlQuery mapQry : qry.mapQueries()) {
  -            GridMergeTable tbl;
  +            Collection<ClusterNode> nodes;
  +
  +            // Explicit partition mapping for unstable topology.
  +            Map<ClusterNode, IntArray> partsMap = null;
  +
  +            if (isPreloadingActive(cctx, extraSpaces)) {
  +                if (cctx.isReplicated())
 -                     nodes = replicatedDataNodes(cctx, extraSpaces);
 ++                    nodes = replicatedUnstableDataNodes(cctx, extraSpaces);
  +                else {
 -                     partsMap = partitionLocations(cctx, extraSpaces);
 ++                    partsMap = partitionedUnstableDataNodes(cctx, extraSpaces);
  +
  +                    nodes = partsMap == null ? null : partsMap.keySet();
  +                }
  +            }
  +            else
  +                nodes = stableDataNodes(topVer, cctx, extraSpaces);
  +
  +            if (nodes == null)
  +                continue; // Retry.
  +
  +            assert !nodes.isEmpty();
  +
  +            if (cctx.isReplicated() || qry.explain()) {
-                  assert qry.explain() || !nodes.contains(ctx.cluster().get().localNode()) : "We must be on a client node.";
+ +                assert qry.explain() || !nodes.contains(ctx.cluster().get().localNode()) :
+ +                    "We must be on a client node.";
  +
  +                // Select random data node to run query on a replicated data or get EXPLAIN PLAN from a single node.
  +                nodes = Collections.singleton(F.rand(nodes));
  +            }
  +
  +            for (GridCacheSqlQuery mapQry : qry.mapQueries()) {
  +                GridMergeTable tbl;
  +
  +                try {
  +                    tbl = createFunctionTable(r.conn, mapQry, qry.explain()); // createTable(r.conn, mapQry); TODO
  +                }
  +                catch (IgniteCheckedException e) {
  +                    throw new IgniteException(e);
  +                }
  +
  +                GridMergeIndex idx = tbl.getScanIndex(null);
  +
  +                for (ClusterNode node : nodes)
  +                    idx.addSource(node.id());
  +
  +                r.tbls.add(tbl);
  +
  +                curFunTbl.set(tbl);
  +            }
  +
  +            r.latch = new CountDownLatch(r.tbls.size() * nodes.size());
  +
  +            runs.put(qryReqId, r);
   
               try {
  -                tbl = createFunctionTable(r.conn, mapQry, qry.explain()); // createTable(r.conn, mapQry); TODO
  +                Collection<GridCacheSqlQuery> mapQrys = qry.mapQueries();
  +
  +                if (qry.explain()) {
  +                    mapQrys = new ArrayList<>(qry.mapQueries().size());
  +
  +                    for (GridCacheSqlQuery mapQry : qry.mapQueries())
  +                        mapQrys.add(new GridCacheSqlQuery(mapQry.alias(), "EXPLAIN " + mapQry.query(), mapQry.parameters()));
  +                }
  +
  +                if (nodes.size() != 1 || !F.first(nodes).isLocal()) { // Marshall params for remotes.
  +                    Marshaller m = ctx.config().getMarshaller();
  +
  +                    for (GridCacheSqlQuery mapQry : mapQrys)
  +                        mapQry.marshallParams(m);
  +                }
  +
  +                boolean retry = false;
  +
  +                if (send(nodes,
  +                    new GridQueryRequest(qryReqId, r.pageSize, space, mapQrys, topVer, extraSpaces, null), partsMap)) {
  +                    U.await(r.latch);
  +
  +                    Object state = r.state.get();
  +
  +                    if (state != null) {
  +                        if (state instanceof CacheException)
  +                            throw new CacheException("Failed to run map query remotely.", (CacheException)state);
  +
  +                        if (state instanceof AffinityTopologyVersion) {
  +                            retry = true;
  +
  +                            // If remote node asks us to retry then we have outdated full partition map.
  +                            h2.awaitForReadyTopologyVersion((AffinityTopologyVersion)state);
  +                        }
  +                    }
  +                }
  +                else // Send failed.
  +                    retry = true;
  +
  +                ResultSet res = null;
  +
  +                if (!retry) {
  +                    if (qry.explain())
  +                        return explainPlan(r.conn, space, qry);
  +
  +                    GridCacheSqlQuery rdc = qry.reduceQuery();
  +
  +                    res = h2.executeSqlQueryWithTimer(space, r.conn, rdc.query(), F.asList(rdc.parameters()));
  +                }
  +
  +                for (GridMergeTable tbl : r.tbls) {
  +                    if (!tbl.getScanIndex(null).fetchedAll()) // We have to explicitly cancel queries on remote nodes.
  +                        send(nodes, new GridQueryCancelRequest(qryReqId), null);
  +
  +//                dropTable(r.conn, tbl.getName()); TODO
  +                }
  +
  +                if (retry) {
  +                    if (Thread.currentThread().isInterrupted())
  +                        throw new IgniteInterruptedCheckedException("Query was interrupted.");
  +
  +                    continue;
  +                }
  +
  +                return new GridQueryCacheObjectsIterator(new Iter(res), cctx, keepPortable);
               }
  -            catch (IgniteCheckedException e) {
  -                throw new IgniteException(e);
  +            catch (IgniteCheckedException | RuntimeException e) {
  +                U.closeQuiet(r.conn);
  +
 -                 if (e instanceof CacheException)
 -                     throw (CacheException)e;
 - 
  +                throw new CacheException("Failed to run reduce query locally.", e);
  +            }
  +            finally {
  +                if (!runs.remove(qryReqId, r))
  +                    U.warn(log, "Query run was already removed: " + qryReqId);
  +
  +                curFunTbl.remove();
               }
  +        }
  +    }
  +
  +    /**
  +     * Calculates data nodes for replicated caches on unstable topology.
  +     *
  +     * @param cctx Cache context for main space.
  +     * @param extraSpaces Extra spaces.
  +     * @return Collection of all data nodes owning all the caches or {@code null} for retry.
  +     */
 -     private Collection<ClusterNode> replicatedDataNodes(final GridCacheContext<?,?> cctx, List<String> extraSpaces) {
 ++    private Collection<ClusterNode> replicatedUnstableDataNodes(final GridCacheContext<?,?> cctx,
 ++        List<String> extraSpaces) {
  +        assert cctx.isReplicated() : cctx.name() + " must be replicated";
  +
 -         Set<ClusterNode> nodes = owningReplicatedDataNodes(cctx);
 ++        Set<ClusterNode> nodes = replicatedUnstableDataNodes(cctx);
 + 
  -            GridMergeIndex idx = tbl.getScanIndex(null);
 ++        if (F.isEmpty(nodes))
 ++            return null; // Retry.
   
  -            for (ClusterNode node : nodes)
  -                idx.addSource(node.id());
  +        if (!F.isEmpty(extraSpaces)) {
  +            for (String extraSpace : extraSpaces) {
  +                GridCacheContext<?,?> extraCctx = cacheContext(extraSpace);
   
  -            r.tbls.add(tbl);
  +                if (extraCctx.isLocal())
  +                    continue;
   
  -            curFunTbl.set(tbl);
  +                if (!extraCctx.isReplicated())
  +                    throw new CacheException("Queries running on replicated cache should not contain JOINs " +
  +                        "with partitioned tables.");
  +
 -                 nodes.retainAll(owningReplicatedDataNodes(extraCctx));
 ++                Set<ClusterNode> extraOwners = replicatedUnstableDataNodes(extraCctx);
 ++
 ++                if (F.isEmpty(extraOwners))
 ++                    return null; // Retry.
 ++
 ++                nodes.retainAll(extraOwners);
  +
  +                if (nodes.isEmpty())
  +                    return null; // Retry.
  +            }
           }
   
  -        r.latch = new CountDownLatch(r.tbls.size() * nodes.size());
  +        return nodes;
  +    }
  +
  +    /**
 ++     * @param space Cache name.
 ++     * @param topVer Topology version.
 ++     * @return Collection of data nodes.
 ++     */
 ++    private Collection<ClusterNode> dataNodes(String space, AffinityTopologyVersion topVer) {
 ++        Collection<ClusterNode> res = ctx.discovery().cacheAffinityNodes(space, topVer);
 + 
  -        runs.put(qryReqId, r);
 ++        return res != null ? res : Collections.<ClusterNode>emptySet();
 ++    }
 + 
  -        try {
  -            Collection<GridCacheSqlQuery> mapQrys = qry.mapQueries();
 ++    /**
  +     * Collects all the nodes owning all the partitions for the given replicated cache.
  +     *
  +     * @param cctx Cache context.
 -      * @return Owning nodes.
 ++     * @return Owning nodes or {@code null} if we can't find owners for some partitions.
  +     */
 -     private Set<ClusterNode> owningReplicatedDataNodes(GridCacheContext<?,?> cctx) {
 ++    private Set<ClusterNode> replicatedUnstableDataNodes(GridCacheContext<?,?> cctx) {
  +        assert cctx.isReplicated() : cctx.name() + " must be replicated";
  +
  +        String space = cctx.name();
  +
 -         Set<ClusterNode> dataNodes = new HashSet<>(ctx.discovery().cacheAffinityNodes(space, NONE));
 ++        Set<ClusterNode> dataNodes = new HashSet<>(dataNodes(space, NONE));
  +
  +        if (dataNodes.isEmpty())
  +            throw new CacheException("No data nodes found for cache '" + space + "'");
  +
  +        // Find all the nodes owning all the partitions for replicated cache.
 -         for (int p = 0, extraParts = cctx.affinity().partitions(); p < extraParts; p++) {
 ++        for (int p = 0, parts = cctx.affinity().partitions(); p < parts; p++) {
  +            List<ClusterNode> owners = cctx.topology().owners(p);
  +
 -             if (owners.isEmpty())
 -                 throw new CacheException("No data nodes found for cache '" + space +
 -                     "' for partition " + p);
 ++            if (F.isEmpty(owners))
 ++                return null; // Retry.
  +
  +            dataNodes.retainAll(owners);
  +
  +            if (dataNodes.isEmpty())
 -                 throw new CacheException("No data nodes found for cache '" + space +
 -                     "' owning all the partitions.");
 ++                return null; // Retry.
  +        }
  +
  +        return dataNodes;
  +    }
  +
  +    /**
  +     * Calculates partition mapping for partitioned cache on unstable topology.
  +     *
  +     * @param cctx Cache context for main space.
  +     * @param extraSpaces Extra spaces.
  +     * @return Partition mapping or {@code null} if we can't calculate it due to repartitioning and we need to retry.
  +     */
  +    @SuppressWarnings("unchecked")
 -     private Map<ClusterNode, IntArray> partitionLocations(final GridCacheContext<?,?> cctx, List<String> extraSpaces) {
 ++    private Map<ClusterNode, IntArray> partitionedUnstableDataNodes(final GridCacheContext<?,?> cctx,
 ++        List<String> extraSpaces) {
  +        assert !cctx.isReplicated() && !cctx.isLocal() : cctx.name() + " must be partitioned";
  +
  +        final int partsCnt = cctx.affinity().partitions();
  +
  +        if (extraSpaces != null) { // Check correct number of partitions for partitioned caches.
  +            for (String extraSpace : extraSpaces) {
  +                GridCacheContext<?,?> extraCctx = cacheContext(extraSpace);
   
  -            if (qry.explain()) {
  -                mapQrys = new ArrayList<>(qry.mapQueries().size());
  +                if (extraCctx.isReplicated() || extraCctx.isLocal())
  +                    continue;
   
  -                for (GridCacheSqlQuery mapQry : qry.mapQueries())
  -                    mapQrys.add(new GridCacheSqlQuery(mapQry.alias(), "EXPLAIN " + mapQry.query(), mapQry.parameters()));
  +                int parts = extraCctx.affinity().partitions();
  +
  +                if (parts != partsCnt)
  +                    throw new CacheException("Number of partitions must be the same for correct collocation in " +
  +                        "caches " + cctx.name() + " and " + extraSpace + ".");
               }
  +        }
  +
  +        Set<ClusterNode>[] partLocs = new Set[partsCnt];
   
  -            if (nodes.size() != 1 || !F.first(nodes).isLocal()) { // Marshall params for remotes.
  -                Marshaller m = ctx.config().getMarshaller();
  +        // Fill partition locations for main cache.
  +        for (int p = 0, parts =  cctx.affinity().partitions(); p < parts; p++) {
  +            List<ClusterNode> owners = cctx.topology().owners(p);
   
 -             if (F.isEmpty(owners))
  -                for (GridCacheSqlQuery mapQry : mapQrys)
  -                    mapQry.marshallParams(m);
 ++            if (F.isEmpty(owners)) {
 ++                if (!F.isEmpty(dataNodes(cctx.name(), NONE)))
 ++                    return null; // Retry.
 ++
  +                throw new CacheException("No data nodes found for cache '" + cctx.name() + "' for partition " + p);
 +             }
   
  -            send(nodes, new GridQueryRequest(qryReqId, r.pageSize, space, mapQrys));
  +            partLocs[p] = new HashSet<>(owners);
  +        }
   
  -            r.latch.await();
  +        if (extraSpaces != null) {
  +            // Find owner intersections for each participating partitioned cache partition.
  +            // We need this for logical collocation between different partitioned caches with the same affinity.
  +            for (String extraSpace : extraSpaces) {
  +                GridCacheContext<?,?> extraCctx = cacheContext(extraSpace);
   
  -            if (r.rmtErr != null)
  -                throw new CacheException("Failed to run map query remotely.", r.rmtErr);
  +                if (extraCctx.isReplicated() || extraCctx.isLocal())
  +                    continue;
   
  -            if (qry.explain())
  -                return explainPlan(r.conn, space, qry);
  +                for (int p = 0, parts =  extraCctx.affinity().partitions(); p < parts; p++) {
  +                    List<ClusterNode> owners = extraCctx.topology().owners(p);
   
 -                     if (F.isEmpty(owners))
  -            GridCacheSqlQuery rdc = qry.reduceQuery();
 ++                    if (F.isEmpty(owners)) {
 ++                        if (!F.isEmpty(dataNodes(extraSpace, NONE)))
 ++                            return null; // Retry.
 + 
  -            final ResultSet res = h2.executeSqlQueryWithTimer(space, r.conn, rdc.query(), F.asList(rdc.parameters()));
  +                        throw new CacheException("No data nodes found for cache '" + extraSpace +
  +                            "' for partition " + p);
 ++                    }
   
  -            for (GridMergeTable tbl : r.tbls) {
  -                if (!tbl.getScanIndex(null).fetchedAll()) // We have to explicitly cancel queries on remote nodes.
  -                    send(nodes, new GridQueryCancelRequest(qryReqId));
  +                    if (partLocs[p] == null)
  +                        partLocs[p] = new HashSet<>(owners);
  +                    else {
  +                        partLocs[p].retainAll(owners); // Intersection of owners.
   
  -//                dropTable(r.conn, tbl.getName()); TODO
  +                        if (partLocs[p].isEmpty())
  +                            return null; // Intersection is empty -> retry.
  +                    }
  +                }
               }
   
  -            return new GridQueryCacheObjectsIterator(new Iter(res), cctx, keepPortable);
  +            // Filter nodes where not all the replicated caches loaded.
  +            for (String extraSpace : extraSpaces) {
  +                GridCacheContext<?,?> extraCctx = cacheContext(extraSpace);
  +
  +                if (!extraCctx.isReplicated())
  +                    continue;
  +
 -                 Set<ClusterNode> dataNodes = owningReplicatedDataNodes(extraCctx);
 ++                Set<ClusterNode> dataNodes = replicatedUnstableDataNodes(extraCctx);
 ++
 ++                if (F.isEmpty(dataNodes))
 ++                    return null; // Retry.
  +
  +                for (Set<ClusterNode> partLoc : partLocs) {
  +                    partLoc.retainAll(dataNodes);
  +
  +                    if (partLoc.isEmpty())
  +                        return null; // Retry.
  +                }
  +            }
           }
  -        catch (IgniteCheckedException | InterruptedException | RuntimeException e) {
  -            U.closeQuiet(r.conn);
   
  -            if (e instanceof CacheException)
  -                throw (CacheException)e;
  +        // Collect the final partitions mapping.
  +        Map<ClusterNode, IntArray> res = new HashMap<>();
  +
  +        // Here partitions in all IntArray's will be sorted in ascending order, this is important.
  +        for (int p = 0; p < partLocs.length; p++) {
  +            Set<ClusterNode> pl = partLocs[p];
   
  -            throw new CacheException("Failed to run reduce query locally.", e);
  +            assert !F.isEmpty(pl) : pl;
  +
  +            ClusterNode n = pl.size() == 1 ? F.first(pl) : F.rand(pl);
  +
  +            IntArray parts = res.get(n);
  +
  +            if (parts == null)
  +                res.put(n, parts = new IntArray());
  +
  +            parts.add(p);
           }
  -        finally {
  -            if (!runs.remove(qryReqId, r))
  -                U.warn(log, "Query run was already removed: " + qryReqId);
   
  -            curFunTbl.remove();
  +        return res;
  +    }
  +
  +    /**
  +     * @param mainSpace Main space.
  +     * @param allSpaces All spaces.
  +     * @return List of all extra spaces or {@code null} if none.
  +     */
  +    private List<String> extraSpaces(String mainSpace, Set<String> allSpaces) {
  +        if (F.isEmpty(allSpaces) || (allSpaces.size() == 1 && allSpaces.contains(mainSpace)))
  +            return null;
  +
  +        ArrayList<String> res = new ArrayList<>(allSpaces.size());
  +
  +        for (String space : allSpaces) {
  +            if (!F.eq(space, mainSpace))
  +                res.add(space);
           }
  +
  +        return res;
       }
   
       /**


[19/50] incubator-ignite git commit: # ignite-sprint-6 more info in assert

Posted by sb...@apache.org.
# ignite-sprint-6 more info in assert


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

Branch: refs/heads/ignite-950
Commit: fffc2ecc86628a9a25c6f855d89277d124711873
Parents: af829d0
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jun 18 08:57:39 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jun 18 08:57:39 2015 +0300

----------------------------------------------------------------------
 .../dht/GridDhtPartitionTopologyImpl.java        |  4 +++-
 .../IgniteCacheP2pUnmarshallingTxErrorTest.java  | 19 ++++++++++---------
 .../junits/common/GridCommonAbstractTest.java    |  8 ++++++--
 3 files changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fffc2ecc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 374ab87..de7f876 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -620,7 +620,9 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
         lock.readLock().lock();
 
         try {
-            assert node2part != null && node2part.valid() : "Invalid node-to-partitions map [topVer=" + topVer +
+            assert node2part != null && node2part.valid() : "Invalid node-to-partitions map [topVer1=" + topVer +
+                ", topVer2=" + this.topVer +
+                ", cache=" + cctx.name() +
                 ", node2part=" + node2part + ']';
 
             Collection<ClusterNode> nodes = null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fffc2ecc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingTxErrorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingTxErrorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingTxErrorTest.java
index 017f7db..356d67b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingTxErrorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingTxErrorTest.java
@@ -26,11 +26,13 @@ import org.apache.ignite.transactions.*;
 import javax.cache.*;
 import java.io.*;
 
+import static org.apache.ignite.transactions.TransactionConcurrency.*;
+import static org.apache.ignite.transactions.TransactionIsolation.*;
+
 /**
  * Checks behavior on exception while unmarshalling key.
  */
 public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmarshallingErrorTest {
-
     /** {@inheritDoc} */
     @Override protected CacheAtomicityMode atomicityMode() {
         return CacheAtomicityMode.TRANSACTIONAL;
@@ -41,7 +43,7 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
         if (!gridName.endsWith("0"))
-            cfg.getCacheConfiguration()[0].setRebalanceDelay(-1); //allows to check GridDhtLockRequest fail.
+            cfg.getCacheConfiguration()[0].setRebalanceDelay(-1); // Allows to check GridDhtLockRequest fail.
 
         return cfg;
     }
@@ -52,8 +54,7 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars
     protected void failOptimistic() {
         IgniteCache<Object, Object> cache = jcache(0);
 
-        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.OPTIMISTIC,
-            TransactionIsolation.REPEATABLE_READ)) {
+        try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) {
 
             cache.put(new TestKey(String.valueOf(++key)), "");
 
@@ -65,7 +66,7 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars
             assert X.hasCause(e, IOException.class);
         }
 
-        assert readCnt.get() == 0; //ensure we have read count as expected.
+        assert readCnt.get() == 0; // Ensure we have read count as expected.
     }
 
     /**
@@ -74,8 +75,8 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars
     protected void failPessimictic() {
         IgniteCache<Object, Object> cache = jcache(0);
 
-        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC,
-            TransactionIsolation.REPEATABLE_READ)) {
+        try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC,
+            REPEATABLE_READ)) {
 
             cache.put(new TestKey(String.valueOf(++key)), "");
 
@@ -85,7 +86,7 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars
             assert X.hasCause(e, IOException.class);
         }
 
-        assert readCnt.get() == 0; //ensure we have read count as expected.
+        assert readCnt.get() == 0; // Ensure we have read count as expected.
     }
 
     /** {@inheritDoc} */
@@ -108,7 +109,7 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars
         //GridDhtLockRequest unmarshalling failed test
         readCnt.set(3);
 
-        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) {
+        try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
             jcache(0).put(new TestKey(String.valueOf(++key)), ""); //No failure at client side.
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fffc2ecc/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 bc33746..9941ca8 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
@@ -379,8 +379,10 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
 
                             int exp = affNodes.size();
 
-                            Collection<ClusterNode> owners = top.topologyVersion() == AffinityTopologyVersion.NONE ?
-                                Collections.<ClusterNode>emptyList() : top.nodes(p, AffinityTopologyVersion.NONE);
+                            GridDhtTopologyFuture topFut = top.topologyVersionFuture();
+
+                            Collection<ClusterNode> owners = (topFut != null && topFut.isDone()) ?
+                                top.nodes(p, AffinityTopologyVersion.NONE) : Collections.<ClusterNode>emptyList();
 
                             int actual = owners.size();
 
@@ -390,6 +392,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
                                     ", cache=" + cfg.getName() +
                                     ", cacheId=" + dht.context().cacheId() +
                                     ", topVer=" + top.topologyVersion() +
+                                    ", topFut=" + topFut +
                                     ", p=" + p +
                                     ", affNodesCnt=" + exp +
                                     ", ownersCnt=" + actual +
@@ -406,6 +409,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
                                         ", cache=" + cfg.getName() +
                                         ", cacheId=" + dht.context().cacheId() +
                                         ", topVer=" + top.topologyVersion() +
+                                        ", topFut=" + topFut +
                                         ", p=" + p +
                                         ", affNodesCnt=" + exp +
                                         ", ownersCnt=" + actual +


[12/50] incubator-ignite git commit: ignite-484-1 - replicated client cache test added

Posted by sb...@apache.org.
ignite-484-1 - replicated client cache test added


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

Branch: refs/heads/ignite-950
Commit: 10febf28fdf3966ffcb369c5725792b604be6c18
Parents: 1fe215e
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 17 17:11:00 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 17 17:11:00 2015 +0300

----------------------------------------------------------------------
 ...lientQueryReplicatedNodeRestartSelfTest.java | 381 +++++++++++++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   1 +
 2 files changed, 382 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/10febf28/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
new file mode 100644
index 0000000..23f44c0
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
@@ -0,0 +1,381 @@
+/*
+ * 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.near;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.affinity.rendezvous.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.util.*;
+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 org.apache.ignite.testframework.junits.common.*;
+
+import javax.cache.*;
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ * Test for distributed queries with replicated client cache and node restarts.
+ */
+public class IgniteCacheClientQueryReplicatedNodeRestartSelfTest extends GridCommonAbstractTest {
+    /** */
+    private static final String QRY = "select co.id, count(*) cnt\n" +
+        "from \"pe\".Person pe, \"pr\".Product pr, \"co\".Company co, \"pu\".Purchase pu\n" +
+        "where pe.id = pu.personId and pu.productId = pr.id and pr.companyId = co.id \n" +
+        "group by co.id order by cnt desc, co.id";
+
+    /** */
+    private static final P1<ClusterNode> DATA_NODES_FILTER = new P1<ClusterNode>() {
+            @Override public boolean apply(ClusterNode clusterNode) {
+                String gridName = clusterNode.attribute(IgniteNodeAttributes.ATTR_GRID_NAME);
+
+                return !gridName.endsWith(String.valueOf(GRID_CNT - 1)); // The last one is client only.
+            }
+        };
+
+    /** */
+    private static final int GRID_CNT = 5;
+
+    /** */
+    private static final int PERS_CNT = 600;
+
+    /** */
+    private static final int PURCHASE_CNT = 6000;
+
+    /** */
+    private static final int COMPANY_CNT = 25;
+
+    /** */
+    private static final int PRODUCT_CNT = 100;
+
+    /** */
+    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        X.println("grid name: " + gridName);
+
+        IgniteConfiguration c = super.getConfiguration(gridName);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(ipFinder);
+
+        c.setDiscoverySpi(disco);
+
+        int i = 0;
+
+        CacheConfiguration<?, ?>[] ccs = new CacheConfiguration[4];
+
+        for (String name : F.asList("co", "pr", "pe", "pu")) {
+            CacheConfiguration<?, ?> cc = defaultCacheConfiguration();
+
+            cc.setNodeFilter(DATA_NODES_FILTER);
+            cc.setName(name);
+            cc.setCacheMode(REPLICATED);
+            cc.setWriteSynchronizationMode(FULL_SYNC);
+            cc.setAtomicityMode(TRANSACTIONAL);
+            cc.setRebalanceMode(SYNC);
+            cc.setAffinity(new RendezvousAffinityFunction(false, 50));
+
+            switch (name) {
+                case "co":
+                    cc.setIndexedTypes(
+                        Integer.class, Company.class
+                    );
+
+                    break;
+
+                case "pr":
+                    cc.setIndexedTypes(
+                        Integer.class, Product.class
+                    );
+
+                    break;
+
+                case "pe":
+                    cc.setIndexedTypes(
+                        Integer.class, Person.class
+                    );
+
+                    break;
+
+                case "pu":
+                    cc.setIndexedTypes(
+                        AffinityKey.class, Purchase.class
+                    );
+
+                    break;
+            }
+
+            ccs[i++] = cc;
+        }
+
+        c.setCacheConfiguration(ccs);
+
+        return c;
+    }
+
+    /**
+     *
+     */
+    private void fillCaches() {
+        IgniteCache<Integer, Company> co = grid(0).cache("co");
+
+        for (int i = 0; i < COMPANY_CNT; i++)
+            co.put(i, new Company(i));
+
+        IgniteCache<Integer, Product> pr = grid(0).cache("pr");
+
+        Random rnd = new GridRandom();
+
+        for (int i = 0; i < PRODUCT_CNT; i++)
+            pr.put(i, new Product(i, rnd.nextInt(COMPANY_CNT)));
+
+        IgniteCache<Integer, Person> pe = grid(0).cache("pe");
+
+        for (int i = 0; i < PERS_CNT; i++)
+            pe.put(i, new Person(i));
+
+        IgniteCache<AffinityKey<Integer>, Purchase> pu = grid(0).cache("pu");
+
+        for (int i = 0; i < PURCHASE_CNT; i++) {
+            int persId = rnd.nextInt(PERS_CNT);
+            int prodId = rnd.nextInt(PRODUCT_CNT);
+
+            pu.put(new AffinityKey<>(i, persId), new Purchase(persId, prodId));
+        }
+    }
+
+    /**
+     * @param c Cache.
+     * @param client If it must be a client cache.
+     */
+    private void assertClient(IgniteCache<?,?> c, boolean client) {
+        assertTrue(((IgniteCacheProxy)c).context().affinityNode() == !client);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRestarts() throws Exception {
+        int duration = 90 * 1000;
+        int qryThreadNum = 5;
+        int restartThreadsNum = 2; // 2 of 4 data nodes
+        final int nodeLifeTime = 2 * 1000;
+        final int logFreq = 10;
+
+        startGridsMultiThreaded(GRID_CNT);
+
+        final AtomicIntegerArray locks = new AtomicIntegerArray(GRID_CNT - 1); // The last is client only.
+
+        fillCaches();
+
+        final List<List<?>> pRes = grid(0).cache("pu").query(new SqlFieldsQuery(QRY)).getAll();
+
+        Thread.sleep(3000);
+
+        assertEquals(pRes, grid(0).cache("pu").query(new SqlFieldsQuery(QRY)).getAll());
+
+        assertFalse(pRes.isEmpty());
+
+        final AtomicInteger qryCnt = new AtomicInteger();
+        final AtomicBoolean qrysDone = new AtomicBoolean();
+
+        for (int i = 0; i < GRID_CNT - 1; i++) {
+            for (String cacheName : F.asList("co", "pr", "pe", "pu"))
+                assertClient(grid(i).cache(cacheName), false);
+        }
+
+        for (String cacheName : F.asList("co", "pr", "pe", "pu"))
+            assertClient(grid(GRID_CNT - 1).cache(cacheName), true);
+
+        final IgniteCache<?,?> clientCache = grid(GRID_CNT - 1).cache("pu");
+
+        IgniteInternalFuture<?> fut1 = multithreadedAsync(new CAX() {
+            @Override public void applyx() throws IgniteCheckedException {
+                GridRandom rnd = new GridRandom();
+
+                while (!qrysDone.get()) {
+                    SqlFieldsQuery qry = new SqlFieldsQuery(QRY);
+
+                    boolean smallPageSize = rnd.nextBoolean();
+
+                    if (smallPageSize)
+                        qry.setPageSize(3);
+
+                    try {
+                        assertEquals(pRes, clientCache.query(qry).getAll());
+                    }
+                    catch (CacheException e) {
+                        assertTrue("On large page size must retry.", smallPageSize);
+
+                        boolean failedOnRemoteFetch = false;
+
+                        for (Throwable th = e; th != null; th = th.getCause()) {
+                            if (!(th instanceof CacheException))
+                                continue;
+
+                            if (th.getMessage() != null &&
+                                th.getMessage().startsWith("Failed to fetch data from node:")) {
+                                failedOnRemoteFetch = true;
+
+                                break;
+                            }
+                        }
+
+                        if (!failedOnRemoteFetch) {
+                            e.printStackTrace();
+
+                            fail("Must fail inside of GridResultPage.fetchNextPage or subclass.");
+                        }
+                    }
+
+                    int c = qryCnt.incrementAndGet();
+
+                    if (c % logFreq == 0)
+                        info("Executed queries: " + c);
+                }
+            }
+        }, qryThreadNum);
+
+        final AtomicInteger restartCnt = new AtomicInteger();
+
+        final AtomicBoolean restartsDone = new AtomicBoolean();
+
+        IgniteInternalFuture<?> fut2 = multithreadedAsync(new Callable<Object>() {
+            @SuppressWarnings({"BusyWait"})
+            @Override public Object call() throws Exception {
+                GridRandom rnd = new GridRandom();
+
+                while (!restartsDone.get()) {
+                    int g;
+
+                    do {
+                        g = rnd.nextInt(locks.length());
+                    }
+                    while (!locks.compareAndSet(g, 0, -1));
+
+                    stopGrid(g);
+
+                    Thread.sleep(rnd.nextInt(nodeLifeTime));
+
+                    startGrid(g);
+
+                    Thread.sleep(rnd.nextInt(nodeLifeTime));
+
+                    locks.set(g, 0);
+
+                    int c = restartCnt.incrementAndGet();
+
+                    if (c % logFreq == 0)
+                        info("Node restarts: " + c);
+                }
+
+                return true;
+            }
+        }, restartThreadsNum);
+
+        Thread.sleep(duration);
+
+        info("Stopping..");
+
+        restartsDone.set(true);
+
+        fut2.get();
+
+        info("Restarts stopped.");
+
+        qrysDone.set(true);
+
+        fut1.get();
+
+        info("Queries stopped.");
+    }
+
+    /**
+     *
+     */
+    private static class Person implements Serializable {
+        @QuerySqlField(index = true)
+        int id;
+
+        Person(int id) {
+            this.id = id;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class Purchase implements Serializable {
+        @QuerySqlField(index = true)
+        int personId;
+
+        @QuerySqlField(index = true)
+        int productId;
+
+        Purchase(int personId, int productId) {
+            this.personId = personId;
+            this.productId = productId;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class Company implements Serializable {
+        @QuerySqlField(index = true)
+        int id;
+
+        Company(int id) {
+            this.id = id;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class Product implements Serializable {
+        @QuerySqlField(index = true)
+        int id;
+
+        @QuerySqlField(index = true)
+        int companyId;
+
+        Product(int id, int companyId) {
+            this.id = id;
+            this.companyId = companyId;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/10febf28/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index c5a2f15..dee3078 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -67,6 +67,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheOffheapTieredMultithreadedSelfTest.class);
         suite.addTestSuite(IgniteCacheQueryNodeRestartSelfTest.class);
         suite.addTestSuite(IgniteCacheQueryNodeRestartSelfTest2.class);
+        suite.addTestSuite(IgniteCacheClientQueryReplicatedNodeRestartSelfTest.class);
         suite.addTestSuite(GridCacheReduceQueryMultithreadedSelfTest.class);
         suite.addTestSuite(GridCacheCrossCacheQuerySelfTest.class);
         suite.addTestSuite(GridCacheQuerySerializationSelfTest.class);


[32/50] incubator-ignite git commit: ignite-950: managed to run SQL queries with indexed fields in footer

Posted by sb...@apache.org.
ignite-950: managed to run SQL queries with indexed fields in footer


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

Branch: refs/heads/ignite-950
Commit: 25d0da2d0ed44cbb46904863ab43a22445e0f46d
Parents: 74017fa
Author: Denis Magda <dm...@gridgain.com>
Authored: Thu Jun 18 14:15:43 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Thu Jun 18 14:15:43 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheObjectContext.java    | 93 ++++++++++++++++++--
 .../cache/CacheOptimizedObjectImpl.java         | 80 +++++++++++------
 .../processors/cache/GridCacheAdapter.java      | 10 +--
 .../processors/cache/GridCacheContext.java      | 24 +++--
 .../cache/KeyCacheOptimizedObjectImpl.java      | 12 ++-
 .../distributed/near/GridNearGetFuture.java     |  4 +-
 .../query/GridCacheQueryFutureAdapter.java      |  2 +-
 .../cache/query/GridCacheQueryManager.java      | 12 +--
 .../store/GridCacheStoreManagerAdapter.java     | 31 ++++---
 .../cacheobject/IgniteCacheObjectProcessor.java | 11 ++-
 .../IgniteCacheObjectProcessorImpl.java         | 34 ++++---
 .../query/GridQueryCacheObjectsIterator.java    |  2 +-
 .../processors/query/GridQueryProcessor.java    |  9 +-
 .../internal/util/io/GridUnsafeDataInput.java   |  5 +-
 .../optimized/OptimizedMarshallerUtils.java     | 23 +++++
 .../optimized/ext/OptimizedMarshallerExt.java   |  9 ++
 .../ext/OptimizedObjectInputStreamExt.java      |  9 +-
 ...acheOptimizedMarshallerExtQuerySelfTest.java | 15 ++++
 18 files changed, 278 insertions(+), 107 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
index cf35177..b0e3a0d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
@@ -20,6 +20,9 @@ package org.apache.ignite.internal.processors.cache;
 import org.apache.ignite.cache.affinity.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cacheobject.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.marshaller.optimized.*;
 
 import java.util.*;
 
@@ -120,24 +123,102 @@ public class CacheObjectContext {
     }
 
     /**
-     * Unwraps object.
+     * Unwraps object if needed.
      *
      * @param o Object to unwrap.
-     * @param keepPortable Keep portable flag.
+     * @param keepPortable Keep portable flag. Used for portable objects only. Ignored in other cases.
      * @return Unwrapped object.
      */
-    public Object unwrapPortableIfNeeded(Object o, boolean keepPortable) {
+    public Object unwrapIfNeeded(Object o, boolean keepPortable) {
+        if (processor().isFieldsIndexingEnabled() && OptimizedMarshallerUtils.isObjectWithIndexedFieldsOrCollection(o))
+            return unwrapObject(o);
+
         return o;
     }
 
     /**
-     * Unwraps collection.
+     * Unwraps collection if needed.
      *
      * @param col Collection to unwrap.
-     * @param keepPortable Keep portable flag.
+     * @param keepPortable Keep portable flag. Used for portable objects only. Ignored in other cases.
      * @return Unwrapped collection.
      */
-    public Collection<Object> unwrapPortablesIfNeeded(Collection<Object> col, boolean keepPortable) {
+    public Collection<Object> unwrapIfNeeded(Collection<Object> col, boolean keepPortable) {
+        if (processor().isFieldsIndexingEnabled())
+            return (Collection<Object>)unwrapObject(col);
+
         return col;
     }
+
+    /**
+     * Unwraps object if needed.
+     *
+     * @param obj Object to unwrap.
+     * @return Unwrapped object.
+     */
+    private Object unwrapObject(Object obj) {
+        if (obj instanceof CacheOptimizedObjectImpl)
+            return ((CacheOptimizedObjectImpl)obj).deserialize(this);
+        else if (obj instanceof Map.Entry) {
+            Map.Entry<Object, Object> entry = (Map.Entry<Object, Object>)obj;
+
+            Object key = entry.getKey();
+
+            boolean unwrapped = false;
+
+            if (key instanceof CacheOptimizedObjectImpl) {
+                key = ((CacheOptimizedObjectImpl)key).deserialize(this);
+
+                unwrapped = true;
+            }
+
+            Object val = entry.getValue();
+
+            if (val instanceof CacheOptimizedObjectImpl) {
+                val = ((CacheOptimizedObjectImpl)val).deserialize(this);
+
+                unwrapped = true;
+            }
+
+            return unwrapped ? F.t(key, val) : obj;
+        }
+        else if (obj instanceof Collection) {
+            Collection<Object> col = (Collection<Object>)obj;
+
+            if (col instanceof ArrayList) {
+                ArrayList<Object> list = (ArrayList<Object>)col;
+
+                int size = list.size();
+
+                for (int i = 0; i < size; i++) {
+                    Object old = list.get(i);
+
+                    Object unwrapped = unwrapObject(old);
+
+                    if (old != unwrapped)
+                        list.set(i, unwrapped);
+                }
+
+                return list;
+            }
+            else {
+                Collection<Object> col0 = new ArrayList<>(col.size());
+
+                for (Object obj0 : col)
+                    col0.add(unwrapObject(obj0));
+
+                return col0;
+            }
+        }
+        else if (obj instanceof Map) {
+            Map<Object, Object> map = (Map<Object, Object>)obj;
+
+            Map<Object, Object> map0 = U.newHashMap(map.size());
+
+            for (Map.Entry<Object, Object> e : map.entrySet())
+                map0.put(unwrapObject(e.getKey()), unwrapObject(e.getValue()));
+        }
+
+        return obj;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOptimizedObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOptimizedObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOptimizedObjectImpl.java
index 078b4de..fe5a644 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOptimizedObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOptimizedObjectImpl.java
@@ -18,10 +18,12 @@
 package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
+import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.marshaller.optimized.ext.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.jetbrains.annotations.*;
+import sun.misc.*;
 
 import java.io.*;
 import java.nio.*;
@@ -35,6 +37,12 @@ public class CacheOptimizedObjectImpl extends CacheObjectAdapter {
     private static final long serialVersionUID = 0L;
 
     /** */
+    private static final Unsafe UNSAFE = GridUnsafe.unsafe();
+
+    /** */
+    private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class);
+
+    /** */
     protected int start;
 
     /** */
@@ -92,33 +100,7 @@ public class CacheOptimizedObjectImpl extends CacheObjectAdapter {
 
     /** {@inheritDoc} */
     @Nullable @Override public <T> T value(CacheObjectContext ctx, boolean cpy) {
-        //return (T)this;
-        cpy = cpy && needCopy(ctx);
-
-        try {
-            if (cpy) {
-                toMarshaledFormIfNeeded(ctx);
-
-                return (T)ctx.processor().unmarshal(ctx, valBytes,
-                    val == null ? ctx.kernalContext().config().getClassLoader() : val.getClass().getClassLoader());
-            }
-
-            if (val != null)
-                return (T)val;
-
-            assert valBytes != null;
-
-            Object val = ctx.processor().unmarshal(ctx, valBytes, start, len,
-                ctx.kernalContext().config().getClassLoader());
-
-            if (ctx.storeValue())
-                this.val = val;
-
-            return (T)val;
-        }
-        catch (IgniteCheckedException e) {
-            throw new IgniteException("Failed to unmarshall object.", e);
-        }
+        return (T)this;
     }
 
     /** {@inheritDoc} */
@@ -170,6 +152,22 @@ public class CacheOptimizedObjectImpl extends CacheObjectAdapter {
     }
 
     /**
+     * Returns object's type ID.
+     *
+     * @return Type ID.
+     */
+    public int typeId() {
+        assert valBytes != null;
+
+        int typeId = UNSAFE.getInt(valBytes, BYTE_ARR_OFF + start + 1);
+
+        if (typeId == 0)
+            throw new IgniteException("Object's type ID wasn't written to cache.");
+
+        return typeId;
+    }
+
+    /**
      * Checks whether a wrapped object has field with name {@code fieldName}.
      *
      * @param fieldName Field name.
@@ -194,7 +192,33 @@ public class CacheOptimizedObjectImpl extends CacheObjectAdapter {
     public Object field(String fieldName, OptimizedMarshallerExt marsh) throws IgniteCheckedException {
         assert valBytes != null;
 
-        return marsh.readField(fieldName, valBytes, start, len, val != null ?  val.getClass().getClassLoader() : null);
+        return marsh.readField(fieldName, valBytes, start, len, val != null ? val.getClass().getClassLoader() : null);
+    }
+
+    /**
+     * Deserializes wrapped object.
+     *
+     * @param ctx Cache context.
+     * @return Deserialized object.
+     */
+    public Object deserialize(CacheObjectContext ctx) {
+        if (val != null)
+            return val;
+
+        try {
+            assert valBytes != null;
+
+            Object val = ctx.processor().unmarshal(ctx, valBytes, start, len,
+                ctx.kernalContext().config().getClassLoader());
+
+            if (ctx.storeValue())
+                this.val = val;
+
+            return val;
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException("Failed to unmarshall object.", e);
+        }
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 2ca7687..2709f60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -724,7 +724,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
             Object val = CU.value(cacheVal, ctx, true);
 
-            val = ctx.unwrapPortableIfNeeded(val, ctx.keepPortable());
+            val = ctx.unwrapIfNeeded(val, ctx.keepPortable());
 
             return (V)val;
         }
@@ -3775,7 +3775,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         Object val0 = val != null ? val.value(ctx.cacheObjectContext(), true) : null;
 
-        return (V)ctx.unwrapPortableIfNeeded(val0, !deserializePortable);
+        return (V)ctx.unwrapIfNeeded(val0, !deserializePortable);
     }
 
     /** {@inheritDoc} */
@@ -4588,10 +4588,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             Object key0 = key.value(ctx.cacheObjectContext(), true);
             Object val0 = val.value(ctx.cacheObjectContext(), true);
 
-            if (deserializePortable) {
-                key0 = ctx.unwrapPortableIfNeeded(key0, true);
-                val0 = ctx.unwrapPortableIfNeeded(val0, true);
-            }
+            key0 = ctx.unwrapIfNeeded(key0, !deserializePortable);
+            val0 = ctx.unwrapIfNeeded(val0, !deserializePortable);
 
             return new CacheEntryImpl<>((K)key0, (V)val0);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/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 8a4e3b9..d7bb295 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
@@ -1678,26 +1678,26 @@ public class GridCacheContext<K, V> implements Externalizable {
     }
 
     /**
-     * Unwraps collection.
+     * Unwraps collection if needed.
      *
      * @param col Collection to unwrap.
-     * @param keepPortable Keep portable flag.
+     * @param keepPortable Keep portable flag. Used for portable objects only. Ignored in other cases.
      * @return Unwrapped collection.
      */
-    public Collection<Object> unwrapPortablesIfNeeded(Collection<Object> col, boolean keepPortable) {
-        return cacheObjCtx.unwrapPortablesIfNeeded(col, keepPortable);
+    public Collection<Object> unwrapIfNeeded(Collection<Object> col, boolean keepPortable) {
+        return cacheObjCtx.unwrapIfNeeded(col, keepPortable);
     }
 
     /**
-     * Unwraps object for portables.
+     * Unwraps object if needed.
      *
      * @param o Object to unwrap.
-     * @param keepPortable Keep portable flag.
+     * @param keepPortable Keep portable flag. Used for portable objects only. Ignored in other cases.
      * @return Unwrapped object.
      */
     @SuppressWarnings("IfMayBeConditional")
-    public Object unwrapPortableIfNeeded(Object o, boolean keepPortable) {
-        return cacheObjCtx.unwrapPortableIfNeeded(o, keepPortable);
+    public Object unwrapIfNeeded(Object o, boolean keepPortable) {
+        return cacheObjCtx.unwrapIfNeeded(o, keepPortable);
     }
 
     /**
@@ -1795,12 +1795,10 @@ public class GridCacheContext<K, V> implements Externalizable {
             Object key0 = key.value(cacheObjCtx, false);
             Object val0 = skipVals ? true : val.value(cacheObjCtx, cpy);
 
-            if (deserializePortable) {
-                key0 = unwrapPortableIfNeeded(key0, false);
+            key0 = unwrapIfNeeded(key0, !deserializePortable);
 
-                if (!skipVals)
-                    val0 = unwrapPortableIfNeeded(val0, false);
-            }
+            if (!skipVals)
+                val0 = unwrapIfNeeded(val0, !deserializePortable);
 
             assert key0 != null : key;
             assert val0 != null : val;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheOptimizedObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheOptimizedObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheOptimizedObjectImpl.java
index 8322e7a..56e6fe2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheOptimizedObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheOptimizedObjectImpl.java
@@ -57,10 +57,7 @@ public class KeyCacheOptimizedObjectImpl extends CacheOptimizedObjectImpl implem
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Nullable @Override public <T> T value(CacheObjectContext ctx, boolean cpy) {
-        //return (T)this;
-        assert val != null;
-
-        return (T)val;
+        return (T)this;
     }
 
     /** {@inheritDoc} */
@@ -82,6 +79,13 @@ public class KeyCacheOptimizedObjectImpl extends CacheOptimizedObjectImpl implem
     }
 
     /** {@inheritDoc} */
+    @Override public Object deserialize(CacheObjectContext ctx) {
+        assert val != null;
+
+        return val;
+    }
+
+    /** {@inheritDoc} */
     @Override public int hashCode() {
         assert val != null;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index 74438bb..06aae28 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -499,8 +499,8 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma
                     K key0 = key.value(cctx.cacheObjectContext(), true);
                     V val0 = v.value(cctx.cacheObjectContext(), true);
 
-                    val0 = (V)cctx.unwrapPortableIfNeeded(val0, !deserializePortable);
-                    key0 = (K)cctx.unwrapPortableIfNeeded(key0, !deserializePortable);
+                    val0 = (V)cctx.unwrapIfNeeded(val0, !deserializePortable);
+                    key0 = (K)cctx.unwrapIfNeeded(key0, !deserializePortable);
 
                     add(new GridFinishedFuture<>(Collections.singletonMap(key0, val0)));
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
index a8bace0..31d008f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
@@ -380,7 +380,7 @@ public abstract class GridCacheQueryFutureAdapter<K, V, R> extends GridFutureAda
 
                 data = dedupIfRequired((Collection<Object>)data);
 
-                data = cctx.unwrapPortablesIfNeeded((Collection<Object>)data, qry.query().keepPortable());
+                data = cctx.unwrapIfNeeded((Collection<Object>)data, qry.query().keepPortable());
 
                 synchronized (mux) {
                     enqueue(data);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 1317d38..073bf79 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -894,7 +894,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
                 private boolean checkPredicate(Map.Entry<K, V> e) {
                     if (keyValFilter != null) {
-                        Map.Entry<K, V> e0 = (Map.Entry<K, V>)cctx.unwrapPortableIfNeeded(e, qry.keepPortable());
+                        Map.Entry<K, V> e0 = (Map.Entry<K, V>)cctx.unwrapIfNeeded(e, qry.keepPortable());
 
                         return keyValFilter.apply(e0.getKey(), e0.getValue());
                     }
@@ -1030,8 +1030,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                     final LazySwapEntry e = new LazySwapEntry(it.next());
 
                     if (filter != null) {
-                        K key = (K)cctx.unwrapPortableIfNeeded(e.key(), keepPortable);
-                        V val = (V)cctx.unwrapPortableIfNeeded(e.value(), keepPortable);
+                        K key = (K)cctx.unwrapIfNeeded(e.key(), keepPortable);
+                        V val = (V)cctx.unwrapIfNeeded(e.value(), keepPortable);
 
                         if (!filter.apply(key, val))
                             continue;
@@ -1440,7 +1440,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
                     // Unwrap entry for reducer or transformer only.
                     if (rdc != null || trans != null)
-                        entry = (Map.Entry<K, V>)cctx.unwrapPortableIfNeeded(entry, qry.keepPortable());
+                        entry = (Map.Entry<K, V>)cctx.unwrapIfNeeded(entry, qry.keepPortable());
 
                     // Reduce.
                     if (rdc != null) {
@@ -2534,8 +2534,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
             throws IgniteCheckedException {
             LazyOffheapEntry e = new LazyOffheapEntry(keyPtr, valPtr);
 
-            K key = (K)cctx.unwrapPortableIfNeeded(e.key(), keepPortable);
-            V val = (V)cctx.unwrapPortableIfNeeded(e.value(), keepPortable);
+            K key = (K)cctx.unwrapIfNeeded(e.key(), keepPortable);
+            V val = (V)cctx.unwrapIfNeeded(e.value(), keepPortable);
 
             if (!filter.apply(key, val))
                 return null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
index b4a146a..32882ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
@@ -31,6 +31,7 @@ import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.lifecycle.*;
+import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.transactions.*;
 import org.jetbrains.annotations.*;
 
@@ -244,8 +245,8 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
 
             Object storeKey = key.value(cctx.cacheObjectContext(), false);
 
-            if (convertPortable())
-                storeKey = cctx.unwrapPortableIfNeeded(storeKey, false);
+            if (OptimizedMarshallerUtils.isObjectWithIndexedFieldsOrCollection(storeKey) || convertPortable())
+                storeKey = cctx.unwrapIfNeeded(storeKey, false);
 
             if (log.isDebugEnabled())
                 log.debug("Loading value from store for key: " + storeKey);
@@ -371,10 +372,10 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
 
             Collection<Object> keys0;
 
-            if (convertPortable()) {
+            if (OptimizedMarshallerUtils.isObjectWithIndexedFieldsOrCollection(keys) || convertPortable()) {
                 keys0 = F.viewReadOnly(keys, new C1<KeyCacheObject, Object>() {
                     @Override public Object apply(KeyCacheObject key) {
-                        return cctx.unwrapPortableIfNeeded(key.value(cctx.cacheObjectContext(), false), false);
+                        return cctx.unwrapIfNeeded(key.value(cctx.cacheObjectContext(), false), false);
                     }
                 });
             }
@@ -505,9 +506,11 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
             if (key instanceof GridCacheInternal)
                 return true;
 
-            if (convertPortable()) {
-                key = cctx.unwrapPortableIfNeeded(key, false);
-                val = cctx.unwrapPortableIfNeeded(val, false);
+            if (OptimizedMarshallerUtils.isObjectWithIndexedFieldsOrCollection(key) ||
+                OptimizedMarshallerUtils.isObjectWithIndexedFieldsOrCollection(val) ||
+                convertPortable()) {
+                key = cctx.unwrapIfNeeded(key, false);
+                val = cctx.unwrapIfNeeded(val, false);
             }
 
             if (log.isDebugEnabled())
@@ -610,8 +613,8 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
             if (key instanceof GridCacheInternal)
                 return false;
 
-            if (convertPortable())
-                key = cctx.unwrapPortableIfNeeded(key, false);
+            if (OptimizedMarshallerUtils.isObjectWithIndexedFieldsOrCollection(key) || convertPortable())
+                key = cctx.unwrapIfNeeded(key, false);
 
             if (log.isDebugEnabled())
                 log.debug("Removing value from cache store [key=" + key + ']');
@@ -659,7 +662,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
         }
 
         if (store != null) {
-            Collection<Object> keys0 = convertPortable() ? cctx.unwrapPortablesIfNeeded(keys, false) : keys;
+            Collection<Object> keys0 = convertPortable() ? cctx.unwrapIfNeeded(keys, false) : keys;
 
             if (log.isDebugEnabled())
                 log.debug("Removing values from cache store [keys=" + keys0 + ']');
@@ -1076,9 +1079,11 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
 
                         Object v = locStore ? e.getValue() : e.getValue().get1();
 
-                        if (convertPortable()) {
-                            k = cctx.unwrapPortableIfNeeded(k, false);
-                            v = cctx.unwrapPortableIfNeeded(v, false);
+                        if (OptimizedMarshallerUtils.isObjectWithIndexedFieldsOrCollection(k) ||
+                            OptimizedMarshallerUtils.isObjectWithIndexedFieldsOrCollection(v) ||
+                            convertPortable()) {
+                            k = cctx.unwrapIfNeeded(k, false);
+                            v = cctx.unwrapIfNeeded(v, false);
                         }
 
                         next = new CacheEntryImpl<>(k, v);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
index 0a6a188..42ccbce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
@@ -98,6 +98,13 @@ public interface IgniteCacheObjectProcessor extends GridProcessor {
     public boolean hasField(Object obj, String fieldName);
 
     /**
+     * Checks whether this functionality is globally supported.
+     *
+     * @return {@code true} if enabled.
+     */
+    public boolean isFieldsIndexingEnabled();
+
+    /**
      * Checks whether fields indexing is supported by footer injection into a serialized form of the object.
      * Footer contains information about fields location in the serialized form, thus enabling fast queries without
      * a need to deserialize the object.
@@ -105,9 +112,9 @@ public interface IgniteCacheObjectProcessor extends GridProcessor {
      * Indexing is enabled with {@link OptimizedMarshallerExt#enableFieldsIndexing(Class)}.
      *
      * @param cls Class.
-     * @return {@code true} if the footer is supported.
+     * @return {@code true} if the footer is enabled.
      */
-    public boolean isFieldsIndexingSupported(Class<?> cls);
+    public boolean isFieldsIndexingEnabled(Class<?> cls);
 
     /**
      * Tries to enables fields indexing for the object of the given {@code cls}.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
index 6d222dc..64aa064 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.marshaller.*;
+import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.marshaller.optimized.ext.*;
 import org.jetbrains.annotations.*;
 
@@ -193,10 +194,10 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
     @SuppressWarnings("ExternalizableWithoutPublicNoArgConstructor")
     protected KeyCacheObject toCacheKeyObject0(Object obj, boolean userObj) {
         if (!userObj)
-            return isFieldsIndexingSupported(obj.getClass()) ? new KeyCacheOptimizedObjectImpl(obj, null) :
+            return isFieldsIndexingEnabled(obj.getClass()) ? new KeyCacheOptimizedObjectImpl(obj, null) :
                 new KeyCacheObjectImpl(obj, null);
 
-        return isFieldsIndexingSupported(obj.getClass()) ? new UserKeyCacheOptimizedObjectImpl(obj) :
+        return isFieldsIndexingEnabled(obj.getClass()) ? new UserKeyCacheOptimizedObjectImpl(obj) :
             new UserKeyCacheObjectImpl(obj);
     }
 
@@ -268,10 +269,10 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
         }
 
         if (!userObj)
-            return isFieldsIndexingSupported(obj.getClass()) ? new CacheOptimizedObjectImpl(obj) :
+            return isFieldsIndexingEnabled(obj.getClass()) ? new CacheOptimizedObjectImpl(obj) :
                 new CacheObjectImpl(obj, null);
 
-        return isFieldsIndexingSupported(obj.getClass()) ? new UserCacheOptimizedObjectImpl(obj, null) :
+        return isFieldsIndexingEnabled(obj.getClass()) ? new UserCacheOptimizedObjectImpl(obj, null) :
             new UserCacheObjectImpl(obj, null);
     }
 
@@ -305,9 +306,16 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
 
     /** {@inheritDoc} */
     @Override public int typeId(String typeName) {
-        return 0;
+        return optMarshExt != null ? OptimizedMarshallerUtils.resolveTypeId(typeName, optMarshExt.idMapper()) : 0;
     }
 
+    /** {@inheritDoc} */
+    @Override public int typeId(Object obj) {
+        if (obj instanceof CacheOptimizedObjectImpl)
+            return ((CacheOptimizedObjectImpl)obj).typeId();
+
+        return 0;
+    }
 
     /** {@inheritDoc} */
     @Override public Object unwrapTemporary(GridCacheContext ctx, Object obj) throws IgniteException {
@@ -325,11 +333,6 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
     }
 
     /** {@inheritDoc} */
-    @Override public int typeId(Object obj) {
-        return 0;
-    }
-
-    /** {@inheritDoc} */
     @Override public Object field(Object obj, String fieldName) {
         if (obj instanceof CacheOptimizedObjectImpl) {
             assert optMarshExt != null;
@@ -362,7 +365,12 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isFieldsIndexingSupported(Class<?> cls) {
+    @Override public boolean isFieldsIndexingEnabled() {
+        return optMarshExt != null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isFieldsIndexingEnabled(Class<?> cls) {
         return optMarshExt != null && optMarshExt.fieldsIndexingEnabled(cls);
     }
 
@@ -468,7 +476,7 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
 
     /**
      * Wraps value provided by user, must be serialized before stored in cache.
-     * Used by classes that support fields indexing. Refer to {@link #isFieldsIndexingSupported(Class)}.
+     * Used by classes that support fields indexing. Refer to {@link #isFieldsIndexingEnabled(Class)}.
      */
     private static class UserCacheOptimizedObjectImpl extends CacheOptimizedObjectImpl {
         /** */
@@ -519,7 +527,7 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
 
     /**
      * Wraps key provided by user, must be serialized before stored in cache.
-     * Used by classes that support fields indexing. Refer to {@link #isFieldsIndexingSupported(Class)}.
+     * Used by classes that support fields indexing. Refer to {@link #isFieldsIndexingEnabled(Class)}.
      */
     private static class UserKeyCacheOptimizedObjectImpl extends KeyCacheOptimizedObjectImpl {
         /** */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCacheObjectsIterator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCacheObjectsIterator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCacheObjectsIterator.java
index 3dc7ddc..ee26609 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCacheObjectsIterator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCacheObjectsIterator.java
@@ -60,7 +60,7 @@ public class GridQueryCacheObjectsIterator implements Iterator<List<?>>, AutoClo
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public List<?> next() {
-        return (List<?>)cctx.unwrapPortablesIfNeeded((Collection<Object>)iter.next(), keepPortable);
+        return (List<?>)cctx.unwrapIfNeeded((Collection<Object>)iter.next(), keepPortable);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index fe7c952..3e7948e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -143,7 +143,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                     else if (ctx.cacheObjects().enableFieldsIndexing(valCls)) {
                         processIndexedFieldsMeta(meta, desc);
 
-                        typeId = new TypeId(ccfg.getName(), valCls);
+                        typeId = new TypeId(ccfg.getName(), ctx.cacheObjects().typeId(valCls.getName()));
                     }
                     else {
                         processClassMeta(meta, desc);
@@ -454,8 +454,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             TypeId id;
 
             boolean portableVal = ctx.cacheObjects().isPortableObject(val);
+            boolean indexedFieldsVal = val instanceof CacheOptimizedObjectImpl;
 
-            if (portableVal) {
+            if (portableVal || indexedFieldsVal) {
                 int typeId = ctx.cacheObjects().typeId(val);
 
                 id = new TypeId(space, typeId);
@@ -471,12 +472,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             if (desc == null || !desc.registered())
                 return;
 
-            if (!portableVal && !desc.valueClass().isAssignableFrom(valCls))
+            if (!portableVal && !indexedFieldsVal && !desc.valueClass().isAssignableFrom(valCls))
                 throw new IgniteCheckedException("Failed to update index due to class name conflict" +
                     "(multiple classes with same simple name are stored in the same cache) " +
                     "[expCls=" + desc.valueClass().getName() + ", actualCls=" + valCls.getName() + ']');
 
-            if (!ctx.cacheObjects().isPortableObject(key)) {
+            if (!(key instanceof CacheOptimizedObjectImpl) && !ctx.cacheObjects().isPortableObject(key)) {
                 Class<?> keyCls = key.value(coctx, false).getClass();
 
                 if (!desc.keyClass().isAssignableFrom(keyCls))

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/internal/util/io/GridUnsafeDataInput.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/io/GridUnsafeDataInput.java b/modules/core/src/main/java/org/apache/ignite/internal/util/io/GridUnsafeDataInput.java
index 6be90c5..d76aac2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/io/GridUnsafeDataInput.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/io/GridUnsafeDataInput.java
@@ -109,12 +109,10 @@ public class GridUnsafeDataInput extends InputStream implements GridDataInput {
     /** {@inheritDoc} */
     @Override public void bytes(byte[] bytes, int off, int len) {
         buf = bytes;
-
-        max = len;
+        max = len + off;
         this.off = off;
     }
 
-
     /** {@inheritDoc} */
     @Override public void inputStream(InputStream in) throws IOException {
         this.in = in;
@@ -122,7 +120,6 @@ public class GridUnsafeDataInput extends InputStream implements GridDataInput {
         buf = inBuf;
     }
 
-
     /**
      * Reads from stream to buffer. If stream is {@code null}, this method is no-op.
      *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerUtils.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerUtils.java
index 61cbcee..2f42e8d 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerUtils.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.marshaller.optimized;
 
 import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.marshaller.*;
@@ -237,6 +238,28 @@ public class OptimizedMarshallerUtils {
     }
 
     /**
+     * Checks whether the given object is a wrapper, that contains serialized form of an object with indexed fields, or
+     * {@link Collection} or {@link Map}.
+     *
+     * @param obj Object.
+     * @return {@code true} if all the conditions are met..
+     */
+    public static boolean isObjectWithIndexedFieldsOrCollection(Object obj) {
+        if (obj == null)
+            return false;
+
+        if (obj instanceof CacheOptimizedObjectImpl ||
+            obj instanceof Map.Entry ||
+            obj instanceof Collection ||
+            obj instanceof Map ||
+            obj.getClass() == Object[].class)
+            return true;
+
+        return false;
+    }
+
+
+    /**
      * Gets descriptor for provided ID.
      *
      * @param clsMap Class descriptors by class map.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
index 8e2653b..1a451e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
@@ -72,6 +72,15 @@ public class OptimizedMarshallerExt extends OptimizedMarshaller {
     }
 
     /**
+     * Returns currently set ID mapper.
+     *
+     * @return ID mapper.
+     */
+    public OptimizedMarshallerIdMapper idMapper() {
+        return mapper;
+    }
+
+    /**
      * Enables fields indexing for the object of the given {@code cls}.
      *
      * If enabled then a footer will be added during marshalling of an object of the given {@code cls} to the end of

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
index 977a988..7ab56a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
@@ -83,7 +83,7 @@ public class OptimizedObjectInputStreamExt extends OptimizedObjectInputStream {
             return false;
         }
 
-        FieldRange range = fieldRange(fieldName);
+        FieldRange range = fieldRange(fieldName, pos);
 
         in.position(pos);
 
@@ -108,7 +108,7 @@ public class OptimizedObjectInputStreamExt extends OptimizedObjectInputStream {
             return null;
         }
 
-        FieldRange range = fieldRange(fieldName);
+        FieldRange range = fieldRange(fieldName, pos);
 
         F field = null;
 
@@ -133,10 +133,11 @@ public class OptimizedObjectInputStreamExt extends OptimizedObjectInputStream {
      * Returns field offset in the byte stream.
      *
      * @param fieldName Field name.
+     * @param start Object's start offset.
      * @return positive range or {@code null} if the object doesn't have such a field.
      * @throws IOException in case of error.
      */
-    private FieldRange fieldRange(String fieldName) throws IOException {
+    private FieldRange fieldRange(String fieldName, int start) throws IOException {
         int fieldId = resolveFieldId(fieldName);
 
         int typeId = readInt();
@@ -177,7 +178,7 @@ public class OptimizedObjectInputStreamExt extends OptimizedObjectInputStream {
                 //object header len: 1 - for type, 4 - for type ID, 2 - for checksum.
                 fieldOff += 1 + 4 + clsNameLen + 2;
 
-                return new FieldRange(fieldOff, info.len == VARIABLE_LEN ? in.readShort() : info.len);
+                return new FieldRange(start + fieldOff, info.len == VARIABLE_LEN ? in.readShort() : info.len);
             }
             else
                 fieldOff += info.len == VARIABLE_LEN ? in.readShort() : info.len;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d0da2d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOptimizedMarshallerExtQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOptimizedMarshallerExtQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOptimizedMarshallerExtQuerySelfTest.java
index 77e48c1..d9f85aa 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOptimizedMarshallerExtQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOptimizedMarshallerExtQuerySelfTest.java
@@ -108,7 +108,22 @@ public class IgniteCacheOptimizedMarshallerExtQuerySelfTest extends GridCacheAbs
      * @throws Exception In case of error.
      */
     public void testNestedFieldsQuery() throws Exception {
+        IgniteCache<Integer, Person> cache = grid(0).cache(null);
+
+        Collection<Cache.Entry<Integer, Person>> entries = cache.query(new SqlQuery<Integer, Person>(
+            "Person", "name is not null AND (zip = 1 OR zip = 2)")).getAll();
+
+        assertEquals(2, entries.size());
 
+        for (Cache.Entry<Integer, Person> entry : entries) {
+            int id = entry.getKey();
+            Person p = entry.getValue();
+
+            assertEquals("Person " + id, p.name);
+            assertEquals((id + 1) * 100, p.salary);
+            assertEquals("Street " + id, p.address.street);
+            assertEquals(id, p.address.zip);
+        }
     }
 
     /**


[20/50] incubator-ignite git commit: Merge branches 'ignite-484-1' and 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-484-1

Posted by sb...@apache.org.
Merge branches 'ignite-484-1' and 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-484-1


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

Branch: refs/heads/ignite-950
Commit: eebf9c1c7fa07b442e4a341ffa2b5ce2828032c4
Parents: ed43dfe fffc2ec
Author: S.Vladykin <sv...@gridgain.com>
Authored: Thu Jun 18 09:43:45 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Thu Jun 18 09:43:45 2015 +0300

----------------------------------------------------------------------
 .../dht/GridDhtPartitionTopologyImpl.java        |  4 +++-
 .../IgniteCacheP2pUnmarshallingTxErrorTest.java  | 19 ++++++++++---------
 .../junits/common/GridCommonAbstractTest.java    |  8 ++++++--
 3 files changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------



[49/50] incubator-ignite git commit: ignite-950: enabling new marhsaller globally

Posted by sb...@apache.org.
ignite-950: enabling new marhsaller globally


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

Branch: refs/heads/ignite-950
Commit: b78653db508b7f66b46f9da8efaf39dcaf654ee0
Parents: 6e41372
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jun 19 13:29:50 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Jun 19 13:29:50 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/internal/IgnitionEx.java     | 3 ++-
 .../apache/ignite/testframework/junits/IgniteTestResources.java  | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b78653db/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 5cbe377..422f517 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -32,6 +32,7 @@ import org.apache.ignite.logger.java.*;
 import org.apache.ignite.marshaller.*;
 import org.apache.ignite.marshaller.jdk.*;
 import org.apache.ignite.marshaller.optimized.*;
+import org.apache.ignite.marshaller.optimized.ext.*;
 import org.apache.ignite.mxbean.*;
 import org.apache.ignite.plugin.segmentation.*;
 import org.apache.ignite.resources.*;
@@ -1725,7 +1726,7 @@ public class IgnitionEx {
                     marsh = new JdkMarshaller();
                 }
                 else
-                    marsh = new OptimizedMarshaller();
+                    marsh = new OptimizedMarshallerExt();
             }
 
             myCfg.setMarshaller(marsh);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b78653db/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
index 68ae64b..e7609d6 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.processors.resource.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.marshaller.*;
 import org.apache.ignite.marshaller.optimized.*;
+import org.apache.ignite.marshaller.optimized.ext.*;
 import org.apache.ignite.resources.*;
 import org.apache.ignite.testframework.config.*;
 import org.apache.ignite.testframework.junits.logger.*;
@@ -232,7 +233,8 @@ public class IgniteTestResources {
         Marshaller marsh;
 
         if (marshallerName == null)
-            marsh = new OptimizedMarshaller();
+            //marsh = new OptimizedMarshaller();
+            marsh = new OptimizedMarshallerExt();
         else {
             try {
                 Class<? extends Marshaller> cls = (Class<? extends Marshaller>)Class.forName(marshallerName);


[33/50] incubator-ignite git commit: # ignite-sprint-6 disabled shmem for test

Posted by sb...@apache.org.
# ignite-sprint-6 disabled shmem for 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/ca81476d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ca81476d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ca81476d

Branch: refs/heads/ignite-950
Commit: ca81476d1ab66773815c7e3f91d61ea5b0651bb9
Parents: b23ea74
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jun 18 14:21:34 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jun 18 14:21:34 2015 +0300

----------------------------------------------------------------------
 .../datastreamer/DataStreamerMultiThreadedSelfTest.java           | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca81476d/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
index e0092d4..c37219a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
@@ -22,6 +22,7 @@ import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.spi.communication.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
@@ -48,6 +49,8 @@ public class DataStreamerMultiThreadedSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
+        ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
         TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
         discoSpi.setIpFinder(IP_FINDER);
 


[21/50] incubator-ignite git commit: Fixed test.

Posted by sb...@apache.org.
Fixed 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/fa6615a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fa6615a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fa6615a8

Branch: refs/heads/ignite-950
Commit: fa6615a8665fb8296c63be3e719d6d186293ea0c
Parents: 5218210
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jun 18 09:44:45 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jun 18 09:44:45 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/testframework/junits/GridTestKernalContext.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fa6615a8/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestKernalContext.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestKernalContext.java
index 37948d9..24502da 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestKernalContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestKernalContext.java
@@ -46,7 +46,7 @@ public class GridTestKernalContext extends GridKernalContextImpl {
             null,
             null,
             null,
-            null);
+            U.allPluginProviders());
 
         GridTestUtils.setFieldValue(grid(), "cfg", config());
 


[42/50] incubator-ignite git commit: ignite-950: adding handles to footer

Posted by sb...@apache.org.
ignite-950: adding handles to footer


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

Branch: refs/heads/ignite-950
Commit: 5e7fcc1f1759bbb2f87dd64cc3d6487cd5722e40
Parents: 25d0da2
Author: Denis Magda <dm...@gridgain.com>
Authored: Thu Jun 18 16:25:22 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Thu Jun 18 16:25:22 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/GridHandleTable.java   | 32 ++++++++--
 .../optimized/OptimizedClassDescriptor.java     |  4 +-
 .../optimized/OptimizedObjectOutputStream.java  | 24 +++----
 .../optimized/ext/OptimizedMarshallerExt.java   |  3 +
 .../ext/OptimizedObjectInputStreamExt.java      | 36 +++++++++--
 .../ext/OptimizedObjectOutputStreamExt.java     | 66 ++++++++++++++------
 6 files changed, 118 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e7fcc1f/modules/core/src/main/java/org/apache/ignite/internal/util/GridHandleTable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridHandleTable.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridHandleTable.java
index 05a089c..6b63360 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridHandleTable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridHandleTable.java
@@ -47,6 +47,9 @@ public class GridHandleTable {
     /** Maps handle value -> next candidate handle value. */
     private int[] next;
 
+    /** Handle absolute position in the output stream. */
+    private int[] positions;
+
     /** Maps handle value -> associated object. */
     private Object[] objs;
 
@@ -68,6 +71,7 @@ public class GridHandleTable {
         spine = new int[initCap];
         next = new int[initCap];
         objs = new Object[initCap];
+        positions = new int[initCap];
         spineEmpty = new int[initCap];
         nextEmpty = new int[initCap];
 
@@ -84,9 +88,10 @@ public class GridHandleTable {
      * no mapping found.
      *
      * @param obj Object.
+     * @param pos Current absolute position in output stream.
      * @return Handle.
      */
-    public int lookup(Object obj) {
+    public int lookup(Object obj, int pos) {
         int idx = hash(obj) % spine.length;
 
         if (size > 0) {
@@ -101,7 +106,7 @@ public class GridHandleTable {
         if (size >= threshold)
             growSpine();
 
-        insert(obj, size, idx);
+        insert(obj, size, idx, pos);
 
         size++;
 
@@ -109,6 +114,16 @@ public class GridHandleTable {
     }
 
     /**
+     * Returns handle absolute position in output stream.
+     *
+     * @param handle Handle.
+     * @return Absolute position.
+     */
+    public int position(int handle) {
+        return positions[handle];
+    }
+
+    /**
      * Resets table to its initial (empty) state.
      */
     public void clear() {
@@ -116,6 +131,7 @@ public class GridHandleTable {
         UNSAFE.copyMemory(nextEmpty, intArrOff, next, intArrOff, nextEmpty.length << 2);
 
         Arrays.fill(objs, null);
+        Arrays.fill(positions, 0);
 
         size = 0;
     }
@@ -134,10 +150,12 @@ public class GridHandleTable {
      * @param obj Object.
      * @param handle Handle.
      * @param idx Index.
+     * @param pos Position in output stream.
      */
-    private void insert(Object obj, int handle, int idx) {
+    private void insert(Object obj, int handle, int idx, int pos) {
         objs[handle] = obj;
         next[handle] = spine[idx];
+        positions[handle] = pos;
         spine[idx] = handle;
     }
 
@@ -161,7 +179,7 @@ public class GridHandleTable {
 
             int idx = hash(obj) % spine.length;
 
-            insert(objs[i], i, idx);
+            insert(objs[i], i, idx, positions[i]);
         }
     }
 
@@ -184,6 +202,12 @@ public class GridHandleTable {
         System.arraycopy(objs, 0, newObjs, 0, size);
 
         objs = newObjs;
+
+        int[] newPositions = new int[newLen];
+
+        UNSAFE.copyMemory(positions, intArrOff, newPositions, intArrOff, size << 2);
+
+        positions = newPositions;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e7fcc1f/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassDescriptor.java
index ae3ae77..d77551f 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassDescriptor.java
@@ -724,12 +724,10 @@ public class OptimizedClassDescriptor {
                         "set OptimizedMarshaller.setRequireSerializable() to false " +
                         "(note that performance may degrade if object is not Serializable): " + name);
 
-                int headerPos = out.out().size() - 1;
-
                 writeTypeData(out);
 
                 out.writeShort(checksum);
-                out.writeSerializable(obj, writeObjMtds, fields, headerPos);
+                out.writeSerializable(obj, writeObjMtds, fields);
 
                 break;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e7fcc1f/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
index a88da95..90e2a85 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
@@ -154,7 +154,7 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
      * @param obj Object.
      * @throws IOException In case of error.
      *
-     * @return Handle ID that has already written {@code obj} or -1 if the {@code obj} has not been written before.
+     * @return Handle's position in {@link #out} or -1 if the {@code obj} has not been written before.
      */
     private int writeObject0(Object obj) throws IOException {
         curObj = null;
@@ -204,7 +204,7 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
                 }
 
                 if (!desc.isPrimitive() && !desc.isEnum() && !desc.isClass())
-                    handle = handles.lookup(obj);
+                    handle = handles.lookup(obj, out.offset());
 
                 if (obj0 != obj) {
                     obj = obj0;
@@ -218,6 +218,8 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
                 if (handle >= 0) {
                     writeByte(HANDLE);
                     writeInt(handle);
+
+                    handle = handles.position(handle);
                 }
                 else
                     desc.write(this, obj);
@@ -303,18 +305,15 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
      * @param obj Object.
      * @param mtds {@code writeObject} methods.
      * @param fields class fields details.
-     * @param headerPos Object's header position in the OutputStream.
      * @throws IOException In case of error.
      */
     @SuppressWarnings("ForLoopReplaceableByForEach")
-    void writeSerializable(Object obj, List<Method> mtds, OptimizedClassDescriptor.Fields fields, int headerPos)
+    void writeSerializable(Object obj, List<Method> mtds, OptimizedClassDescriptor.Fields fields)
         throws IOException {
         Footer footer = createFooter(obj.getClass());
 
-        if (footer != null) {
+        if (footer != null)
             footer.fields(fields);
-            footer.headerPos(headerPos);
-        }
 
         for (int i = 0; i < mtds.size(); i++) {
             Method mtd = mtds.get(i);
@@ -978,13 +977,6 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
         void fields(OptimizedClassDescriptor.Fields fields);
 
         /**
-         * Sets field's header absolute position.
-         *
-         * @param pos Absolute position.
-         */
-        void headerPos(int pos);
-
-        /**
          * Puts type ID and its value len to the footer.
          *
          * @param fieldId   Field ID.
@@ -998,9 +990,9 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
          * Puts handle ID for the given field ID.
          *
          * @param fieldId Field ID.
-         * @param handleId Handle ID.
+         * @param handlePos Handle position in output stream.
          */
-        void putHandle(int fieldId, int handleId);
+        void putHandle(int fieldId, int handlePos);
 
         /**
          * Writes footer content to the OutputStream.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e7fcc1f/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
index 1a451e1..a41a331 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
@@ -41,6 +41,9 @@ public class OptimizedMarshallerExt extends OptimizedMarshaller {
     static final byte VARIABLE_LEN = -1;
 
     /** */
+    static final byte NOT_A_HANDLE = -1;
+
+    /** */
     private OptimizedMarshallerExtMetaHandler metaHandler;
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e7fcc1f/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
index 7ab56a2..7c8cc3c 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
@@ -16,6 +16,7 @@
  */
 package org.apache.ignite.marshaller.optimized.ext;
 
+import org.apache.ignite.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.io.*;
 import org.apache.ignite.marshaller.*;
@@ -167,6 +168,11 @@ public class OptimizedObjectInputStreamExt extends OptimizedObjectInputStream {
         if (footerLen == EMPTY_FOOTER)
             return null;
 
+        // reading 'hasHandles' flag. 1 byte - additional offset to get to the flag position.
+        in.position(in.position() - FOOTER_LEN_OFF - 1);
+
+        boolean hasHandles = in.readBoolean();
+
         // 4 - skipping length at the beginning
         int footerOff = (end - footerLen) + 4;
         in.position(footerOff);
@@ -175,13 +181,33 @@ public class OptimizedObjectInputStreamExt extends OptimizedObjectInputStream {
 
         for (OptimizedObjectMetadata.FieldInfo info : meta.getMeta()) {
             if (info.id == fieldId) {
-                //object header len: 1 - for type, 4 - for type ID, 2 - for checksum.
-                fieldOff += 1 + 4 + clsNameLen + 2;
+                int len = info.len == VARIABLE_LEN ? in.readInt() : info.len;
+                int handlePos;
+
+                if (hasHandles && info.len == VARIABLE_LEN)
+                    handlePos = in.readInt();
+                else
+                    handlePos = NOT_A_HANDLE;
+
+                if (handlePos == NOT_A_HANDLE) {
+                    //object header len: 1 - for type, 4 - for type ID, 2 - for checksum.
+                    fieldOff += 1 + 4 + clsNameLen + 2;
+
+                    return new FieldRange(start + fieldOff, len);
+                }
+                else {
+                    throw new IgniteException("UNSUPPORTED YET");
+                }
+            }
+            else {
+                fieldOff += info.len == VARIABLE_LEN ? in.readInt() : info.len;
+
+                if (hasHandles) {
+                    in.skipBytes(4);
+                    fieldOff += 4;
+                }
 
-                return new FieldRange(start + fieldOff, info.len == VARIABLE_LEN ? in.readShort() : info.len);
             }
-            else
-                fieldOff += info.len == VARIABLE_LEN ? in.readShort() : info.len;
         }
 
         return null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e7fcc1f/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectOutputStreamExt.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectOutputStreamExt.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectOutputStreamExt.java
index 823caf5..4ef0d4a 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectOutputStreamExt.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectOutputStreamExt.java
@@ -72,37 +72,52 @@ public class OptimizedObjectOutputStreamExt extends OptimizedObjectOutputStream
      */
     private class FooterImpl implements OptimizedObjectOutputStream.Footer {
         /** */
-        private ArrayList<Short> data;
+        private ArrayList<Integer> data;
 
         /** */
-        private int headerPos;
+        private ArrayList<Integer> fields;
+
+        /** */
+        private HashMap<Integer, Integer> handles;
+
+        /** */
+        private boolean hasHandles;
 
         /** {@inheritDoc} */
         @Override public void fields(OptimizedClassDescriptor.Fields fields) {
-            if (fields.fieldsIndexingSupported())
+            if (fields.fieldsIndexingSupported()) {
                 data = new ArrayList<>();
+                this.fields = new ArrayList<>();
+            }
             else
                 data = null;
         }
 
         /** {@inheritDoc} */
-        public void headerPos(int pos) {
-            headerPos = pos;
-        }
-
-        /** {@inheritDoc} */
         public void put(int fieldId, OptimizedFieldType fieldType, int len) {
             if (data == null)
                 return;
 
-            // Considering that field's length will be no longer 2^15 (32 MB)
-            if (fieldType == OptimizedFieldType.OTHER)
-                data.add((short)len);
+            if (fieldType == OptimizedFieldType.OTHER) {
+                data.add(len);
+                fields.add(fieldId);
+            }
         }
 
         /** {@inheritDoc} */
-        @Override public void putHandle(int fieldId, int handleId) {
-            disable();
+        @Override public void putHandle(int fieldId, int handlePos) {
+            if (data == null)
+                return;
+
+            if (!hasHandles) {
+                hasHandles = true;
+                handles = new HashMap<>();
+            }
+
+            handles.put(fieldId, handlePos);
+
+            // length of handle fields is 5 bytes.
+            put(fieldId, OptimizedFieldType.OTHER, 5);
         }
 
         /** {@inheritDoc} */
@@ -110,16 +125,29 @@ public class OptimizedObjectOutputStreamExt extends OptimizedObjectOutputStream
             if (data == null)
                 writeInt(EMPTY_FOOTER);
             else {
-                //12 - 4 bytes for len at the beginning, 4 bytes for len at the end, 4 bytes for object len.
-                int footerLen = data.size() * 2 + 12;
+                //9 - 4 bytes for len at the beginning, 4 bytes for len at the end, 1 byte for 'hasHandles' flag
+                int footerLen = data.size() * 4 + 9;
+
+                if (hasHandles)
+                    footerLen += data.size() * 4;
 
                 writeInt(footerLen);
 
-                for (short fieldLen : data)
-                    writeShort(fieldLen);
+                if (hasHandles) {
+                    for (int i = 0; i < data.size(); i++) {
+                        writeInt(data.get(i));
+
+                        Integer handlePos = handles.get(fields.get(i));
+
+                        writeInt(handlePos == null ? NOT_A_HANDLE : handlePos);
+                    }
+                }
+                else {
+                    for (int fieldLen : data)
+                        writeInt(fieldLen);
+                }
 
-                // object total len
-                writeInt((out.size() - headerPos) + 8);
+                writeBoolean(hasHandles);
 
                 writeInt(footerLen);
             }


[03/50] incubator-ignite git commit: Merge branch 'ignite-gg-10429' into ignite-sprint-6

Posted by sb...@apache.org.
Merge branch 'ignite-gg-10429' into ignite-sprint-6


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

Branch: refs/heads/ignite-950
Commit: f173f9132eac1b7f8ac31bad795f0694be9a3c14
Parents: d1a2150 01eee2d
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Wed Jun 17 12:33:13 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Wed Jun 17 12:33:13 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    | 13 +-----------
 .../client/GridClientConfiguration.java         |  4 ++--
 .../GridClientOptimizedMarshaller.java          | 21 ++++++++++++++++++++
 .../impl/GridTcpRouterNioListenerAdapter.java   |  2 +-
 .../rest/protocols/tcp/GridTcpRestProtocol.java |  3 ++-
 .../ignite/internal/util/IgniteUtils.java       | 21 ++++++++++++++++++++
 6 files changed, 48 insertions(+), 16 deletions(-)
----------------------------------------------------------------------



[02/50] incubator-ignite git commit: Merge branches 'ignite-484-1' and 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-484-1

Posted by sb...@apache.org.
Merge branches 'ignite-484-1' and 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-484-1


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

Branch: refs/heads/ignite-950
Commit: ca253a8a845129ece37fca3a12c384d8b9ef3e76
Parents: 8343058 dc05e88
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 17 12:21:53 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 17 12:21:53 2015 +0300

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |   2 +-
 examples/pom.xml                                |   2 +-
 modules/aop/pom.xml                             |   2 +-
 modules/aws/pom.xml                             |   2 +-
 modules/clients/pom.xml                         |   2 +-
 modules/cloud/pom.xml                           |   2 +-
 modules/codegen/pom.xml                         |   2 +-
 modules/core/pom.xml                            |   2 +-
 .../cache/store/jdbc/CacheJdbcBlobStore.java    |  22 +-
 .../store/jdbc/CacheJdbcBlobStoreFactory.java   | 290 +++++++++++++++++++
 .../cache/store/jdbc/CacheJdbcPojoStore.java    |   6 +-
 .../store/jdbc/CacheJdbcPojoStoreFactory.java   | 148 ++++++++++
 .../configuration/CacheConfiguration.java       |   3 +-
 .../internal/interop/InteropBootstrap.java      |   3 +-
 .../internal/interop/InteropIgnition.java       |   5 +-
 .../processors/cache/GridCacheProcessor.java    |  23 +-
 .../processors/query/GridQueryProcessor.java    | 102 +++++--
 .../util/spring/IgniteSpringHelper.java         |  10 +
 .../SpringApplicationContextResource.java       |   4 +-
 .../apache/ignite/resources/SpringResource.java |   6 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  87 ++++--
 .../core/src/main/resources/ignite.properties   |   2 +-
 .../apache/ignite/internal/GridSelfTest.java    |  12 +-
 .../GridDiscoveryManagerAliveCacheSelfTest.java |  17 +-
 .../GridCacheAbstractFailoverSelfTest.java      |   2 +
 ...ridCacheMultinodeUpdateAbstractSelfTest.java |   9 +
 .../cache/GridCacheVersionMultinodeTest.java    |   8 +-
 ...CacheP2pUnmarshallingRebalanceErrorTest.java |  15 +-
 .../IgniteCacheClientNodeConcurrentStart.java   |  14 +-
 .../distributed/IgniteCacheManyClientsTest.java |  69 ++++-
 .../GridCachePartitionedTxSalvageSelfTest.java  |  37 +--
 .../junits/common/GridCommonAbstractTest.java   |  11 +-
 .../IgniteCacheFailoverTestSuite.java           |   8 -
 .../IgniteCacheFailoverTestSuite2.java          |  47 +++
 modules/extdata/p2p/pom.xml                     |   2 +-
 modules/extdata/uri/pom.xml                     |   2 +-
 modules/gce/pom.xml                             |   2 +-
 modules/geospatial/pom.xml                      |   2 +-
 modules/hadoop/pom.xml                          |   2 +-
 modules/hibernate/pom.xml                       |  16 +-
 .../hibernate/CacheHibernateBlobStore.java      |  87 +-----
 .../CacheHibernateBlobStoreFactory.java         | 235 +++++++++++++++
 .../hibernate/src/test/config/factory-cache.xml |  59 ++++
 .../src/test/config/factory-cache1.xml          |  61 ++++
 .../config/factory-incorrect-store-cache.xml    |  56 ++++
 .../CacheHibernateStoreFactorySelfTest.java     | 273 +++++++++++++++++
 .../testsuites/IgniteHibernateTestSuite.java    |   2 +
 modules/indexing/pom.xml                        |   2 +-
 .../CacheAbstractQueryMetricsSelfTest.java      | 205 +++++++++++++
 .../CachePartitionedQueryMetricsSelfTest.java   |  32 ++
 .../CacheReplicatedQueryMetricsSelfTest.java    |  32 ++
 .../cache/GridCacheQueryMetricsSelfTest.java    | 206 -------------
 .../query/h2/sql/BaseH2CompareQueryTest.java    |   2 +-
 .../IgniteCacheQuerySelfTestSuite.java          |   4 +-
 modules/jcl/pom.xml                             |   2 +-
 modules/jta/pom.xml                             |   2 +-
 modules/log4j/pom.xml                           |   2 +-
 modules/mesos/pom.xml                           |   2 +-
 modules/rest-http/pom.xml                       |   2 +-
 modules/scalar-2.10/pom.xml                     |   2 +-
 modules/scalar/pom.xml                          |   2 +-
 modules/schedule/pom.xml                        |   2 +-
 modules/schema-import/pom.xml                   |   2 +-
 modules/slf4j/pom.xml                           |   2 +-
 modules/spark-2.10/pom.xml                      |   2 +-
 modules/spark/pom.xml                           |   2 +-
 modules/spring/pom.xml                          |   9 +-
 .../GridResourceSpringBeanInjector.java         |   2 +-
 .../util/spring/IgniteSpringHelperImpl.java     |  17 ++
 .../src/test/config/incorrect-store-cache.xml   |  57 ++++
 modules/spring/src/test/config/node.xml         |  43 +++
 modules/spring/src/test/config/node1.xml        |  45 +++
 .../test/config/pojo-incorrect-store-cache.xml  |  56 ++++
 modules/spring/src/test/config/store-cache.xml  |  59 ++++
 modules/spring/src/test/config/store-cache1.xml |  62 ++++
 .../jdbc/CacheJdbcBlobStoreFactorySelfTest.java | 172 +++++++++++
 .../jdbc/CacheJdbcPojoStoreFactorySelfTest.java | 193 ++++++++++++
 .../testsuites/IgniteSpringTestSuite.java       |   5 +
 modules/ssh/pom.xml                             |   2 +-
 modules/tools/pom.xml                           |   2 +-
 modules/urideploy/pom.xml                       |   2 +-
 modules/visor-console-2.10/pom.xml              |   2 +-
 modules/visor-console/pom.xml                   |   2 +-
 modules/visor-plugins/pom.xml                   |   2 +-
 modules/web/pom.xml                             |   2 +-
 modules/yardstick/pom.xml                       |   2 +-
 pom.xml                                         |   2 +-
 87 files changed, 2520 insertions(+), 500 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca253a8a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 174b7a0,718e6ba..4f2486b
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@@ -687,9 -716,16 +714,9 @@@ public class GridQueryProcessor extend
      }
  
      /**
 -     * @return Message factory for {@link GridIoManager}.
 -     */
 -    public MessageFactory messageFactory() {
 -        return idx == null ? null : idx.messageFactory();
 -    }
 -
 -    /**
       * Closeable iterator.
       */
-     private static interface ClIter<X> extends AutoCloseable, Iterator<X> {
+     private interface ClIter<X> extends AutoCloseable, Iterator<X> {
          // No-op.
      }
  

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca253a8a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------


[44/50] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-6' into ignite-950

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-6' into ignite-950


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

Branch: refs/heads/ignite-950
Commit: 5bd86660cfbce9fcab74e08a3adf4bcde496a88b
Parents: 296ff8c ad0a026
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jun 19 08:35:04 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Jun 19 08:35:04 2015 +0300

----------------------------------------------------------------------
 examples/pom.xml                                |   2 +-
 modules/aop/pom.xml                             |   2 +-
 modules/aws/pom.xml                             |   2 +-
 .../s3/S3CheckpointManagerSelfTest.java         |   2 +-
 .../checkpoint/s3/S3CheckpointSpiSelfTest.java  |   4 +-
 .../s3/S3CheckpointSpiStartStopSelfTest.java    |   2 +-
 .../s3/S3SessionCheckpointSelfTest.java         |   2 +-
 .../s3/TcpDiscoveryS3IpFinderSelfTest.java      |   2 +-
 modules/clients/pom.xml                         |   2 +-
 modules/cloud/pom.xml                           |   2 +-
 modules/codegen/pom.xml                         |   2 +-
 modules/core/pom.xml                            |   2 +-
 .../apache/ignite/internal/IgniteKernal.java    |  13 +-
 .../client/GridClientConfiguration.java         |   2 +-
 .../GridClientOptimizedMarshaller.java          |  21 +
 .../impl/GridTcpRouterNioListenerAdapter.java   |   2 +-
 .../affinity/AffinityTopologyVersion.java       |   7 -
 .../processors/cache/GridCacheAdapter.java      |   4 +
 .../processors/cache/GridCacheUtils.java        |   9 +
 .../processors/cache/IgniteCacheProxy.java      |  12 +
 .../distributed/dht/GridDhtLocalPartition.java  |  56 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |   4 +-
 .../dht/GridDhtPartitionsReservation.java       | 292 +++++++++
 .../dht/GridDhtTransactionalCacheAdapter.java   |   2 +-
 .../cache/distributed/dht/GridReservable.java   |  35 +
 .../dht/preloader/GridDhtPartitionMap.java      |  26 +-
 .../cache/query/GridCacheQueryManager.java      |  33 -
 .../cache/query/GridCacheTwoStepQuery.java      |  22 +-
 .../cache/transactions/IgniteTxHandler.java     |   2 +-
 .../transactions/IgniteTxLocalAdapter.java      |  12 +-
 .../dr/IgniteDrDataStreamerCacheUpdater.java    |   7 +-
 .../processors/query/GridQueryIndexing.java     |  14 +-
 .../processors/query/GridQueryProcessor.java    |  21 +-
 .../messages/GridQueryNextPageResponse.java     |  34 +-
 .../h2/twostep/messages/GridQueryRequest.java   | 111 +++-
 .../rest/protocols/tcp/GridTcpRestProtocol.java |   3 +-
 .../apache/ignite/internal/util/GridDebug.java  |  19 +
 .../ignite/internal/util/IgniteUtils.java       |  21 +
 .../communication/tcp/TcpCommunicationSpi.java  |  42 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  35 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  42 +-
 .../tcp/internal/TcpDiscoveryNode.java          |  18 +
 .../core/src/main/resources/ignite.properties   |   2 +-
 .../apache/ignite/internal/GridSelfTest.java    |  20 +-
 .../CacheStoreUsageMultinodeAbstractTest.java   | 305 +++++++++
 ...eUsageMultinodeDynamicStartAbstractTest.java | 169 +++++
 ...oreUsageMultinodeDynamicStartAtomicTest.java |  32 +
 ...heStoreUsageMultinodeDynamicStartTxTest.java |  32 +
 ...reUsageMultinodeStaticStartAbstractTest.java | 158 +++++
 ...toreUsageMultinodeStaticStartAtomicTest.java |  32 +
 ...cheStoreUsageMultinodeStaticStartTxTest.java |  32 +
 .../cache/GridCacheAbstractFullApiSelfTest.java |  24 +-
 .../IgniteCacheAbstractStopBusySelfTest.java    |  30 +-
 .../IgniteCacheAtomicStopBusySelfTest.java      |   8 +-
 .../IgniteCacheP2pUnmarshallingTxErrorTest.java |  19 +-
 ...gniteCacheTransactionalStopBusySelfTest.java |   8 +-
 .../DataStreamerMultiThreadedSelfTest.java      |   3 +
 .../junits/GridTestKernalContext.java           |   2 +-
 .../junits/common/GridCommonAbstractTest.java   |   8 +-
 .../testsuites/IgniteCacheTestSuite4.java       |   4 +
 modules/extdata/p2p/pom.xml                     |   2 +-
 modules/extdata/uri/pom.xml                     |   2 +-
 modules/gce/pom.xml                             |   2 +-
 modules/geospatial/pom.xml                      |   2 +-
 modules/hadoop/pom.xml                          |   2 +-
 modules/hibernate/pom.xml                       |   2 +-
 modules/indexing/pom.xml                        |   2 +-
 .../processors/query/h2/IgniteH2Indexing.java   |  79 ++-
 .../query/h2/sql/GridSqlQuerySplitter.java      |  49 +-
 .../query/h2/twostep/GridMapQueryExecutor.java  | 332 +++++++---
 .../query/h2/twostep/GridMergeIndex.java        |  17 +-
 .../h2/twostep/GridMergeIndexUnsorted.java      |   7 +-
 .../h2/twostep/GridReduceQueryExecutor.java     | 650 ++++++++++++++++---
 .../query/h2/twostep/GridResultPage.java        |  21 +-
 .../cache/GridCacheCrossCacheQuerySelfTest.java |   3 +-
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |   1 -
 ...lientQueryReplicatedNodeRestartSelfTest.java | 419 ++++++++++++
 .../IgniteCacheQueryNodeRestartSelfTest.java    |  36 +-
 .../IgniteCacheQueryNodeRestartSelfTest2.java   | 383 +++++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 modules/jcl/pom.xml                             |   2 +-
 modules/jta/pom.xml                             |   2 +-
 modules/log4j/pom.xml                           |   2 +-
 modules/mesos/pom.xml                           |   2 +-
 modules/rest-http/pom.xml                       |   2 +-
 modules/scalar-2.10/pom.xml                     |   2 +-
 modules/scalar/pom.xml                          |   2 +-
 modules/schedule/pom.xml                        |   2 +-
 modules/schema-import/pom.xml                   |   2 +-
 modules/slf4j/pom.xml                           |   2 +-
 modules/spark-2.10/pom.xml                      |   2 +-
 modules/spark/pom.xml                           |   2 +-
 modules/spring/pom.xml                          |   2 +-
 modules/ssh/pom.xml                             |   2 +-
 modules/tools/pom.xml                           |   2 +-
 modules/urideploy/pom.xml                       |   2 +-
 modules/visor-console-2.10/pom.xml              |   2 +-
 modules/visor-console/pom.xml                   |   2 +-
 modules/visor-plugins/pom.xml                   |   2 +-
 modules/web/pom.xml                             |   2 +-
 modules/yardstick/pom.xml                       |   2 +-
 pom.xml                                         |   2 +-
 102 files changed, 3452 insertions(+), 440 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5bd86660/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5bd86660/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5bd86660/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------


[47/50] incubator-ignite git commit: # ignite-sprint-6 added test for lastSuccessfulAddress

Posted by sb...@apache.org.
# ignite-sprint-6 added test for lastSuccessfulAddress


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

Branch: refs/heads/ignite-950
Commit: d699faa34d66b8e5f1487daf3386c4d677d8c1e5
Parents: 4d9868a
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 19 13:01:51 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 19 13:01:51 2015 +0300

----------------------------------------------------------------------
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java | 44 ++++++++++++++++++--
 1 file changed, 41 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d699faa3/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index ad12753..9a44c24 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -149,9 +149,47 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
      */
     public void testThreeNodesStartStop() throws Exception {
         try {
-            startGrid(1);
-            startGrid(2);
-            startGrid(3);
+            IgniteEx ignite1 = startGrid(1);
+            IgniteEx ignite2 = startGrid(2);
+            IgniteEx ignite3 = startGrid(3);
+
+            TcpDiscoverySpi spi1 = (TcpDiscoverySpi)ignite1.configuration().getDiscoverySpi();
+            TcpDiscoverySpi spi2 = (TcpDiscoverySpi)ignite2.configuration().getDiscoverySpi();
+            TcpDiscoverySpi spi3 = (TcpDiscoverySpi)ignite3.configuration().getDiscoverySpi();
+
+            TcpDiscoveryNode node = (TcpDiscoveryNode)spi1.getNode(ignite2.localNode().id());
+
+            assertNotNull(node);
+            assertNotNull(node.lastSuccessfulAddress());
+
+            LinkedHashSet<InetSocketAddress> addrs = spi1.getNodeAddresses(node);
+
+            assertEquals(addrs.iterator().next(), node.lastSuccessfulAddress());
+
+            assertTrue(spi1.pingNode(ignite3.localNode().id()));
+
+            node = (TcpDiscoveryNode)spi1.getNode(ignite3.localNode().id());
+
+            assertNotNull(node);
+            assertNotNull(node.lastSuccessfulAddress());
+
+            addrs = spi1.getNodeAddresses(node);
+            assertEquals(addrs.iterator().next(), node.lastSuccessfulAddress());
+
+            node = (TcpDiscoveryNode)spi2.getNode(ignite1.localNode().id());
+
+            assertNotNull(node);
+            assertNotNull(node.lastSuccessfulAddress());
+
+            node = (TcpDiscoveryNode)spi2.getNode(ignite3.localNode().id());
+
+            assertNotNull(node);
+            assertNotNull(node.lastSuccessfulAddress());
+
+            node = (TcpDiscoveryNode)spi3.getNode(ignite1.localNode().id());
+
+            assertNotNull(node);
+            assertNotNull(node.lastSuccessfulAddress());
         }
         finally {
             stopAllGrids();


[22/50] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6


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

Branch: refs/heads/ignite-950
Commit: 4cc376bedd63aee6cb5de434c435b3384431ed63
Parents: fa6615a fffc2ec
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jun 18 09:45:26 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jun 18 09:45:26 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      |   4 +
 .../processors/cache/IgniteCacheProxy.java      |   7 +
 .../dht/GridDhtPartitionTopologyImpl.java       |   4 +-
 .../dht/GridDhtTransactionalCacheAdapter.java   |   2 +-
 .../cache/transactions/IgniteTxHandler.java     |   2 +-
 .../transactions/IgniteTxLocalAdapter.java      |  12 +-
 .../dr/IgniteDrDataStreamerCacheUpdater.java    |   7 +-
 .../CacheStoreUsageMultinodeAbstractTest.java   | 305 +++++++++++++++++++
 ...eUsageMultinodeDynamicStartAbstractTest.java | 169 ++++++++++
 ...oreUsageMultinodeDynamicStartAtomicTest.java |  32 ++
 ...heStoreUsageMultinodeDynamicStartTxTest.java |  32 ++
 ...reUsageMultinodeStaticStartAbstractTest.java | 158 ++++++++++
 ...toreUsageMultinodeStaticStartAtomicTest.java |  32 ++
 ...cheStoreUsageMultinodeStaticStartTxTest.java |  32 ++
 .../IgniteCacheP2pUnmarshallingTxErrorTest.java |  19 +-
 .../junits/common/GridCommonAbstractTest.java   |   8 +-
 .../testsuites/IgniteCacheTestSuite4.java       |   4 +
 17 files changed, 810 insertions(+), 19 deletions(-)
----------------------------------------------------------------------



[28/50] incubator-ignite git commit: sprint-6 - ignite-indexing module check

Posted by sb...@apache.org.
sprint-6 - ignite-indexing module check


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

Branch: refs/heads/ignite-950
Commit: c1eee18615be56c7bb60d34614451612710b6cef
Parents: d874b00
Author: S.Vladykin <sv...@gridgain.com>
Authored: Thu Jun 18 13:39:19 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Thu Jun 18 13:39:19 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/cache/IgniteCacheProxy.java    | 5 +++++
 .../ignite/internal/processors/query/GridQueryProcessor.java  | 7 +++++++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1eee186/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 0d70792..48fd259 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -556,6 +556,11 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
             !(qry instanceof ContinuousQuery))
             throw new CacheException("Indexing is disabled for cache: " + ctx.cache().name() +
                 ". Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.");
+
+        if (!ctx.kernalContext().query().moduleEnabled() &&
+            (qry instanceof SqlQuery || qry instanceof SqlFieldsQuery || qry instanceof TextQuery))
+            throw new CacheException("Failed to execute query. Add module 'ignite-indexing' to the classpath " +
+                "of all Ignite nodes.");
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1eee186/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 4f2486b..e080c6d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -107,6 +107,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * @return {@code true} If indexing module is in classpath and successfully initialized.
+     */
+    public boolean moduleEnabled() {
+        return idx != null;
+    }
+
+    /**
      * @param ccfg Cache configuration.
      * @throws IgniteCheckedException If failed.
      */


[36/50] incubator-ignite git commit: # changed discovery error message

Posted by sb...@apache.org.
# changed discovery error message


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

Branch: refs/heads/ignite-950
Commit: 31cf8027216afca3d02461caa4f4245bdd8d0e73
Parents: cb862b6
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 18 14:56:12 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 18 14:56:12 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/spi/discovery/tcp/ServerImpl.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/31cf8027/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 63f165d..e9a949a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -4103,8 +4103,14 @@ class ServerImpl extends TcpDiscoveryImpl {
                         if (U.isMacInvalidArgumentError(e))
                             LT.error(log, e, "Failed to initialize connection [sock=" + sock + "]\n\t" +
                                 U.MAC_INVALID_ARG_MSG);
-                        else
-                            LT.error(log, e, "Failed to initialize connection [sock=" + sock + ']');
+                        else {
+                            U.error(
+                                log,
+                                "Failed to initialize connection (this can happen due to short time " +
+                                    "network problems and can be ignored if does not affect node discovery) " +
+                                    "[sock=" + sock + ']',
+                                e);
+                        }
                     }
 
                     onException("Caught exception on handshake [err=" + e + ", sock=" + sock + ']', e);


[50/50] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-6' into ignite-950

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-6' into ignite-950


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

Branch: refs/heads/ignite-950
Commit: 10b022602104963c61d146daec3fd33bec98ce5f
Parents: b78653d d699faa
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jun 19 13:31:14 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Jun 19 13:31:14 2015 +0300

----------------------------------------------------------------------
 examples/pom.xml                                |  2 +-
 modules/aop/pom.xml                             |  2 +-
 modules/aws/pom.xml                             |  2 +-
 modules/clients/pom.xml                         |  2 +-
 modules/cloud/pom.xml                           |  2 +-
 modules/codegen/pom.xml                         |  2 +-
 modules/core/pom.xml                            |  2 +-
 .../core/src/main/resources/ignite.properties   |  2 +-
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java | 44 ++++++++++++++++++--
 modules/extdata/p2p/pom.xml                     |  2 +-
 modules/extdata/uri/pom.xml                     |  2 +-
 modules/gce/pom.xml                             |  2 +-
 modules/geospatial/pom.xml                      |  2 +-
 modules/hadoop/pom.xml                          |  2 +-
 modules/hibernate/pom.xml                       |  2 +-
 modules/indexing/pom.xml                        |  2 +-
 modules/jcl/pom.xml                             |  2 +-
 modules/jta/pom.xml                             |  2 +-
 modules/log4j/pom.xml                           |  2 +-
 modules/mesos/pom.xml                           |  2 +-
 modules/rest-http/pom.xml                       |  2 +-
 modules/scalar-2.10/pom.xml                     |  2 +-
 modules/scalar/pom.xml                          |  2 +-
 modules/schedule/pom.xml                        |  2 +-
 modules/schema-import/pom.xml                   |  2 +-
 modules/slf4j/pom.xml                           |  2 +-
 modules/spark-2.10/pom.xml                      |  2 +-
 modules/spark/pom.xml                           |  2 +-
 modules/spring/pom.xml                          |  2 +-
 modules/ssh/pom.xml                             |  2 +-
 modules/tools/pom.xml                           |  2 +-
 modules/urideploy/pom.xml                       |  2 +-
 modules/visor-console-2.10/pom.xml              |  2 +-
 modules/visor-console/pom.xml                   |  2 +-
 modules/visor-plugins/pom.xml                   |  2 +-
 modules/web/pom.xml                             |  2 +-
 modules/yardstick/pom.xml                       |  2 +-
 pom.xml                                         |  2 +-
 38 files changed, 78 insertions(+), 40 deletions(-)
----------------------------------------------------------------------



[13/50] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-1020' into ignite-sprint-6

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1020' into ignite-sprint-6


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

Branch: refs/heads/ignite-950
Commit: af829d0ee0a646ac7ed96c65ddda7fc6f38212b0
Parents: 5218210 674072a
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 17 17:19:58 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 17 17:19:58 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      |   4 +
 .../processors/cache/IgniteCacheProxy.java      |   7 +
 .../dht/GridDhtTransactionalCacheAdapter.java   |   2 +-
 .../cache/transactions/IgniteTxHandler.java     |   2 +-
 .../transactions/IgniteTxLocalAdapter.java      |  12 +-
 .../dr/IgniteDrDataStreamerCacheUpdater.java    |   7 +-
 .../CacheStoreUsageMultinodeAbstractTest.java   | 305 +++++++++++++++++++
 ...eUsageMultinodeDynamicStartAbstractTest.java | 169 ++++++++++
 ...oreUsageMultinodeDynamicStartAtomicTest.java |  32 ++
 ...heStoreUsageMultinodeDynamicStartTxTest.java |  32 ++
 ...reUsageMultinodeStaticStartAbstractTest.java | 158 ++++++++++
 ...toreUsageMultinodeStaticStartAtomicTest.java |  32 ++
 ...cheStoreUsageMultinodeStaticStartTxTest.java |  32 ++
 .../testsuites/IgniteCacheTestSuite4.java       |   4 +
 14 files changed, 791 insertions(+), 7 deletions(-)
----------------------------------------------------------------------



[08/50] incubator-ignite git commit: # i-484-1 review

Posted by sb...@apache.org.
# i-484-1 review


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

Branch: refs/heads/ignite-950
Commit: 642f1c7a2786fd95a43d97cc5b0d955ad890f0c4
Parents: 0b8587b
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jun 17 15:14:16 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jun 17 15:14:16 2015 +0300

----------------------------------------------------------------------
 .../dht/GridDhtPartitionsReservation.java       |  3 +-
 .../cache/query/GridCacheTwoStepQuery.java      | 10 +++----
 .../IgniteCacheQueryNodeRestartSelfTest.java    |  3 +-
 .../IgniteCacheQueryNodeRestartSelfTest2.java   | 30 ++++++++++++++------
 4 files changed, 30 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/642f1c7a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionsReservation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionsReservation.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionsReservation.java
index aced999..207c7f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionsReservation.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionsReservation.java
@@ -218,7 +218,8 @@ public class GridDhtPartitionsReservation implements GridReservable {
 
         // Unregister from partitions.
         if (!F.isEmpty(arr) && parts.compareAndSet(arr, EMPTY)) {
-            // Reverse order makes sure that addReservation on the same topVer reservation will fail on the first partition.
+            // Reverse order makes sure that addReservation on the same topVer
+            // reservation will fail on the first partition.
             for (int i = arr.length - 1; i >= 0; i--) {
                 GridDhtLocalPartition part = arr[i];
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/642f1c7a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index 1aa5890..1dacd10 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -117,11 +117,6 @@ public class GridCacheTwoStepQuery {
         return mapQrys.values();
     }
 
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridCacheTwoStepQuery.class, this);
-    }
-
     /**
      * @return Spaces.
      */
@@ -135,4 +130,9 @@ public class GridCacheTwoStepQuery {
     public void spaces(Set<String> spaces) {
         this.spaces = spaces;
     }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridCacheTwoStepQuery.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/642f1c7a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
index d729e4a..5c87603 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
@@ -39,6 +39,7 @@ import java.util.concurrent.atomic.*;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.*;
 import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
 
 /**
  * Test for distributed queries with node restarts.
@@ -84,7 +85,7 @@ public class IgniteCacheQueryNodeRestartSelfTest extends GridCacheAbstractSelfTe
         cc.setBackups(1);
         cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
         cc.setAtomicityMode(TRANSACTIONAL);
-        cc.setRebalanceMode(CacheRebalanceMode.SYNC);
+        cc.setRebalanceMode(SYNC);
         cc.setAffinity(new RendezvousAffinityFunction(false, 15));
         cc.setIndexedTypes(
             Integer.class, Integer.class

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/642f1c7a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
index 527dfea..93831cc 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.*;
 import org.apache.ignite.cache.affinity.rendezvous.*;
 import org.apache.ignite.cache.query.*;
@@ -40,6 +39,8 @@ import java.util.concurrent.atomic.*;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.*;
 import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
 
 /**
  * Test for distributed queries with node restarts.
@@ -95,9 +96,9 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
             cc.setName(name);
             cc.setCacheMode(PARTITIONED);
             cc.setBackups(2);
-            cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+            cc.setWriteSynchronizationMode(FULL_SYNC);
             cc.setAtomicityMode(TRANSACTIONAL);
-            cc.setRebalanceMode(CacheRebalanceMode.SYNC);
+            cc.setRebalanceMode(SYNC);
             cc.setAffinity(new RendezvousAffinityFunction(false, 60));
 
             if (name.equals("pe")) {
@@ -119,9 +120,9 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
 
             cc.setName(name);
             cc.setCacheMode(REPLICATED);
-            cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+            cc.setWriteSynchronizationMode(FULL_SYNC);
             cc.setAtomicityMode(TRANSACTIONAL);
-            cc.setRebalanceMode(CacheRebalanceMode.SYNC);
+            cc.setRebalanceMode(SYNC);
             cc.setAffinity(new RendezvousAffinityFunction(false, 50));
 
             if (name.equals("co")) {
@@ -143,6 +144,9 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
         return c;
     }
 
+    /**
+     *
+     */
     private void fillCaches() {
         IgniteCache<Integer, Company> co = grid(0).cache("co");
 
@@ -172,8 +176,6 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
     }
 
     /**
-     * JUnit.
-     *
      * @throws Exception If failed.
      */
     public void testRestarts() throws Exception {
@@ -323,7 +325,9 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
         info("Queries stopped.");
     }
 
-    // Partitioned
+    /**
+     *
+     */
     private static class Person implements Serializable {
         @QuerySqlField(index = true)
         int id;
@@ -333,6 +337,9 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
         }
     }
 
+    /**
+     *
+     */
     private static class Purchase implements Serializable {
         @QuerySqlField(index = true)
         int personId;
@@ -346,7 +353,9 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
         }
     }
 
-    // Replicated
+    /**
+     *
+     */
     private static class Company implements Serializable {
         @QuerySqlField(index = true)
         int id;
@@ -356,6 +365,9 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
         }
     }
 
+    /**
+     *
+     */
     private static class Product implements Serializable {
         @QuerySqlField(index = true)
         int id;


[39/50] incubator-ignite git commit: Fixed test.

Posted by sb...@apache.org.
Fixed 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/4f3292d5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4f3292d5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4f3292d5

Branch: refs/heads/ignite-950
Commit: 4f3292d5d8b29c04fcc1bf1fa9b88e5f19ceddfe
Parents: d874b00
Author: nikolay tikhonov <nt...@gridgain.com>
Authored: Thu Jun 18 15:19:03 2015 +0300
Committer: nikolay tikhonov <nt...@gridgain.com>
Committed: Thu Jun 18 15:19:03 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/GridSelfTest.java    | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f3292d5/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
index eccae34..2de04b0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
@@ -112,7 +112,9 @@ public class GridSelfTest extends GridProjectionAbstractTest {
      */
     @SuppressWarnings({"TooBroadScope"})
     public void testAsyncListen() throws Exception {
-        final String msg = "HELLO!";
+        final String hello = "HELLO!";
+
+        final String bye = "BYE!";
 
         final Ignite g = grid(0);
 
@@ -120,10 +122,12 @@ public class GridSelfTest extends GridProjectionAbstractTest {
 
         g.message().remoteListen(null, new MessagingListenActor<String>() {
             @Override protected void receive(UUID nodeId, String rcvMsg) throws Throwable {
-                assertEquals(locNodeId, nodeId);
-                assertEquals(msg, rcvMsg);
+                if (hello.equals(rcvMsg)) {
+                    assertEquals(locNodeId, nodeId);
+                    assertEquals(hello, rcvMsg);
 
-                stop(rcvMsg);
+                    stop(bye);
+                }
             }
         });
 
@@ -131,22 +135,22 @@ public class GridSelfTest extends GridProjectionAbstractTest {
 
         g.message().localListen(null, new P2<UUID, String>() {
             @Override public boolean apply(UUID nodeId, String msg) {
-                if (!locNodeId.equals(nodeId))
+                if (msg.equals(bye))
                     cnt.incrementAndGet();
 
                 return true;
             }
         });
 
-        g.message().send(null, msg);
+        g.message().send(null, hello);
 
         GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
-                return cnt.get() == g.cluster().forRemotes().nodes().size();
+                return cnt.get() == g.cluster().nodes().size();
             }
         }, 5000);
 
-        assertEquals(cnt.get(), g.cluster().forRemotes().nodes().size());
+        assertEquals(cnt.get(), g.cluster().nodes().size());
     }
 
     /**


[27/50] incubator-ignite git commit: # ignite-sprint-6 more info in test assert

Posted by sb...@apache.org.
# ignite-sprint-6 more info in test assert


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

Branch: refs/heads/ignite-950
Commit: d874b00dcb1687339adc34b6212e8cbc5b9ffe16
Parents: 6c683c2
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jun 18 11:07:04 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jun 18 11:07:04 2015 +0300

----------------------------------------------------------------------
 .../IgniteCacheAbstractStopBusySelfTest.java    | 30 ++++++++++++--------
 .../IgniteCacheAtomicStopBusySelfTest.java      |  8 +++---
 ...gniteCacheTransactionalStopBusySelfTest.java |  8 +++---
 3 files changed, 26 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d874b00d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
index 10b14cc..074f6ff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
@@ -36,9 +36,13 @@ import org.apache.ignite.testframework.junits.common.*;
 import org.jetbrains.annotations.*;
 
 import java.io.*;
+import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
 /**
  *
  */
@@ -53,7 +57,7 @@ public abstract class IgniteCacheAbstractStopBusySelfTest extends GridCommonAbst
     public static final String CACHE_NAME = "StopTest";
 
     /** */
-    public static final TcpDiscoveryIpFinder finder = new TcpDiscoveryVmIpFinder(true);
+    public final TcpDiscoveryIpFinder finder = new TcpDiscoveryVmIpFinder(true);
 
     /** */
     private AtomicBoolean suspended = new AtomicBoolean(false);
@@ -62,7 +66,7 @@ public abstract class IgniteCacheAbstractStopBusySelfTest extends GridCommonAbst
     private CountDownLatch blocked;
 
     /** */
-    protected AtomicReference<Class> bannedMessage = new AtomicReference<>();
+    protected AtomicReference<Class> bannedMsg = new AtomicReference<>();
 
     /**
      * @return Cache mode.
@@ -93,9 +97,9 @@ public abstract class IgniteCacheAbstractStopBusySelfTest extends GridCommonAbst
         if (gridName.endsWith(String.valueOf(CLN_GRD)))
             cfg.setClientMode(true);
 
-        cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
+        cacheCfg.setRebalanceMode(SYNC);
 
-        cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
 
         cacheCfg.setBackups(1);
 
@@ -125,14 +129,14 @@ public abstract class IgniteCacheAbstractStopBusySelfTest extends GridCommonAbst
             TimeUnit.MILLISECONDS.sleep(100L);
         }
 
-        assert clientNode().cluster().nodes().size() == 2;
+        assertEquals(2, clientNode().cluster().nodes().size());
     }
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         suspended.set(false);
 
-        bannedMessage.set(null);
+        bannedMsg.set(null);
 
         afterTestsStopped();
 
@@ -140,7 +144,9 @@ public abstract class IgniteCacheAbstractStopBusySelfTest extends GridCommonAbst
 
         stopGrid(CLN_GRD);
 
-        assert G.allGrids().isEmpty();
+        List<Ignite> nodes = G.allGrids();
+
+        assertTrue("Unexpected nodes: " + nodes, nodes.isEmpty());
     }
 
     /**
@@ -203,12 +209,11 @@ public abstract class IgniteCacheAbstractStopBusySelfTest extends GridCommonAbst
      * @throws Exception If failed.
      */
     public void testGet() throws Exception {
-        bannedMessage.set(GridNearGetRequest.class);
+        bannedMsg.set(GridNearGetRequest.class);
 
         executeTest(new Callable<Integer>() {
             /** {@inheritDoc} */
-            @Override
-            public Integer call() throws Exception {
+            @Override public Integer call() throws Exception {
                 info("Start operation.");
 
                 Integer put = (Integer) clientCache().get(1);
@@ -318,6 +323,7 @@ public abstract class IgniteCacheAbstractStopBusySelfTest extends GridCommonAbst
      * @return Cache configuration.
      * @throws Exception In case of error.
      */
+    @SuppressWarnings("unchecked")
     private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
@@ -339,10 +345,10 @@ public abstract class IgniteCacheAbstractStopBusySelfTest extends GridCommonAbst
         /** {@inheritDoc} */
         @Override public void sendMessage(ClusterNode node, Message msg) throws IgniteSpiException {
             if (suspended.get()) {
-                assert bannedMessage.get() != null;
+                assert bannedMsg.get() != null;
 
                 if (msg instanceof GridIoMessage
-                    && ((GridIoMessage)msg).message().getClass().equals(bannedMessage.get())) {
+                    && ((GridIoMessage)msg).message().getClass().equals(bannedMsg.get())) {
                     blocked.countDown();
 
                     return;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d874b00d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
index bae1601..ed15724 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
@@ -31,28 +31,28 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testPut() throws Exception {
-        bannedMessage.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicUpdateRequest.class);
 
         super.testPut();
     }
 
     /** {@inheritDoc} */
     @Override public void testPutBatch() throws Exception {
-        bannedMessage.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicUpdateRequest.class);
 
         super.testPut();
     }
 
     /** {@inheritDoc} */
     @Override public void testPutAsync() throws Exception {
-        bannedMessage.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicUpdateRequest.class);
 
         super.testPut();
     }
 
     /** {@inheritDoc} */
     @Override public void testRemove() throws Exception {
-        bannedMessage.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicUpdateRequest.class);
 
         super.testPut();
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d874b00d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTransactionalStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTransactionalStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTransactionalStopBusySelfTest.java
index fe1b266..e87a772 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTransactionalStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTransactionalStopBusySelfTest.java
@@ -30,28 +30,28 @@ public class IgniteCacheTransactionalStopBusySelfTest extends IgniteCacheAbstrac
 
     /** {@inheritDoc} */
     @Override public void testPut() throws Exception {
-        bannedMessage.set(GridNearTxPrepareRequest.class);
+        bannedMsg.set(GridNearTxPrepareRequest.class);
 
         super.testPut();
     }
 
     /** {@inheritDoc} */
     @Override public void testPutBatch() throws Exception {
-        bannedMessage.set(GridNearTxPrepareRequest.class);
+        bannedMsg.set(GridNearTxPrepareRequest.class);
 
         super.testPut();
     }
 
     /** {@inheritDoc} */
     @Override public void testPutAsync() throws Exception {
-        bannedMessage.set(GridNearTxPrepareRequest.class);
+        bannedMsg.set(GridNearTxPrepareRequest.class);
 
         super.testPut();
     }
 
     /** {@inheritDoc} */
     @Override public void testRemove() throws Exception {
-        bannedMessage.set(GridNearTxPrepareRequest.class);
+        bannedMsg.set(GridNearTxPrepareRequest.class);
 
         super.testPut();
     }


[30/50] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6


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

Branch: refs/heads/ignite-950
Commit: b23ea747d9cf351f607d60f520781f5d46e98715
Parents: 08d134d c1eee18
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 18 13:47:19 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 18 13:47:19 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/cache/IgniteCacheProxy.java    | 5 +++++
 .../ignite/internal/processors/query/GridQueryProcessor.java  | 7 +++++++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------



[06/50] incubator-ignite git commit: Fixed tests.

Posted by sb...@apache.org.
Fixed tests.


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

Branch: refs/heads/ignite-950
Commit: 5218210cf3400913ab2116684b23503efbbd32a3
Parents: 9c0b09c
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Wed Jun 17 14:36:44 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Wed Jun 17 14:36:44 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/client/GridClientConfiguration.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5218210c/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
index f06d779..7fa0dae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
@@ -110,7 +110,7 @@ public class GridClientConfiguration {
     private ExecutorService executor;
 
     /** Marshaller. */
-    private GridClientMarshaller marshaller;
+    private GridClientMarshaller marshaller = new GridClientOptimizedMarshaller(U.allPluginProviders());
 
     /** Daemon flag. */
     private boolean daemon;
@@ -119,7 +119,7 @@ public class GridClientConfiguration {
      * Creates default configuration.
      */
     public GridClientConfiguration() {
-        marshaller = new GridClientOptimizedMarshaller(U.allPluginProviders());
+        // No-op.
     }
 
     /**


[15/50] incubator-ignite git commit: ignite-484-1 - improved retry

Posted by sb...@apache.org.
ignite-484-1 - improved retry


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

Branch: refs/heads/ignite-950
Commit: 94060c9ef41161c7262a28044ddb176f86814b01
Parents: 10febf2
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 17 19:46:42 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 17 19:46:42 2015 +0300

----------------------------------------------------------------------
 .../query/h2/twostep/GridMapQueryExecutor.java  | 26 ++++--
 .../h2/twostep/GridReduceQueryExecutor.java     | 86 ++++++++++++++------
 ...lientQueryReplicatedNodeRestartSelfTest.java | 50 ++++++++++--
 3 files changed, 125 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/94060c9e/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index aaf64ee..2503a87 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -48,6 +48,7 @@ import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
 import static org.apache.ignite.events.EventType.*;
+import static org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.*;
 import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.*;
 import static org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessageFactory.*;
 
@@ -230,6 +231,15 @@ public class GridMapQueryExecutor {
     }
 
     /**
+     * @param cctx Cache context.
+     * @param p Partition ID.
+     * @return Partition.
+     */
+    private GridDhtLocalPartition partition(GridCacheContext<?, ?> cctx, int p) {
+        return cctx.topology().localPartition(p, NONE, false);
+    }
+
+    /**
      * @param cacheNames Cache names.
      * @param topVer Topology version.
      * @param explicitParts Explicit partitions list.
@@ -263,10 +273,12 @@ public class GridMapQueryExecutor {
             GridReservable r = reservations.get(grpKey);
 
             if (explicitParts == null && r != null) { // Try to reserve group partition if any and no explicits.
-                if (!r.reserve())
-                    return false; // We need explicit partitions here -> retry.
+                if (r != ReplicatedReservation.INSTANCE) {
+                    if (!r.reserve())
+                        return false; // We need explicit partitions here -> retry.
 
-                reserved.add(r);
+                    reserved.add(r);
+                }
             }
             else { // Try to reserve partitions one by one.
                 int partsCnt = cctx.affinity().partitions();
@@ -274,7 +286,7 @@ public class GridMapQueryExecutor {
                 if (cctx.isReplicated()) { // Check all the partitions are in owning state for replicated cache.
                     if (r == null) { // Check only once.
                         for (int p = 0; p < partsCnt; p++) {
-                            GridDhtLocalPartition part = cctx.topology().localPartition(p, topVer, false);
+                            GridDhtLocalPartition part = partition(cctx, p);
 
                             // We don't need to reserve partitions because they will not be evicted in replicated caches.
                             if (part == null || part.state() != OWNING)
@@ -290,7 +302,7 @@ public class GridMapQueryExecutor {
                         partIds = cctx.affinity().primaryPartitions(ctx.localNodeId(), topVer);
 
                     for (int partId : partIds) {
-                        GridDhtLocalPartition part = cctx.topology().localPartition(partId, topVer, false);
+                        GridDhtLocalPartition part = partition(cctx, partId);
 
                         if (part == null || part.state() != OWNING || !part.reserve())
                             return false;
@@ -806,12 +818,12 @@ public class GridMapQueryExecutor {
 
         /** {@inheritDoc} */
         @Override public boolean reserve() {
-            return true;
+            throw new IllegalStateException();
         }
 
         /** {@inheritDoc} */
         @Override public void release() {
-            // No-op.
+            throw new IllegalStateException();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/94060c9e/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 c570d24..6635dde 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
@@ -335,7 +335,7 @@ public class GridReduceQueryExecutor {
     ) {
         String space = cctx.name();
 
-        Set<ClusterNode> nodes = new HashSet<>(ctx.discovery().cacheAffinityNodes(space, topVer));
+        Set<ClusterNode> nodes = new HashSet<>(dataNodes(space, topVer));
 
         if (F.isEmpty(nodes))
             throw new CacheException("No data nodes found for cache: " + space);
@@ -351,7 +351,7 @@ public class GridReduceQueryExecutor {
                     throw new CacheException("Queries running on replicated cache should not contain JOINs " +
                         "with partitioned tables.");
 
-                Collection<ClusterNode> extraNodes = ctx.discovery().cacheAffinityNodes(extraSpace, topVer);
+                Collection<ClusterNode> extraNodes = dataNodes(extraSpace, topVer);
 
                 if (F.isEmpty(extraNodes))
                     throw new CacheException("No data nodes found for cache: " + extraSpace);
@@ -398,7 +398,18 @@ public class GridReduceQueryExecutor {
      * @return Cursor.
      */
     public Iterator<List<?>> query(GridCacheContext<?,?> cctx, GridCacheTwoStepQuery qry, boolean keepPortable) {
-        for (;;) {
+        for (int attempt = 0;; attempt++) {
+            if (attempt != 0) {
+                try {
+                    Thread.sleep(attempt * 10); // Wait for exchange.
+                }
+                catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+
+                    throw new CacheException("Query was interrupted.", e);
+                }
+            }
+
             long qryReqId = reqIdGen.incrementAndGet();
 
             QueryRun r = new QueryRun();
@@ -422,9 +433,9 @@ public class GridReduceQueryExecutor {
 
             if (isPreloadingActive(cctx, extraSpaces)) {
                 if (cctx.isReplicated())
-                    nodes = replicatedDataNodes(cctx, extraSpaces);
+                    nodes = replicatedUnstableDataNodes(cctx, extraSpaces);
                 else {
-                    partsMap = partitionLocations(cctx, extraSpaces);
+                    partsMap = partitionedUnstableDataNodes(cctx, extraSpaces);
 
                     nodes = partsMap == null ? null : partsMap.keySet();
                 }
@@ -538,9 +549,6 @@ public class GridReduceQueryExecutor {
             catch (IgniteCheckedException | RuntimeException e) {
                 U.closeQuiet(r.conn);
 
-                if (e instanceof CacheException)
-                    throw (CacheException)e;
-
                 throw new CacheException("Failed to run reduce query locally.", e);
             }
             finally {
@@ -559,10 +567,14 @@ public class GridReduceQueryExecutor {
      * @param extraSpaces Extra spaces.
      * @return Collection of all data nodes owning all the caches or {@code null} for retry.
      */
-    private Collection<ClusterNode> replicatedDataNodes(final GridCacheContext<?,?> cctx, List<String> extraSpaces) {
+    private Collection<ClusterNode> replicatedUnstableDataNodes(final GridCacheContext<?,?> cctx,
+        List<String> extraSpaces) {
         assert cctx.isReplicated() : cctx.name() + " must be replicated";
 
-        Set<ClusterNode> nodes = owningReplicatedDataNodes(cctx);
+        Set<ClusterNode> nodes = replicatedUnstableDataNodes(cctx);
+
+        if (F.isEmpty(nodes))
+            return null; // Retry.
 
         if (!F.isEmpty(extraSpaces)) {
             for (String extraSpace : extraSpaces) {
@@ -575,7 +587,12 @@ public class GridReduceQueryExecutor {
                     throw new CacheException("Queries running on replicated cache should not contain JOINs " +
                         "with partitioned tables.");
 
-                nodes.retainAll(owningReplicatedDataNodes(extraCctx));
+                Set<ClusterNode> extraOwners = replicatedUnstableDataNodes(extraCctx);
+
+                if (F.isEmpty(extraOwners))
+                    return null; // Retry.
+
+                nodes.retainAll(extraOwners);
 
                 if (nodes.isEmpty())
                     return null; // Retry.
@@ -586,34 +603,43 @@ public class GridReduceQueryExecutor {
     }
 
     /**
+     * @param space Cache name.
+     * @param topVer Topology version.
+     * @return Collection of data nodes.
+     */
+    private Collection<ClusterNode> dataNodes(String space, AffinityTopologyVersion topVer) {
+        Collection<ClusterNode> res = ctx.discovery().cacheAffinityNodes(space, topVer);
+
+        return res != null ? res : Collections.<ClusterNode>emptySet();
+    }
+
+    /**
      * Collects all the nodes owning all the partitions for the given replicated cache.
      *
      * @param cctx Cache context.
-     * @return Owning nodes.
+     * @return Owning nodes or {@code null} if we can't find owners for some partitions.
      */
-    private Set<ClusterNode> owningReplicatedDataNodes(GridCacheContext<?,?> cctx) {
+    private Set<ClusterNode> replicatedUnstableDataNodes(GridCacheContext<?,?> cctx) {
         assert cctx.isReplicated() : cctx.name() + " must be replicated";
 
         String space = cctx.name();
 
-        Set<ClusterNode> dataNodes = new HashSet<>(ctx.discovery().cacheAffinityNodes(space, NONE));
+        Set<ClusterNode> dataNodes = new HashSet<>(dataNodes(space, NONE));
 
         if (dataNodes.isEmpty())
             throw new CacheException("No data nodes found for cache '" + space + "'");
 
         // Find all the nodes owning all the partitions for replicated cache.
-        for (int p = 0, extraParts = cctx.affinity().partitions(); p < extraParts; p++) {
+        for (int p = 0, parts = cctx.affinity().partitions(); p < parts; p++) {
             List<ClusterNode> owners = cctx.topology().owners(p);
 
-            if (owners.isEmpty())
-                throw new CacheException("No data nodes found for cache '" + space +
-                    "' for partition " + p);
+            if (F.isEmpty(owners))
+                return null; // Retry.
 
             dataNodes.retainAll(owners);
 
             if (dataNodes.isEmpty())
-                throw new CacheException("No data nodes found for cache '" + space +
-                    "' owning all the partitions.");
+                return null; // Retry.
         }
 
         return dataNodes;
@@ -627,7 +653,8 @@ public class GridReduceQueryExecutor {
      * @return Partition mapping or {@code null} if we can't calculate it due to repartitioning and we need to retry.
      */
     @SuppressWarnings("unchecked")
-    private Map<ClusterNode, IntArray> partitionLocations(final GridCacheContext<?,?> cctx, List<String> extraSpaces) {
+    private Map<ClusterNode, IntArray> partitionedUnstableDataNodes(final GridCacheContext<?,?> cctx,
+        List<String> extraSpaces) {
         assert !cctx.isReplicated() && !cctx.isLocal() : cctx.name() + " must be partitioned";
 
         final int partsCnt = cctx.affinity().partitions();
@@ -653,8 +680,12 @@ public class GridReduceQueryExecutor {
         for (int p = 0, parts =  cctx.affinity().partitions(); p < parts; p++) {
             List<ClusterNode> owners = cctx.topology().owners(p);
 
-            if (F.isEmpty(owners))
+            if (F.isEmpty(owners)) {
+                if (!F.isEmpty(dataNodes(cctx.name(), NONE)))
+                    return null; // Retry.
+
                 throw new CacheException("No data nodes found for cache '" + cctx.name() + "' for partition " + p);
+            }
 
             partLocs[p] = new HashSet<>(owners);
         }
@@ -671,9 +702,13 @@ public class GridReduceQueryExecutor {
                 for (int p = 0, parts =  extraCctx.affinity().partitions(); p < parts; p++) {
                     List<ClusterNode> owners = extraCctx.topology().owners(p);
 
-                    if (F.isEmpty(owners))
+                    if (F.isEmpty(owners)) {
+                        if (!F.isEmpty(dataNodes(extraSpace, NONE)))
+                            return null; // Retry.
+
                         throw new CacheException("No data nodes found for cache '" + extraSpace +
                             "' for partition " + p);
+                    }
 
                     if (partLocs[p] == null)
                         partLocs[p] = new HashSet<>(owners);
@@ -693,7 +728,10 @@ public class GridReduceQueryExecutor {
                 if (!extraCctx.isReplicated())
                     continue;
 
-                Set<ClusterNode> dataNodes = owningReplicatedDataNodes(extraCctx);
+                Set<ClusterNode> dataNodes = replicatedUnstableDataNodes(extraCctx);
+
+                if (F.isEmpty(dataNodes))
+                    return null; // Retry.
 
                 for (Set<ClusterNode> partLoc : partLocs) {
                     partLoc.retainAll(dataNodes);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/94060c9e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
index 23f44c0..3f23005 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
@@ -64,6 +64,9 @@ public class IgniteCacheClientQueryReplicatedNodeRestartSelfTest extends GridCom
         };
 
     /** */
+    private static final List<List<?>> FAKE = new LinkedList<>();
+
+    /** */
     private static final int GRID_CNT = 5;
 
     /** */
@@ -191,7 +194,7 @@ public class IgniteCacheClientQueryReplicatedNodeRestartSelfTest extends GridCom
     public void testRestarts() throws Exception {
         int duration = 90 * 1000;
         int qryThreadNum = 5;
-        int restartThreadsNum = 2; // 2 of 4 data nodes
+        int restartThreadsNum = 3; // 3 of 4 data nodes
         final int nodeLifeTime = 2 * 1000;
         final int logFreq = 10;
 
@@ -212,13 +215,32 @@ public class IgniteCacheClientQueryReplicatedNodeRestartSelfTest extends GridCom
         final AtomicInteger qryCnt = new AtomicInteger();
         final AtomicBoolean qrysDone = new AtomicBoolean();
 
+        final List<Integer> cacheSize = new ArrayList<>(4);
+
         for (int i = 0; i < GRID_CNT - 1; i++) {
-            for (String cacheName : F.asList("co", "pr", "pe", "pu"))
-                assertClient(grid(i).cache(cacheName), false);
+            int j = 0;
+
+            for (String cacheName : F.asList("co", "pr", "pe", "pu")) {
+                IgniteCache<?,?> cache = grid(i).cache(cacheName);
+
+                assertClient(cache, false);
+
+                if (i == 0)
+                    cacheSize.add(cache.size());
+                else
+                    assertEquals(cacheSize.get(j++).intValue(), cache.size());
+            }
         }
 
-        for (String cacheName : F.asList("co", "pr", "pe", "pu"))
-            assertClient(grid(GRID_CNT - 1).cache(cacheName), true);
+        int j = 0;
+
+        for (String cacheName : F.asList("co", "pr", "pe", "pu")) {
+            IgniteCache<?,?> cache = grid(GRID_CNT - 1).cache(cacheName);
+
+            assertClient(cache, true);
+
+            assertEquals(cacheSize.get(j++).intValue(), cache.size());
+        }
 
         final IgniteCache<?,?> clientCache = grid(GRID_CNT - 1).cache("pu");
 
@@ -234,8 +256,10 @@ public class IgniteCacheClientQueryReplicatedNodeRestartSelfTest extends GridCom
                     if (smallPageSize)
                         qry.setPageSize(3);
 
+                    List<List<?>> res;
+
                     try {
-                        assertEquals(pRes, clientCache.query(qry).getAll());
+                        res = clientCache.query(qry).getAll();
                     }
                     catch (CacheException e) {
                         assertTrue("On large page size must retry.", smallPageSize);
@@ -259,6 +283,20 @@ public class IgniteCacheClientQueryReplicatedNodeRestartSelfTest extends GridCom
 
                             fail("Must fail inside of GridResultPage.fetchNextPage or subclass.");
                         }
+
+                        res = FAKE;
+                    }
+
+                    if (res != FAKE && !res.equals(pRes)) {
+                        int j = 0;
+
+                        // Check for data loss.
+                        for (String cacheName : F.asList("co", "pr", "pe", "pu")) {
+                            assertEquals(cacheName, cacheSize.get(j++).intValue(),
+                                grid(GRID_CNT - 1).cache(cacheName).size());
+                        }
+
+                        assertEquals(pRes, res); // Fail with nice message.
                     }
 
                     int c = qryCnt.incrementAndGet();


[10/50] incubator-ignite git commit: # ignite-1020 do not write to store for local store load

Posted by sb...@apache.org.
# ignite-1020 do not write to store for local store load


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

Branch: refs/heads/ignite-950
Commit: 674072a336a2aa276373a5f6820a9e66df88ede8
Parents: e507f03
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 17 15:31:57 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 17 15:31:57 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/cache/GridCacheAdapter.java    | 4 ++++
 .../ignite/internal/processors/cache/IgniteCacheProxy.java    | 7 +++++++
 .../processors/dr/IgniteDrDataStreamerCacheUpdater.java       | 7 ++++++-
 3 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/674072a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 2ca7687..7335d72 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -3305,6 +3305,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                 DataStreamerImpl ldr = ctx.kernalContext().dataStream().dataStreamer(ctx.namex());
 
                 try {
+                    ldr.skipStore(true);
+
                     ldr.receiver(new IgniteDrDataStreamerCacheUpdater());
 
                     LocalStoreLoadClosure c = new LocalStoreLoadClosure(p, ldr, plc);
@@ -3504,6 +3506,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             DataStreamerImpl ldr = ctx.kernalContext().dataStream().dataStreamer(ctx.namex());
 
             try {
+                ldr.skipStore(true);
+
                 ldr.receiver(new IgniteDrDataStreamerCacheUpdater());
 
                 LocalStoreLoadClosure c = new LocalStoreLoadClosure(null, ldr, plc0);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/674072a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 69ce7b0..0d70792 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -139,6 +139,13 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
     }
 
     /**
+     * @return Operation context.
+     */
+    @Nullable public CacheOperationContext operationContext() {
+        return opCtx;
+    }
+
+    /**
      * Gets cache proxy which does not acquire read lock on gateway enter, should be
      * used only if grid read lock is externally acquired.
      *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/674072a3/modules/core/src/main/java/org/apache/ignite/internal/processors/dr/IgniteDrDataStreamerCacheUpdater.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dr/IgniteDrDataStreamerCacheUpdater.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dr/IgniteDrDataStreamerCacheUpdater.java
index c3a8989..e5bbe39 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dr/IgniteDrDataStreamerCacheUpdater.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dr/IgniteDrDataStreamerCacheUpdater.java
@@ -46,7 +46,12 @@ public class IgniteDrDataStreamerCacheUpdater implements StreamReceiver<KeyCache
 
             GridKernalContext ctx = ((IgniteKernal)cache0.unwrap(Ignite.class)).context();
             IgniteLogger log = ctx.log(IgniteDrDataStreamerCacheUpdater.class);
-            GridCacheAdapter cache = ctx.cache().internalCache(cacheName);
+            GridCacheAdapter internalCache = ctx.cache().internalCache(cacheName);
+
+            CacheOperationContext opCtx = ((IgniteCacheProxy)cache0).operationContext();
+
+            IgniteInternalCache cache =
+                opCtx != null ? new GridCacheProxyImpl(internalCache.context(), internalCache, opCtx) : internalCache;
 
             assert !F.isEmpty(col);
 


[14/50] incubator-ignite git commit: # i-484-1 review

Posted by sb...@apache.org.
# i-484-1 review


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

Branch: refs/heads/ignite-950
Commit: 42982382ee92bc12073beac34d72590bf905ed3e
Parents: 10febf2
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jun 17 18:12:49 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jun 17 18:12:49 2015 +0300

----------------------------------------------------------------------
 .../processors/query/h2/twostep/GridReduceQueryExecutor.java      | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/42982382/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 c570d24..6c407d9 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
@@ -438,7 +438,8 @@ public class GridReduceQueryExecutor {
             assert !nodes.isEmpty();
 
             if (cctx.isReplicated() || qry.explain()) {
-                assert qry.explain() || !nodes.contains(ctx.cluster().get().localNode()) : "We must be on a client node.";
+                assert qry.explain() || !nodes.contains(ctx.cluster().get().localNode()) :
+                    "We must be on a client node.";
 
                 // Select random data node to run query on a replicated data or get EXPLAIN PLAN from a single node.
                 nodes = Collections.singleton(F.rand(nodes));


[43/50] incubator-ignite git commit: ignite-950: putting field type instead of field length into the meta

Posted by sb...@apache.org.
ignite-950: putting field type instead of field length into the meta


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

Branch: refs/heads/ignite-950
Commit: 296ff8ce31a1d04f69b07b681b7c4e0f5eb34919
Parents: 5e7fcc1
Author: Denis Magda <dm...@gridgain.com>
Authored: Thu Jun 18 16:32:57 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Thu Jun 18 16:32:57 2015 +0300

----------------------------------------------------------------------
 .../optimized/ext/OptimizedObjectMetadata.java  | 81 +++++++++++---------
 1 file changed, 43 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/296ff8ce/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectMetadata.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectMetadata.java
index 7154a25..39acece 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectMetadata.java
@@ -46,40 +46,9 @@ public class OptimizedObjectMetadata implements Externalizable {
         if (fieldsInfo == null)
             fieldsInfo = new ArrayList<>();
 
-        int len = 1;
-
-        switch (fieldType) {
-            case BYTE:
-            case BOOLEAN:
-                len += 1;
-                break;
-
-            case SHORT:
-            case CHAR:
-                len += 2;
-                break;
-
-            case INT:
-            case FLOAT:
-                len += 4;
-                break;
-
-            case LONG:
-            case DOUBLE:
-                len += 8;
-                break;
-
-            case OTHER:
-                len = OptimizedMarshallerExt.VARIABLE_LEN;
-                break;
-
-            default:
-                throw new IgniteException("Unknown field type: " + fieldType);
-        }
 
-        assert len != 1;
 
-        fieldsInfo.add(new FieldInfo(fieldId, len));
+        fieldsInfo.add(new FieldInfo(fieldId, fieldType));
     }
 
     /**
@@ -111,7 +80,7 @@ public class OptimizedObjectMetadata implements Externalizable {
 
         for (FieldInfo fieldInfo : fieldsInfo) {
             out.writeInt(fieldInfo.id);
-            out.writeInt(fieldInfo.len);
+            out.writeByte(fieldInfo.type.ordinal());
         }
     }
 
@@ -122,7 +91,7 @@ public class OptimizedObjectMetadata implements Externalizable {
         fieldsInfo = new ArrayList<>(size);
 
         for (int i = 0; i < size; i++)
-            fieldsInfo.add(new FieldInfo(in.readInt(), in.readInt()));
+            fieldsInfo.add(new FieldInfo(in.readInt(), OptimizedFieldType.values()[in.readByte()]));
     }
 
     /**
@@ -132,18 +101,54 @@ public class OptimizedObjectMetadata implements Externalizable {
         /** Field ID. */
         int id;
 
-        /** Field type. */
+        /** Field len. */
         int len;
 
+        /** Field type. */
+        OptimizedFieldType type;
+
         /**
          * Constructor.
          *
          * @param id Field ID.
-         * @param len Field len.
+         * @param type Field len.
          */
-        public FieldInfo(int id, int len) {
+        public FieldInfo(int id, OptimizedFieldType type) {
             this.id = id;
-            this.len = len;
+            this.type = type;
+
+            len = 1;
+
+            switch (type) {
+                case BYTE:
+                case BOOLEAN:
+                    len += 1;
+                    break;
+
+                case SHORT:
+                case CHAR:
+                    len += 2;
+                    break;
+
+                case INT:
+                case FLOAT:
+                    len += 4;
+                    break;
+
+                case LONG:
+                case DOUBLE:
+                    len += 8;
+                    break;
+
+                case OTHER:
+                    len = OptimizedMarshallerExt.VARIABLE_LEN;
+                    break;
+
+                default:
+                    throw new IgniteException("Unknown field type: " + type);
+            }
+
+            assert len != 1;
         }
     }
 }


[31/50] incubator-ignite git commit: # ignite-1003 add lastSuccessfulAddr for ping

Posted by sb...@apache.org.
# ignite-1003 add lastSuccessfulAddr for ping


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

Branch: refs/heads/ignite-950
Commit: b23f9300794c7e84dfc83c1b8e49de673fa354e1
Parents: d874b00
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jun 18 13:52:45 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jun 18 13:52:45 2015 +0300

----------------------------------------------------------------------
 .../communication/tcp/TcpCommunicationSpi.java  | 38 ++++++++++----------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 21 +++++++----
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  9 ++++-
 .../tcp/internal/TcpDiscoveryNode.java          | 18 ++++++++++
 4 files changed, 60 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b23f9300/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 9e38788..39f4eeb 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -267,23 +267,19 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                         if (!isNodeStopping()) {
                             GridNioRecoveryDescriptor recoveryData = ses.recoveryDescriptor();
 
-                            if (!getSpiContext().tryFailNode(id)) {
-                                if (recoveryData != null) {
-                                    if (recoveryData.nodeAlive(getSpiContext().node(id))) {
-                                        if (!recoveryData.messagesFutures().isEmpty()) {
-                                            if (log.isDebugEnabled())
-                                                log.debug("Session was closed but there are unacknowledged messages, " +
-                                                    "will try to reconnect [rmtNode=" + recoveryData.node().id() + ']');
-
-                                            commWorker.addReconnectRequest(recoveryData);
-                                        }
+                            if (recoveryData != null) {
+                                if (recoveryData.nodeAlive(getSpiContext().node(id))) {
+                                    if (!recoveryData.messagesFutures().isEmpty()) {
+                                        if (log.isDebugEnabled())
+                                            log.debug("Session was closed but there are unacknowledged messages, " +
+                                                "will try to reconnect [rmtNode=" + recoveryData.node().id() + ']');
+
+                                        commWorker.addReconnectRequest(recoveryData);
                                     }
-                                    else
-                                        recoveryData.onNodeLeft();
                                 }
+                                else
+                                    recoveryData.onNodeLeft();
                             }
-                            else
-                                recoveryData.onNodeLeft();
                         }
                     }
 
@@ -1884,18 +1880,20 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                 "TCP communication addresses or mapped external addresses. Check configuration and make sure " +
                 "that you use the same communication SPI on all nodes. Remote node id: " + node.id());
 
-        List<InetSocketAddress> addrs;
+        LinkedHashSet<InetSocketAddress> addrs;
 
         // Try to connect first on bound addresses.
         if (isRmtAddrsExist) {
-            addrs = new ArrayList<>(U.toSocketAddresses(rmtAddrs0, rmtHostNames0, boundPort));
+            List<InetSocketAddress> addrs0 = new ArrayList<>(U.toSocketAddresses(rmtAddrs0, rmtHostNames0, boundPort));
 
             boolean sameHost = U.sameMacs(getSpiContext().localNode(), node);
 
-            Collections.sort(addrs, U.inetAddressesComparator(sameHost));
+            Collections.sort(addrs0, U.inetAddressesComparator(sameHost));
+
+            addrs = new LinkedHashSet<>(addrs0);
         }
         else
-            addrs = new ArrayList<>();
+            addrs = new LinkedHashSet<>();
 
         // Then on mapped external addresses.
         if (isExtAddrsExist)
@@ -2610,7 +2608,9 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         private void processRecovery(GridNioRecoveryDescriptor recoveryDesc) {
             ClusterNode node = recoveryDesc.node();
 
-            if (clients.containsKey(node.id()) || !recoveryDesc.nodeAlive(getSpiContext().node(node.id())))
+            if (clients.containsKey(node.id()) ||
+                !recoveryDesc.nodeAlive(getSpiContext().node(node.id())) ||
+                !getSpiContext().pingNode(node.id()))
                 return;
 
             try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b23f9300/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 63f165d..8a9553e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -440,7 +440,12 @@ class ServerImpl extends TcpDiscoveryImpl {
                 // ID returned by the node should be the same as ID of the parameter for ping to succeed.
                 IgniteBiTuple<UUID, Boolean> t = pingNode(addr, clientNodeId);
 
-                return node.id().equals(t.get1()) && (clientNodeId == null || t.get2());
+                boolean res = node.id().equals(t.get1()) && (clientNodeId == null || t.get2());
+
+                if (res)
+                    node.lastSuccessfulAddress(addr);
+
+                return res;
             }
             catch (IgniteCheckedException e) {
                 if (log.isDebugEnabled())
@@ -458,8 +463,9 @@ class ServerImpl extends TcpDiscoveryImpl {
      * Pings the node by its address to see if it's alive.
      *
      * @param addr Address of the node.
+     * @param clientNodeId Client node ID.
      * @return ID of the remote node and "client exists" flag if node alive.
-     * @throws IgniteSpiException If an error occurs.
+     * @throws IgniteCheckedException If an error occurs.
      */
     private IgniteBiTuple<UUID, Boolean> pingNode(InetSocketAddress addr, @Nullable UUID clientNodeId)
         throws IgniteCheckedException {
@@ -1589,8 +1595,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                     regAddrs,
                     F.notContains(currAddrs),
                     new P1<InetSocketAddress>() {
-                        private final Map<InetSocketAddress, Boolean> pingResMap =
-                            new HashMap<>();
+                        private final Map<InetSocketAddress, Boolean> pingResMap = new HashMap<>();
 
                         @Override public boolean apply(InetSocketAddress addr) {
                             Boolean res = pingResMap.get(addr);
@@ -2092,6 +2097,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                                     errs = null;
 
                                     success = true;
+
+                                    next.lastSuccessfulAddress(addr);
                                 }
                             }
                             catch (IOException | IgniteCheckedException e) {
@@ -2672,6 +2679,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                 try {
                     sendMessageDirectly(msg, addr);
 
+                    node.lastSuccessfulAddress(addr);
+
                     ex = null;
 
                     break;
@@ -4588,7 +4597,7 @@ class ServerImpl extends TcpDiscoveryImpl {
         }
 
         /**
-         *
+         * @param res Ping result.
          */
         public void pingResult(boolean res) {
             GridFutureAdapter<Boolean> fut = pingFut.getAndSet(null);
@@ -4598,7 +4607,7 @@ class ServerImpl extends TcpDiscoveryImpl {
         }
 
         /**
-         *
+         * @throws InterruptedException If interrupted.
          */
         public boolean ping() throws InterruptedException {
             if (spi.isNodeStopping0())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b23f9300/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index e4ef744..baada21 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -892,7 +892,14 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
 
         Collections.sort(addrs, U.inetAddressesComparator(sameHost));
 
-        LinkedHashSet<InetSocketAddress> res = new LinkedHashSet<>(addrs);
+        LinkedHashSet<InetSocketAddress> res = new LinkedHashSet<>();
+
+        InetSocketAddress lastAddr = node.lastSuccessfulAddress();
+
+        if (lastAddr != null)
+            res.add(lastAddr);
+
+        res.addAll(addrs);
 
         Collection<InetSocketAddress> extAddrs = node.attribute(createSpiAttributeName(ATTR_EXT_ADDRS));
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b23f9300/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
index cc61c9d..36ae39e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
@@ -111,6 +111,10 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
     @GridToStringExclude
     private UUID clientRouterNodeId;
 
+    /** */
+    @GridToStringExclude
+    private volatile transient InetSocketAddress lastSuccessfulAddr;
+
     /**
      * Public default no-arg constructor for {@link Externalizable} interface.
      */
@@ -152,6 +156,20 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
         sockAddrs = U.toSocketAddresses(this, discPort);
     }
 
+    /**
+     * @return Last successfully connected address.
+     */
+    @Nullable public InetSocketAddress lastSuccessfulAddress() {
+        return lastSuccessfulAddr;
+    }
+
+    /**
+     * @param lastSuccessfulAddr Last successfully connected address.
+     */
+    public void lastSuccessfulAddress(InetSocketAddress lastSuccessfulAddr) {
+        this.lastSuccessfulAddr = lastSuccessfulAddr;
+    }
+
     /** {@inheritDoc} */
     @Override public UUID id() {
         return id;


[37/50] incubator-ignite git commit: # disco spi usability - doc and warning messages on failure detection speed up

Posted by sb...@apache.org.
# disco spi usability - doc and warning messages on failure detection speed up


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

Branch: refs/heads/ignite-950
Commit: fc81bcfd0a4fd20e4322a060d7745754f14767e1
Parents: 31cf802
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 18 15:08:33 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 18 15:08:33 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java  | 4 ++++
 .../org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java  | 7 ++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc81bcfd/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index e9a949a..f7b6de9 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -2320,6 +2320,10 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                 for (TcpDiscoveryNode n : failedNodes)
                     msgWorker.addMessage(new TcpDiscoveryNodeFailedMessage(locNodeId, n.id(), n.internalOrder()));
+
+                LT.warn(log, null, "Local node has detected failed nodes and started cluster-wide procedure. " +
+                        "To speed up failure detection please see 'Failure Detection' section under javadoc" +
+                        "for 'TcpDiscoverySpi'");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc81bcfd/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 9a26867..d7c33a5 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -64,9 +64,9 @@ import java.util.concurrent.atomic.*;
  * {@link TcpDiscoveryIpFinder} about self start (stops when send succeeds)
  * and then this info goes to coordinator. When coordinator processes join request
  * and issues node added messages and all other nodes then receive info about new node.
- * <h1 class="header">Configuration</h1>
- * <h2 class="header">Important Notice</h2>
- * Configuration defaults are chosen to make possible for discovery SPI to reliably work on
+ * <h1 class="header">Failure Detection</h1>
+ * Configuration defaults (see Configuration section below for details)
+ * are chosen to make possible for discovery SPI work reliably on
  * most of hardware and virtual deployments, but this has made failure detection time worse.
  * <p>
  * For stable low-latency networks the following more aggressive settings are recommended
@@ -76,6 +76,7 @@ import java.util.concurrent.atomic.*;
  * <li>Socket timeout (see {@link #setSocketTimeout(long)}) - 200ms</li>
  * <li>Message acknowledgement timeout (see {@link #setAckTimeout(long)}) - 50ms</li>
  * </ul>
+ * <h1 class="header">Configuration</h1>
  * <h2 class="header">Mandatory</h2>
  * There are no mandatory configuration parameters.
  * <h2 class="header">Optional</h2>


[34/50] incubator-ignite git commit: # changed defaults for discovery

Posted by sb...@apache.org.
# changed defaults for discovery


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

Branch: refs/heads/ignite-950
Commit: 5011c2b5e9671ced95e21f122c2e5ef9102c19fe
Parents: b23ea74
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 18 14:50:43 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 18 14:50:43 2015 +0300

----------------------------------------------------------------------
 .../communication/tcp/TcpCommunicationSpi.java  |  6 ++--
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 32 +++++++++++++-------
 2 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5011c2b5/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 9e38788..fc504f4 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -174,8 +174,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     /** Default socket send and receive buffer size. */
     public static final int DFLT_SOCK_BUF_SIZE = 32 * 1024;
 
-    /** Default connection timeout (value is <tt>1000</tt>ms). */
-    public static final long DFLT_CONN_TIMEOUT = 1000;
+    /** Default connection timeout (value is <tt>5000</tt>ms). */
+    public static final long DFLT_CONN_TIMEOUT = 5000;
 
     /** Default Maximum connection timeout (value is <tt>600,000</tt>ms). */
     public static final long DFLT_MAX_CONN_TIMEOUT = 10 * 60 * 1000;
@@ -680,7 +680,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
     /** Recovery and idle clients handler. */
     private CommunicationWorker commWorker;
-    
+
     /** Shared memory accept worker. */
     private ShmemAcceptWorker shmemAcceptWorker;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5011c2b5/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index e4ef744..9a26867 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -21,7 +21,6 @@ import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.io.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -66,6 +65,17 @@ import java.util.concurrent.atomic.*;
  * and then this info goes to coordinator. When coordinator processes join request
  * and issues node added messages and all other nodes then receive info about new node.
  * <h1 class="header">Configuration</h1>
+ * <h2 class="header">Important Notice</h2>
+ * Configuration defaults are chosen to make possible for discovery SPI to reliably work on
+ * most of hardware and virtual deployments, but this has made failure detection time worse.
+ * <p>
+ * For stable low-latency networks the following more aggressive settings are recommended
+ * (which allows failure detection time ~200ms):
+ * <ul>
+ * <li>Heartbeat frequency (see {@link #setHeartbeatFrequency(long)}) - 100ms</li>
+ * <li>Socket timeout (see {@link #setSocketTimeout(long)}) - 200ms</li>
+ * <li>Message acknowledgement timeout (see {@link #setAckTimeout(long)}) - 50ms</li>
+ * </ul>
  * <h2 class="header">Mandatory</h2>
  * There are no mandatory configuration parameters.
  * <h2 class="header">Optional</h2>
@@ -164,23 +174,23 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     /** Default value for thread priority (value is <tt>10</tt>). */
     public static final int DFLT_THREAD_PRI = 10;
 
-    /** Default heartbeat messages issuing frequency (value is <tt>100ms</tt>). */
-    public static final long DFLT_HEARTBEAT_FREQ = 100;
+    /** Default heartbeat messages issuing frequency (value is <tt>2000ms</tt>). */
+    public static final long DFLT_HEARTBEAT_FREQ = 2000;
 
     /** Default size of topology snapshots history. */
     public static final int DFLT_TOP_HISTORY_SIZE = 1000;
 
-    /** Default socket operations timeout in milliseconds (value is <tt>200ms</tt>). */
-    public static final long DFLT_SOCK_TIMEOUT = 200;
+    /** Default socket operations timeout in milliseconds (value is <tt>5000ms</tt>). */
+    public static final long DFLT_SOCK_TIMEOUT = 5000;
 
-    /** Default timeout for receiving message acknowledgement in milliseconds (value is <tt>50ms</tt>). */
-    public static final long DFLT_ACK_TIMEOUT = 50;
+    /** Default timeout for receiving message acknowledgement in milliseconds (value is <tt>5000ms</tt>). */
+    public static final long DFLT_ACK_TIMEOUT = 5000;
 
-    /** Default socket operations timeout in milliseconds (value is <tt>700ms</tt>). */
-    public static final long DFLT_SOCK_TIMEOUT_CLIENT = 700;
+    /** Default socket operations timeout in milliseconds (value is <tt>5000ms</tt>). */
+    public static final long DFLT_SOCK_TIMEOUT_CLIENT = 5000;
 
-    /** Default timeout for receiving message acknowledgement in milliseconds (value is <tt>700ms</tt>). */
-    public static final long DFLT_ACK_TIMEOUT_CLIENT = 700;
+    /** Default timeout for receiving message acknowledgement in milliseconds (value is <tt>5000ms</tt>). */
+    public static final long DFLT_ACK_TIMEOUT_CLIENT = 5000;
 
     /** Default reconnect attempts count (value is <tt>10</tt>). */
     public static final int DFLT_RECONNECT_CNT = 10;


[18/50] incubator-ignite git commit: ignite-484-1 - relax test: 2 restarting nodes instead of 3

Posted by sb...@apache.org.
ignite-484-1 - relax test: 2 restarting nodes instead of 3


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

Branch: refs/heads/ignite-950
Commit: ed43dfe1c7e9b7db3f6ef33a38dad9b28c41190c
Parents: e602ca0
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 17 20:33:54 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 17 20:33:54 2015 +0300

----------------------------------------------------------------------
 .../near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ed43dfe1/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
index 3f23005..b868cfb 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
@@ -194,7 +194,7 @@ public class IgniteCacheClientQueryReplicatedNodeRestartSelfTest extends GridCom
     public void testRestarts() throws Exception {
         int duration = 90 * 1000;
         int qryThreadNum = 5;
-        int restartThreadsNum = 3; // 3 of 4 data nodes
+        int restartThreadsNum = 2; // 2 of 4 data nodes
         final int nodeLifeTime = 2 * 1000;
         final int logFreq = 10;
 


[09/50] incubator-ignite git commit: ignite-484-1 - get rid of owning future

Posted by sb...@apache.org.
ignite-484-1 - get rid of owning future


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

Branch: refs/heads/ignite-950
Commit: 68c35e734b3754460c4ad807e154ea94066600a0
Parents: 642f1c7
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 17 15:24:13 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 17 15:24:13 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtLocalPartition.java   | 19 -------------------
 1 file changed, 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/68c35e73/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 1392f5e..3a577a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -70,10 +70,6 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
     @GridToStringExclude
     private final GridFutureAdapter<?> rent;
 
-    /** Rent future. */
-    @GridToStringExclude
-    private final GridFutureAdapter<?> own;
-
     /** Entries map. */
     private final ConcurrentMap<KeyCacheObject, GridDhtCacheEntry> map;
 
@@ -118,12 +114,6 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
             }
         };
 
-        own = new GridFutureAdapter<Object>() {
-            @Override public String toString() {
-                return "PartitionOwnFuture [part=" + GridDhtLocalPartition.this + ", map=" + map + ']';
-            }
-        };
-
         map = new ConcurrentHashMap8<>(cctx.config().getStartSize() /
             cctx.affinity().partitions());
 
@@ -426,8 +416,6 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
                 // No need to keep history any more.
                 evictHist = null;
 
-                own.onDone();
-
                 return true;
             }
         }
@@ -462,13 +450,6 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
     }
 
     /**
-     * @return The future which will be completed when partition will have state {@link GridDhtPartitionState#OWNING}.
-     */
-    public IgniteInternalFuture<?> owningFuture() {
-        return own;
-    }
-
-    /**
      * @param updateSeq Update sequence.
      * @return Future for evict attempt.
      */


[17/50] incubator-ignite git commit: ignite-484-1 - error messages

Posted by sb...@apache.org.
ignite-484-1 - error messages


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

Branch: refs/heads/ignite-950
Commit: e602ca01e48fd43f4cc33b729078c105d84601f6
Parents: efb4244
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 17 20:15:45 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 17 20:15:45 2015 +0300

----------------------------------------------------------------------
 .../query/h2/twostep/GridMapQueryExecutor.java  |  4 +--
 .../h2/twostep/GridReduceQueryExecutor.java     | 31 ++++++++++----------
 2 files changed, 17 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e602ca01/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 2503a87..ba95d43 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -401,7 +401,7 @@ public class GridMapQueryExecutor {
                 }
             }
             catch (IgniteCheckedException e) {
-                throw new CacheException(e);
+                throw new CacheException("Failed to unmarshall parameters.", e);
             }
 
             List<String> caches = (List<String>)F.concat(true, req.space(), req.extraSpaces());
@@ -422,7 +422,7 @@ public class GridMapQueryExecutor {
             GridCacheContext<?,?> mainCctx = cacheContext(req.space());
 
             if (mainCctx == null)
-                throw new CacheException("Cache was destroyed: " + req.space());
+                throw new CacheException("Failed to find cache: " + req.space());
 
             qr = new QueryResults(req.requestId(), qrys.size(), mainCctx);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e602ca01/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 b956167..32d1c95 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
@@ -338,7 +338,7 @@ public class GridReduceQueryExecutor {
         Set<ClusterNode> nodes = new HashSet<>(dataNodes(space, topVer));
 
         if (F.isEmpty(nodes))
-            throw new CacheException("No data nodes found for cache: " + space);
+            throw new CacheException("Failed to find data nodes for cache: " + space);
 
         if (!F.isEmpty(extraSpaces)) {
             for (String extraSpace : extraSpaces) {
@@ -349,12 +349,12 @@ public class GridReduceQueryExecutor {
 
                 if (cctx.isReplicated() && !extraCctx.isReplicated())
                     throw new CacheException("Queries running on replicated cache should not contain JOINs " +
-                        "with partitioned tables.");
+                        "with partitioned tables [rCache=" + cctx.name() + ", pCache=" + extraSpace + "]");
 
                 Collection<ClusterNode> extraNodes = dataNodes(extraSpace, topVer);
 
                 if (F.isEmpty(extraNodes))
-                    throw new CacheException("No data nodes found for cache: " + extraSpace);
+                    throw new CacheException("Failed to find data nodes for cache: " + extraSpace);
 
                 if (cctx.isReplicated() && extraCctx.isReplicated()) {
                     nodes.retainAll(extraNodes);
@@ -363,8 +363,8 @@ public class GridReduceQueryExecutor {
                         if (isPreloadingActive(cctx, extraSpaces))
                             return null; // Retry.
                         else
-                            throw new CacheException("Caches '" + cctx.name() + "' and '" + extraSpace +
-                                "' have distinct set of data nodes.");
+                            throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
+                                ", cache2=" + extraSpace + "]");
                     }
                 }
                 else if (!cctx.isReplicated() && extraCctx.isReplicated()) {
@@ -372,16 +372,16 @@ public class GridReduceQueryExecutor {
                         if (isPreloadingActive(cctx, extraSpaces))
                             return null; // Retry.
                         else
-                            throw new CacheException("Caches '" + cctx.name() + "' and '" + extraSpace +
-                                "' have distinct set of data nodes.");
+                            throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
+                                ", cache2=" + extraSpace + "]");
                 }
                 else if (!cctx.isReplicated() && !extraCctx.isReplicated()) {
                     if (extraNodes.size() != nodes.size() || !nodes.containsAll(extraNodes))
                         if (isPreloadingActive(cctx, extraSpaces))
                             return null; // Retry.
                         else
-                            throw new CacheException("Caches '" + cctx.name() + "' and '" + extraSpace +
-                                "' have distinct set of data nodes.");
+                            throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
+                                ", cache2=" + extraSpace + "]");
                 }
                 else
                     throw new IllegalStateException();
@@ -586,7 +586,7 @@ public class GridReduceQueryExecutor {
 
                 if (!extraCctx.isReplicated())
                     throw new CacheException("Queries running on replicated cache should not contain JOINs " +
-                        "with partitioned tables.");
+                        "with tables in partitioned caches [rCache=" + cctx.name() + ", pCache=" + extraSpace + "]");
 
                 Set<ClusterNode> extraOwners = replicatedUnstableDataNodes(extraCctx);
 
@@ -628,7 +628,7 @@ public class GridReduceQueryExecutor {
         Set<ClusterNode> dataNodes = new HashSet<>(dataNodes(space, NONE));
 
         if (dataNodes.isEmpty())
-            throw new CacheException("No data nodes found for cache '" + space + "'");
+            throw new CacheException("Failed to find data nodes for cache: " + space);
 
         // Find all the nodes owning all the partitions for replicated cache.
         for (int p = 0, parts = cctx.affinity().partitions(); p < parts; p++) {
@@ -670,8 +670,8 @@ public class GridReduceQueryExecutor {
                 int parts = extraCctx.affinity().partitions();
 
                 if (parts != partsCnt)
-                    throw new CacheException("Number of partitions must be the same for correct collocation in " +
-                        "caches " + cctx.name() + " and " + extraSpace + ".");
+                    throw new CacheException("Number of partitions must be the same for correct collocation [cache1=" +
+                        cctx.name() + ", parts1=" + partsCnt + ", cache2=" + extraSpace + ", parts2=" + parts + "]");
             }
         }
 
@@ -685,7 +685,7 @@ public class GridReduceQueryExecutor {
                 if (!F.isEmpty(dataNodes(cctx.name(), NONE)))
                     return null; // Retry.
 
-                throw new CacheException("No data nodes found for cache '" + cctx.name() + "' for partition " + p);
+                throw new CacheException("Failed to find data nodes [cache=" + cctx.name() + ", part=" + p + "]");
             }
 
             partLocs[p] = new HashSet<>(owners);
@@ -707,8 +707,7 @@ public class GridReduceQueryExecutor {
                         if (!F.isEmpty(dataNodes(extraSpace, NONE)))
                             return null; // Retry.
 
-                        throw new CacheException("No data nodes found for cache '" + extraSpace +
-                            "' for partition " + p);
+                        throw new CacheException("Failed to find data nodes [cache=" + extraSpace + ", part=" + p + "]");
                     }
 
                     if (partLocs[p] == null)


[45/50] incubator-ignite git commit: ignite-950: handles support in the footer

Posted by sb...@apache.org.
ignite-950: handles support in the footer


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

Branch: refs/heads/ignite-950
Commit: 41a821f2e910f183c0bcacde8f65f9b91d7a3efd
Parents: 5bd8666
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jun 19 12:19:15 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Jun 19 12:19:15 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/GridHandleTable.java   | 112 ++++++++++++++-----
 .../optimized/OptimizedObjectOutputStream.java  |  44 +++++---
 .../optimized/ext/OptimizedMarshallerExt.java   |  12 +-
 .../ext/OptimizedObjectInputStreamExt.java      |  54 +++++----
 .../ext/OptimizedObjectOutputStreamExt.java     |  46 +++++---
 .../ext/OptimizedMarshallerExtSelfTest.java     |  57 ++++++++++
 6 files changed, 233 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/41a821f2/modules/core/src/main/java/org/apache/ignite/internal/util/GridHandleTable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridHandleTable.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridHandleTable.java
index 6b63360..639a5c1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridHandleTable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridHandleTable.java
@@ -47,11 +47,8 @@ public class GridHandleTable {
     /** Maps handle value -> next candidate handle value. */
     private int[] next;
 
-    /** Handle absolute position in the output stream. */
-    private int[] positions;
-
     /** Maps handle value -> associated object. */
-    private Object[] objs;
+    private ObjectInfo[] objs;
 
     /** */
     private int[] spineEmpty;
@@ -70,8 +67,7 @@ public class GridHandleTable {
 
         spine = new int[initCap];
         next = new int[initCap];
-        objs = new Object[initCap];
-        positions = new int[initCap];
+        objs = new ObjectInfo[initCap];
         spineEmpty = new int[initCap];
         nextEmpty = new int[initCap];
 
@@ -96,7 +92,7 @@ public class GridHandleTable {
 
         if (size > 0) {
             for (int i = spine[idx]; i >= 0; i = next[i])
-                if (objs[i] == obj)
+                if (objs[i].object == obj)
                     return i;
         }
 
@@ -106,7 +102,7 @@ public class GridHandleTable {
         if (size >= threshold)
             growSpine();
 
-        insert(obj, size, idx, pos);
+        insert(new ObjectInfo(obj, pos), size, idx);
 
         size++;
 
@@ -114,13 +110,31 @@ public class GridHandleTable {
     }
 
     /**
-     * Returns handle absolute position in output stream.
+     * Keeps object's total len in bytes.
+     *
+     * @param obj Object.
+     * @param len Object's length.
+     */
+    public void objectLength(Object obj, int len) {
+        int idx = hash(obj) % spine.length;
+
+        if (size > 0) {
+            for (int i = spine[idx]; i >= 0; i = next[i])
+                if (objs[i].object == obj) {
+                    objs[i].len = len;
+                    return;
+                }
+        }
+    }
+
+    /**
+     * Returns object info for given handle.
      *
      * @param handle Handle.
-     * @return Absolute position.
+     * @return Object info.
      */
-    public int position(int handle) {
-        return positions[handle];
+    public ObjectInfo objectInfo(int handle) {
+        return objs[handle];
     }
 
     /**
@@ -131,7 +145,6 @@ public class GridHandleTable {
         UNSAFE.copyMemory(nextEmpty, intArrOff, next, intArrOff, nextEmpty.length << 2);
 
         Arrays.fill(objs, null);
-        Arrays.fill(positions, 0);
 
         size = 0;
     }
@@ -140,22 +153,25 @@ public class GridHandleTable {
      * @return Returns objects that were added to handles table.
      */
     public Object[] objects() {
-        return objs;
+        Object[] objects = new Object[objs.length];
+
+        for (int i = 0; i < objs.length; i++)
+            objects[i] = objs[i];
+
+        return objects;
     }
 
     /**
      * Inserts mapping object -> handle mapping into table. Assumes table
      * is large enough to accommodate new mapping.
      *
-     * @param obj Object.
+     * @param obj Object info.
      * @param handle Handle.
      * @param idx Index.
-     * @param pos Position in output stream.
      */
-    private void insert(Object obj, int handle, int idx, int pos) {
+    private void insert(ObjectInfo obj, int handle, int idx) {
         objs[handle] = obj;
         next[handle] = spine[idx];
-        positions[handle] = pos;
         spine[idx] = handle;
     }
 
@@ -175,11 +191,11 @@ public class GridHandleTable {
         UNSAFE.copyMemory(spineEmpty, intArrOff, spine, intArrOff, spineEmpty.length << 2);
 
         for (int i = 0; i < this.size; i++) {
-            Object obj = objs[i];
+            Object obj = objs[i].object;
 
             int idx = hash(obj) % spine.length;
 
-            insert(objs[i], i, idx, positions[i]);
+            insert(objs[i], i, idx);
         }
     }
 
@@ -197,17 +213,11 @@ public class GridHandleTable {
 
         Arrays.fill(nextEmpty, -1);
 
-        Object[] newObjs = new Object[newLen];
+        ObjectInfo[] newObjs = new ObjectInfo[newLen];
 
         System.arraycopy(objs, 0, newObjs, 0, size);
 
         objs = newObjs;
-
-        int[] newPositions = new int[newLen];
-
-        UNSAFE.copyMemory(positions, intArrOff, newPositions, intArrOff, size << 2);
-
-        positions = newPositions;
     }
 
     /**
@@ -219,4 +229,52 @@ public class GridHandleTable {
     private int hash(Object obj) {
         return System.identityHashCode(obj) & 0x7FFFFFFF;
     }
+
+    /**
+     *
+     */
+    public static class ObjectInfo {
+        /** */
+        private Object object;
+
+        /** Object position in output stream. */
+        private int pos;
+
+        /** Object length. */
+        private int len;
+
+        /**
+         * Constructor.
+         *
+         * @param object Object.
+         * @param pos Object position in output stream.
+         */
+        public ObjectInfo(Object object, int pos) {
+            this.object = object;
+            this.pos = pos;
+        }
+
+        /**
+         * Gets object position in output stream.
+         *
+         * @return Position.
+         */
+        public int position() {
+            return pos;
+        }
+
+        /**
+         * Gets object length.
+         *
+         * @return Length in bytes.
+         */
+        public int length() {
+            return len;
+        }
+    }
+
+
+
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/41a821f2/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
index 90e2a85..17a29f0 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
@@ -154,15 +154,16 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
      * @param obj Object.
      * @throws IOException In case of error.
      *
-     * @return Handle's position in {@link #out} or -1 if the {@code obj} has not been written before.
+     * @return Instance of {@link org.apache.ignite.internal.util.GridHandleTable.ObjectInfo} if handle to an existed
+     * object is written or {@code null} otherwise.
      */
-    private int writeObject0(Object obj) throws IOException {
+    private GridHandleTable.ObjectInfo writeObject0(Object obj) throws IOException {
         curObj = null;
         curFields = null;
         curPut = null;
         curFooter = null;
 
-        int handle = -1;
+        GridHandleTable.ObjectInfo objInfo = null;
 
         if (obj == null)
             writeByte(NULL);
@@ -192,7 +193,7 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
                 if (desc.excluded()) {
                     writeByte(NULL);
 
-                    return handle;
+                    return objInfo;
                 }
 
                 Object obj0 = desc.replace(obj);
@@ -200,9 +201,11 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
                 if (obj0 == null) {
                     writeByte(NULL);
 
-                    return handle;
+                    return objInfo;
                 }
 
+                int handle = -1;
+
                 if (!desc.isPrimitive() && !desc.isEnum() && !desc.isClass())
                     handle = handles.lookup(obj, out.offset());
 
@@ -219,14 +222,19 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
                     writeByte(HANDLE);
                     writeInt(handle);
 
-                    handle = handles.position(handle);
+                    objInfo = handles.objectInfo(handle);
                 }
-                else
+                else {
+                    int pos = out.offset();
+
                     desc.write(this, obj);
+
+                    handles.objectLength(obj, out.offset() - pos);
+                }
             }
         }
 
-        return handle;
+        return objInfo;
     }
 
     /**
@@ -546,10 +554,12 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
 
                 case OTHER:
                     if (t.field() != null) {
-                        int handle = writeObject0(getObject(obj, t.offset()));
+                        GridHandleTable.ObjectInfo objInfo = writeObject0(getObject(obj, t.offset()));
 
-                        if (footer != null && handle >= 0)
-                            footer.putHandle(t.id(), handle);
+                        if (footer != null && objInfo != null) {
+                            footer.putHandle(t.id(), objInfo);
+                            continue;
+                        }
                     }
             }
 
@@ -806,10 +816,12 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
                     break;
 
                 case OTHER:
-                    int handle = writeObject0(t.get2());
+                    GridHandleTable.ObjectInfo objInfo = writeObject0(t.get2());
 
-                    if (footer != null && handle >= 0)
-                        footer.putHandle(t.get1().id(), handle);
+                    if (footer != null && objInfo != null) {
+                        footer.putHandle(t.get1().id(), objInfo);
+                        continue;
+                    }
             }
 
             if (footer != null) {
@@ -990,9 +1002,9 @@ public class OptimizedObjectOutputStream extends ObjectOutputStream {
          * Puts handle ID for the given field ID.
          *
          * @param fieldId Field ID.
-         * @param handlePos Handle position in output stream.
+         * @param objInfo Object's, referred by handle, info.
          */
-        void putHandle(int fieldId, int handlePos);
+        void putHandle(int fieldId, GridHandleTable.ObjectInfo objInfo);
 
         /**
          * Writes footer content to the OutputStream.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/41a821f2/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
index a41a331..45506f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExt.java
@@ -35,13 +35,19 @@ public class OptimizedMarshallerExt extends OptimizedMarshaller {
     static final byte EMPTY_FOOTER = -1;
 
     /** */
-    static final byte FOOTER_LEN_OFF = 4;
+    static final byte FOOTER_LEN_OFF = 2;
 
     /** */
-    static final byte VARIABLE_LEN = -1;
+    static final int FOOTER_BODY_LEN_MASK = 0x3FFFFFFF;
+
+    /** */
+    static final int FOOTER_BODY_IS_HANDLE_MASK = 0x40000000;
 
     /** */
-    static final byte NOT_A_HANDLE = -1;
+    static final byte FOOTER_BODY_HANDLE_MASK_BIT = 30;
+
+    /** */
+    static final byte VARIABLE_LEN = -1;
 
     /** */
     private OptimizedMarshallerExtMetaHandler metaHandler;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/41a821f2/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
index 7c8cc3c..a25dafc 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectInputStreamExt.java
@@ -16,7 +16,6 @@
  */
 package org.apache.ignite.marshaller.optimized.ext;
 
-import org.apache.ignite.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.io.*;
 import org.apache.ignite.marshaller.*;
@@ -57,10 +56,10 @@ public class OptimizedObjectInputStreamExt extends OptimizedObjectInputStream {
     /** {@inheritDoc} */
     @Override protected void skipFooter(Class<?> cls) throws IOException {
         if (metaHandler.metadata(resolveTypeId(cls.getName(), mapper)) != null) {
-            int footerLen = in.readInt();
+            short footerLen = in.readShort();
 
             if (footerLen != EMPTY_FOOTER)
-                in.skipBytes(footerLen - 4);
+                in.skipBytes(footerLen - 2);
         }
     }
 
@@ -113,7 +112,7 @@ public class OptimizedObjectInputStreamExt extends OptimizedObjectInputStream {
 
         F field = null;
 
-        if (range != null && range.start > 0) {
+        if (range != null && range.start >= 0) {
             in.position(range.start);
 
             if (in.readByte() == SERIALIZABLE && metaHandler.metadata(in.readInt()) != null)
@@ -163,50 +162,49 @@ public class OptimizedObjectInputStreamExt extends OptimizedObjectInputStream {
 
         in.position(end - FOOTER_LEN_OFF);
 
-        int footerLen = in.readInt();
+        short footerLen = in.readShort();
 
         if (footerLen == EMPTY_FOOTER)
             return null;
 
-        // reading 'hasHandles' flag. 1 byte - additional offset to get to the flag position.
-        in.position(in.position() - FOOTER_LEN_OFF - 1);
-
-        boolean hasHandles = in.readBoolean();
-
-        // 4 - skipping length at the beginning
-        int footerOff = (end - footerLen) + 4;
+        // +2 - skipping length at the beginning
+        int footerOff = (end - footerLen) + 2;
         in.position(footerOff);
 
         int fieldOff = 0;
 
         for (OptimizedObjectMetadata.FieldInfo info : meta.getMeta()) {
-            if (info.id == fieldId) {
-                int len = info.len == VARIABLE_LEN ? in.readInt() : info.len;
-                int handlePos;
+            int len;
+            boolean isHandle;
 
-                if (hasHandles && info.len == VARIABLE_LEN)
-                    handlePos = in.readInt();
-                else
-                    handlePos = NOT_A_HANDLE;
+            if (info.len == VARIABLE_LEN) {
+                int fieldInfo = in.readInt();
+
+                len = fieldInfo & FOOTER_BODY_LEN_MASK;
+                isHandle = ((fieldInfo & FOOTER_BODY_IS_HANDLE_MASK) >> FOOTER_BODY_HANDLE_MASK_BIT) == 1;
+            }
+            else {
+                len = info.len;
+                isHandle = false;
+            }
 
-                if (handlePos == NOT_A_HANDLE) {
+            if (info.id == fieldId) {
+                if (!isHandle) {
                     //object header len: 1 - for type, 4 - for type ID, 2 - for checksum.
                     fieldOff += 1 + 4 + clsNameLen + 2;
 
                     return new FieldRange(start + fieldOff, len);
                 }
-                else {
-                    throw new IgniteException("UNSUPPORTED YET");
-                }
+                else
+                    return new FieldRange(in.readInt(), in.readInt());
             }
             else {
-                fieldOff += info.len == VARIABLE_LEN ? in.readInt() : info.len;
+                fieldOff += len;
 
-                if (hasHandles) {
-                    in.skipBytes(4);
-                    fieldOff += 4;
+                if (isHandle) {
+                    in.skipBytes(8);
+                    fieldOff += 8;
                 }
-
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/41a821f2/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectOutputStreamExt.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectOutputStreamExt.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectOutputStreamExt.java
index 4ef0d4a..02783a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectOutputStreamExt.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/ext/OptimizedObjectOutputStreamExt.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.marshaller.optimized.ext;
 
+import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.io.*;
 import org.apache.ignite.marshaller.*;
 import org.apache.ignite.marshaller.optimized.*;
@@ -78,7 +79,7 @@ public class OptimizedObjectOutputStreamExt extends OptimizedObjectOutputStream
         private ArrayList<Integer> fields;
 
         /** */
-        private HashMap<Integer, Integer> handles;
+        private HashMap<Integer, GridHandleTable.ObjectInfo> handles;
 
         /** */
         private boolean hasHandles;
@@ -105,7 +106,7 @@ public class OptimizedObjectOutputStreamExt extends OptimizedObjectOutputStream
         }
 
         /** {@inheritDoc} */
-        @Override public void putHandle(int fieldId, int handlePos) {
+        @Override public void putHandle(int fieldId, GridHandleTable.ObjectInfo objInfo) {
             if (data == null)
                 return;
 
@@ -114,7 +115,7 @@ public class OptimizedObjectOutputStreamExt extends OptimizedObjectOutputStream
                 handles = new HashMap<>();
             }
 
-            handles.put(fieldId, handlePos);
+            handles.put(fieldId, objInfo);
 
             // length of handle fields is 5 bytes.
             put(fieldId, OptimizedFieldType.OTHER, 5);
@@ -125,31 +126,40 @@ public class OptimizedObjectOutputStreamExt extends OptimizedObjectOutputStream
             if (data == null)
                 writeInt(EMPTY_FOOTER);
             else {
-                //9 - 4 bytes for len at the beginning, 4 bytes for len at the end, 1 byte for 'hasHandles' flag
-                int footerLen = data.size() * 4 + 9;
+                int bodyEnd = out.offset();
+
+                // +4 - 2 bytes for footer len at the beginning, 2 bytes for footer len at the end.
+                short footerLen = (short)(data.size() * 4 + 4);
 
                 if (hasHandles)
-                    footerLen += data.size() * 4;
+                    footerLen += handles.size() * 8;
 
-                writeInt(footerLen);
+                writeShort(footerLen);
 
                 if (hasHandles) {
                     for (int i = 0; i < data.size(); i++) {
-                        writeInt(data.get(i));
-
-                        Integer handlePos = handles.get(fields.get(i));
-
-                        writeInt(handlePos == null ? NOT_A_HANDLE : handlePos);
+                        GridHandleTable.ObjectInfo objInfo = handles.get(fields.get(i));
+
+                        if (objInfo == null)
+                            writeInt(data.get(i) & ~FOOTER_BODY_IS_HANDLE_MASK);
+                        else {
+                            writeInt(data.get(i) | FOOTER_BODY_IS_HANDLE_MASK);
+                            writeInt(objInfo.position());
+
+                            if (objInfo.length() == 0)
+                                // field refers to its own object that hasn't set total length yet.
+                                writeInt((bodyEnd - objInfo.position()) + footerLen);
+                            else
+                                writeInt(objInfo.length());
+                        }
                     }
                 }
-                else {
+                else
                     for (int fieldLen : data)
-                        writeInt(fieldLen);
-                }
-
-                writeBoolean(hasHandles);
+                        // writing field len and resetting is handle mask
+                        writeInt(fieldLen & ~FOOTER_BODY_IS_HANDLE_MASK);
 
-                writeInt(footerLen);
+                writeShort(footerLen);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/41a821f2/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExtSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExtSelfTest.java b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExtSelfTest.java
index 9887b0b..2526de7 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExtSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/ext/OptimizedMarshallerExtSelfTest.java
@@ -88,6 +88,34 @@ public class OptimizedMarshallerExtSelfTest extends OptimizedMarshallerSelfTest
         assertEquals(testObj.o2.i, (int)marsh.readField("i", arr, 0, arr.length, null));
     }
 
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testHandles() throws Exception {
+        OptimizedMarshallerExt marsh = (OptimizedMarshallerExt)OptimizedMarshallerExtSelfTest.marsh;
+
+        assertTrue(marsh.enableFieldsIndexing(SelfLinkObject.class));
+
+        SelfLinkObject selfLinkObject = new SelfLinkObject();
+        selfLinkObject.str1 = "Hello, world!";
+        selfLinkObject.str2 = selfLinkObject.str1;
+        selfLinkObject.link = selfLinkObject;
+
+        byte[] arr = marsh.marshal(selfLinkObject);
+
+        String str2 = marsh.readField("str2", arr, 0, arr.length, null);
+
+        assertEquals(selfLinkObject.str1, str2);
+
+        CacheOptimizedObjectImpl cacheObj = marsh.readField("link", arr, 0, arr.length, null);
+
+        arr = cacheObj.valueBytes(null);
+
+        SelfLinkObject selfLinkObject2 = marsh.unmarshal(arr, null);
+
+        assertEquals(selfLinkObject, selfLinkObject2);
+    }
+
     /** */
     private static class TestObject2 {
         /** */
@@ -123,6 +151,9 @@ public class OptimizedMarshallerExtSelfTest extends OptimizedMarshallerSelfTest
         /** The only meaningful field in the class, used for {@link #equals(Object o)} and {@link #hashCode()}. */
         private final String str;
 
+        /** */
+        private TestObject t2;
+
         /**
          * @param str String to hold.
          * @param i Integer.
@@ -174,4 +205,30 @@ public class OptimizedMarshallerExtSelfTest extends OptimizedMarshallerSelfTest
             return true;
         }
     }
+
+    /**
+     *
+     */
+    private static class SelfLinkObject {
+        /** */
+        String str1;
+
+        /** */
+        String str2;
+
+        /** */
+        SelfLinkObject link;
+
+        @Override public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            SelfLinkObject that = (SelfLinkObject)o;
+
+            if (str1 != null ? !str1.equals(that.str1) : that.str1 != null) return false;
+            if (str2 != null ? !str2.equals(that.str2) : that.str2 != null) return false;
+
+            return true;
+        }
+    }
 }


[24/50] incubator-ignite git commit: # ignite-sprint-6 fixed test to work in offheap mode

Posted by sb...@apache.org.
# ignite-sprint-6 fixed test to work in offheap mode


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

Branch: refs/heads/ignite-950
Commit: cc20ef6adce9bdeea19d37f5817c0693e380cfa5
Parents: de53189
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jun 18 10:30:20 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jun 18 10:30:20 2015 +0300

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


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc20ef6a/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 128d452..151c249 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
@@ -1020,25 +1020,27 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
+        final String key = primaryKeysForCache(cache, 1).get(0);
+
         Transaction tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, READ_COMMITTED) : null;
 
         try {
             if (startVal)
-                cache.put("key", 2);
+                cache.put(key, 2);
             else
-                assertEquals(null, cache.get("key"));
+                assertEquals(null, cache.get(key));
 
-            Integer expectedRes = startVal ? 2 : null;
+            Integer expRes = startVal ? 2 : null;
 
-            assertEquals(String.valueOf(expectedRes), cache.invoke("key", INCR_PROCESSOR));
+            assertEquals(String.valueOf(expRes), cache.invoke(key, INCR_PROCESSOR));
 
-            expectedRes = startVal ? 3 : 1;
+            expRes = startVal ? 3 : 1;
 
-            assertEquals(String.valueOf(expectedRes), cache.invoke("key", INCR_PROCESSOR));
+            assertEquals(String.valueOf(expRes), cache.invoke(key, INCR_PROCESSOR));
 
-            expectedRes++;
+            expRes++;
 
-            assertEquals(String.valueOf(expectedRes), cache.invoke("key", INCR_PROCESSOR));
+            assertEquals(String.valueOf(expRes), cache.invoke(key, INCR_PROCESSOR));
 
             if (tx != null)
                 tx.commit();
@@ -1050,11 +1052,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         Integer exp = (startVal ? 2 : 0) + 3;
 
-        assertEquals(exp, cache.get("key"));
+        assertEquals(exp, cache.get(key));
 
         for (int i = 0; i < gridCount(); i++) {
-            if (ignite(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), "key"))
-                assertEquals(exp, peek(jcache(i), "key"));
+            if (ignite(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key))
+                assertEquals(exp, peek(jcache(i), key));
         }
     }
 


[38/50] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-1003' into ignite-sprint-6

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1003' into ignite-sprint-6


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

Branch: refs/heads/ignite-950
Commit: 4d1fa7235c1381bacaaeaf458658675d2ba34923
Parents: 31cf802 b23f930
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jun 18 15:15:49 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jun 18 15:15:49 2015 +0300

----------------------------------------------------------------------
 .../communication/tcp/TcpCommunicationSpi.java  | 38 ++++++++++----------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 21 +++++++----
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  9 ++++-
 .../tcp/internal/TcpDiscoveryNode.java          | 18 ++++++++++
 4 files changed, 60 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d1fa723/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d1fa723/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d1fa723/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------


[23/50] incubator-ignite git commit: Merge branches 'ignite-484-1' and 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-sprint-6

Posted by sb...@apache.org.
Merge branches 'ignite-484-1' and 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-sprint-6


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

Branch: refs/heads/ignite-950
Commit: de53189605c859a6eb9aa09c8181d5720c5dc28b
Parents: 4cc376b eebf9c1
Author: S.Vladykin <sv...@gridgain.com>
Authored: Thu Jun 18 09:51:50 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Thu Jun 18 09:51:50 2015 +0300

----------------------------------------------------------------------
 .../affinity/AffinityTopologyVersion.java       |   7 -
 .../distributed/dht/GridDhtLocalPartition.java  |  56 +-
 .../dht/GridDhtPartitionsReservation.java       | 292 +++++++++
 .../cache/distributed/dht/GridReservable.java   |  35 +
 .../dht/preloader/GridDhtPartitionMap.java      |  26 +-
 .../cache/query/GridCacheQueryManager.java      |  33 -
 .../cache/query/GridCacheTwoStepQuery.java      |  22 +-
 .../processors/query/GridQueryIndexing.java     |  14 +-
 .../processors/query/GridQueryProcessor.java    |  14 +-
 .../messages/GridQueryNextPageResponse.java     |  34 +-
 .../h2/twostep/messages/GridQueryRequest.java   | 111 +++-
 .../apache/ignite/internal/util/GridDebug.java  |  19 +
 .../processors/query/h2/IgniteH2Indexing.java   |  79 ++-
 .../query/h2/sql/GridSqlQuerySplitter.java      |  49 +-
 .../query/h2/twostep/GridMapQueryExecutor.java  | 332 +++++++---
 .../query/h2/twostep/GridMergeIndex.java        |  17 +-
 .../h2/twostep/GridMergeIndexUnsorted.java      |   7 +-
 .../h2/twostep/GridReduceQueryExecutor.java     | 650 ++++++++++++++++---
 .../query/h2/twostep/GridResultPage.java        |  21 +-
 .../cache/GridCacheCrossCacheQuerySelfTest.java |   3 +-
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |   1 -
 ...lientQueryReplicatedNodeRestartSelfTest.java | 419 ++++++++++++
 .../IgniteCacheQueryNodeRestartSelfTest.java    |  36 +-
 .../IgniteCacheQueryNodeRestartSelfTest2.java   | 383 +++++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 25 files changed, 2380 insertions(+), 282 deletions(-)
----------------------------------------------------------------------