You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/08/14 10:30:49 UTC

[39/50] ignite git commit: Send fixes.

Send fixes.


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

Branch: refs/heads/ignite-5991-6019
Commit: 4238e24d253c9d8dd9de9d37954546674bb20f89
Parents: 5930e40
Author: devozerov <vo...@gridgain.com>
Authored: Mon Aug 14 11:49:55 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Aug 14 11:49:55 2017 +0300

----------------------------------------------------------------------
 .../ignite/examples/datagrid/TestExample.java   |  7 +++--
 .../query/h2/twostep/GridMapQueryExecutor.java  | 10 +++---
 .../query/h2/twostep/MapQueryResults.java       | 32 +++++++++++---------
 3 files changed, 25 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4238e24d/examples/src/main/java/org/apache/ignite/examples/datagrid/TestExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/TestExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/TestExample.java
index 0faacbb..b22549e 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/TestExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/TestExample.java
@@ -18,12 +18,13 @@ public class TestExample {
             IgniteCache<Long, Person> srvCache = srv.createCache(
                 new CacheConfiguration<Long, Person>().setName(CACHE_NAME).setIndexedTypes(Long.class, Person.class));
 
-            for (long i = 0; i < 1_000; i++)
+            for (long i = 0; i < 2_000; i++)
                 srvCache.put(i, new Person(i, "First" + i, "Last" + i));
 
             System.out.println("PUT FINISHED");
 
-            try (Ignite cli = Ignition.start(new IgniteConfiguration().setIgniteInstanceName("client").setLocalHost("127.0.0.1").setClientMode(true))) {
+            try (Ignite cli = Ignition.start(new IgniteConfiguration()
+                .setIgniteInstanceName("client").setLocalHost("127.0.0.1").setClientMode(true))) {
                 System.out.println("CLIENT STARTED");
 
                 IgniteCache<Long, Person> cliCache = cli.cache(CACHE_NAME);
@@ -41,7 +42,7 @@ public class TestExample {
                 System.out.println("DONE: " + cnt);
             }
             catch (Exception e) {
-                System.out.println(e);
+                System.out.println(e.toString());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/4238e24d/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 488e408..1ab1208 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
@@ -585,7 +585,8 @@ public class GridMapQueryExecutor {
                 }
             }
 
-            qr = new MapQueryResults(h2, node.id(), reqId, qrys.size(), mainCctx != null ? mainCctx.name() : null);
+            qr = new MapQueryResults(h2, reqId, qrys.size(), mainCctx != null ? mainCctx.name() : null,
+                MapQueryLazyWorker.currentWorker());
 
             if (nodeRess.put(reqId, segmentId, qr) != null)
                 throw new IllegalStateException();
@@ -655,7 +656,7 @@ public class GridMapQueryExecutor {
                         assert rs instanceof JdbcResultSet : rs.getClass();
                     }
 
-                    qr.addResult(qryIdx, qry, node.id(), rs, params, MapQueryLazyWorker.currentWorker());
+                    qr.addResult(qryIdx, qry, node.id(), rs, params);
 
                     if (qr.cancelled()) {
                         qr.result(qryIdx).close();
@@ -755,10 +756,7 @@ public class GridMapQueryExecutor {
         else if (qr.cancelled())
             sendError(node, req.queryRequestId(), new QueryCancelledException());
         else {
-            MapQueryLazyWorkerKey lazyWorkerKey =
-                new MapQueryLazyWorkerKey(node.id(), req.queryRequestId(), req.segmentId());
-
-            MapQueryLazyWorker lazyWorker = lazyWorkers.get(lazyWorkerKey);
+            MapQueryLazyWorker lazyWorker = qr.lazyWorker();
 
             if (lazyWorker != null) {
                 lazyWorker.submit(new Runnable() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/4238e24d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResults.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResults.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResults.java
index fb1d6c7..a714a86 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResults.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResults.java
@@ -33,9 +33,6 @@ class MapQueryResults {
     /** H@ indexing. */
     private final IgniteH2Indexing h2;
 
-    /** Node ID. */
-    private final UUID nodeId;
-
     /** */
     private final long qryReqId;
 
@@ -48,20 +45,27 @@ class MapQueryResults {
     /** */
     private final String cacheName;
 
+    /** Lazy worker. */
+    private final MapQueryLazyWorker lazyWorker;
+
     /** */
     private volatile boolean cancelled;
 
     /**
+     * Constructor.
+     *
      * @param qryReqId Query request ID.
      * @param qrys Number of queries.
      * @param cacheName Cache name.
+     * @param lazyWorker Lazy worker (if any).
      */
     @SuppressWarnings("unchecked")
-    MapQueryResults(IgniteH2Indexing h2, UUID nodeId, long qryReqId, int qrys, @Nullable String cacheName) {
+    MapQueryResults(IgniteH2Indexing h2, long qryReqId, int qrys, @Nullable String cacheName,
+        @Nullable MapQueryLazyWorker lazyWorker) {
         this.h2 = h2;
-        this.nodeId = nodeId;
         this.qryReqId = qryReqId;
         this.cacheName = cacheName;
+        this.lazyWorker = lazyWorker;
 
         results = new AtomicReferenceArray<>(qrys);
         cancels = new GridQueryCancel[qrys];
@@ -71,13 +75,6 @@ class MapQueryResults {
     }
 
     /**
-     * @return Node ID.
-     */
-    UUID nodeId() {
-        return nodeId;
-    }
-
-    /**
      * @param qry Query result index.
      * @return Query result.
      */
@@ -96,16 +93,21 @@ class MapQueryResults {
     }
 
     /**
+     * @return Lazy worker.
+     */
+    MapQueryLazyWorker lazyWorker() {
+        return lazyWorker;
+    }
+
+    /**
      * Add result.
      *
      * @param qry Query result index.
      * @param q Query object.
      * @param qrySrcNodeId Query source node.
      * @param rs Result set.
-     * @param lazyWorker Lazy worker.
      */
-    void addResult(int qry, GridCacheSqlQuery q, UUID qrySrcNodeId, ResultSet rs, Object[] params,
-        @Nullable MapQueryLazyWorker lazyWorker) {
+    void addResult(int qry, GridCacheSqlQuery q, UUID qrySrcNodeId, ResultSet rs, Object[] params) {
         MapQueryResult res = new MapQueryResult(h2, rs, cacheName, qrySrcNodeId, q, params, lazyWorker);
 
         if (!results.compareAndSet(qry, null, res))