ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [07/50] [abbrv] incubator-ignite git commit: ignite-gg-10002 - removed unneeded marshalling-unmarshalling for local node
Date Fri, 03 Apr 2015 22:45:59 GMT
ignite-gg-10002 - removed unneeded marshalling-unmarshalling for local node


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

Branch: refs/heads/ignite-674
Commit: f8d5d4457dae69966d94d5e43ba030d6ef97b435
Parents: e78ce56
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Wed Apr 1 18:15:11 2015 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Wed Apr 1 18:15:11 2015 +0300

----------------------------------------------------------------------
 .../messages/GridQueryNextPageResponse.java     | 32 ++++++++------------
 .../query/h2/twostep/GridMapQueryExecutor.java  |  6 ++--
 .../query/h2/twostep/GridResultPage.java        |  9 +++++-
 3 files changed, 25 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f8d5d445/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
index e798051..22f9cb4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
@@ -26,7 +26,7 @@ import java.nio.*;
 /**
  * Next page response.
  */
-public class GridQueryNextPageResponse implements Externalizable, Message {
+public class GridQueryNextPageResponse implements Message {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -45,6 +45,9 @@ public class GridQueryNextPageResponse implements Externalizable, Message
{
     /** */
     private byte[] rows;
 
+    /** */
+    private transient Object plainRows;
+
     /**
      * For {@link Externalizable}.
      */
@@ -58,16 +61,18 @@ public class GridQueryNextPageResponse implements Externalizable, Message
{
      * @param page Page.
      * @param allRows All rows count.
      * @param rows Rows.
+     * @param plainRows Not marshalled rows for local node.
      */
     public GridQueryNextPageResponse(long qryReqId, int qry, int page, int allRows,
-        byte[] rows) {
-        assert rows != null;
+        byte[] rows, Object plainRows) {
+        assert rows != null ^ plainRows != null;
 
         this.qryReqId = qryReqId;
         this.qry = qry;
         this.page = page;
         this.allRows = allRows;
         this.rows = rows;
+        this.plainRows = plainRows;
     }
 
     /**
@@ -105,22 +110,11 @@ public class GridQueryNextPageResponse implements Externalizable, Message
{
         return rows;
     }
 
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeLong(qryReqId);
-        out.writeInt(qry);
-        out.writeInt(page);
-        out.writeInt(allRows);
-        U.writeByteArray(out, rows);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-        qryReqId = in.readLong();
-        qry = in.readInt();
-        page = in.readInt();
-        allRows = in.readInt();
-        rows = U.readByteArray(in);
+    /**
+     * @return Plain rows.
+     */
+    public Object plainRows() {
+        return plainRows;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f8d5d445/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 2f54943..a0718e5 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
@@ -309,10 +309,12 @@ public class GridMapQueryExecutor implements GridMessageListener {
         }
 
         try {
+            boolean loc = node.isLocal();
+
             GridQueryNextPageResponse msg = new GridQueryNextPageResponse(qr.qryReqId, qry,
page,
-                page == 0 ? res.rowCount : -1, marshallRows(rows));
+                page == 0 ? res.rowCount : -1, loc ? null : marshallRows(rows), loc ? rows
: null);
 
-            if (node.isLocal())
+            if (loc)
                 h2.reduceQueryExecutor().onMessage(ctx.localNodeId(), msg);
             else
                 ctx.io().send(node, GridTopic.TOPIC_QUERY, msg, GridIoPolicy.PUBLIC_POOL);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f8d5d445/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
index e31829d..5f58b95 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
@@ -44,6 +44,7 @@ public class GridResultPage {
      * @param res Response.
      * @param last If this is the globally last page.
      */
+    @SuppressWarnings("unchecked")
     public GridResultPage(UUID src, GridQueryNextPageResponse res, boolean last) {
         assert src != null;
 
@@ -55,7 +56,13 @@ public class GridResultPage {
             assert res == null : "The last page must be dummy.";
 
         // res == null means that it is a terminating dummy page for the given source node
ID.
-        rows = res == null ? Collections.<Value[]>emptySet() : GridMapQueryExecutor.unmarshallRows(res.rows());
+        if (res != null) {
+            Object plainRows = res.plainRows();
+
+            rows = plainRows != null ? (Collection<Value[]>)plainRows : GridMapQueryExecutor.unmarshallRows(res.rows());
+        }
+        else
+            rows = Collections.emptySet();
     }
 
     /**


Mime
View raw message