ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [04/25] ignite git commit: IGNITE-6027: Added last page marker to GridQueryNexPageResponse, so that responses with unknown row count could be processed correctly. This closes #2426.
Date Wed, 16 Aug 2017 15:41:27 GMT
IGNITE-6027: Added last page marker to GridQueryNexPageResponse, so that responses with unknown
row count could be processed correctly. This closes #2426.


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

Branch: refs/heads/ignite-5901
Commit: 1c62fdad521675d6965441b966726d1292cb70e1
Parents: 7199037
Author: devozerov <ppozerov@gmail.com>
Authored: Thu Aug 10 23:13:37 2017 +0300
Committer: devozerov <ppozerov@gmail.com>
Committed: Thu Aug 10 23:13:37 2017 +0300

----------------------------------------------------------------------
 .../messages/GridQueryNextPageResponse.java     | 36 ++++++++++++++++++--
 .../query/h2/twostep/GridMapQueryExecutor.java  |  6 ++--
 .../query/h2/twostep/GridMergeIndex.java        |  7 ++--
 3 files changed, 41 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1c62fdad/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 fe8b34a..4d918a0 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
@@ -67,6 +67,9 @@ public class GridQueryNextPageResponse implements Message {
     /** */
     private AffinityTopologyVersion retry;
 
+    /** Last page flag. */
+    private boolean last;
+
     /**
      * For {@link Externalizable}.
      */
@@ -83,9 +86,10 @@ public class GridQueryNextPageResponse implements Message {
      * @param cols Number of columns in row.
      * @param vals Values for rows in this page added sequentially.
      * @param plainRows Not marshalled rows for local node.
+     * @param last Last page flag.
      */
     public GridQueryNextPageResponse(long qryReqId, int segmentId, int qry, int page, int
allRows, int cols,
-        Collection<Message> vals, Collection<?> plainRows) {
+        Collection<Message> vals, Collection<?> plainRows, boolean last) {
         assert vals != null ^ plainRows != null;
         assert cols > 0 : cols;
 
@@ -97,6 +101,7 @@ public class GridQueryNextPageResponse implements Message {
         this.cols = cols;
         this.vals = vals;
         this.plainRows = plainRows;
+        this.last = last;
     }
 
     /**
@@ -220,6 +225,11 @@ public class GridQueryNextPageResponse implements Message {
 
                 writer.incrementState();
 
+            case 8:
+                if (!writer.writeBoolean("last", last))
+                    return false;
+
+                writer.incrementState();
         }
 
         return true;
@@ -296,6 +306,14 @@ public class GridQueryNextPageResponse implements Message {
                     return false;
 
                 reader.incrementState();
+
+            case 8:
+                last = reader.readBoolean("last");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
         }
 
         return reader.afterMessageRead(GridQueryNextPageResponse.class);
@@ -308,7 +326,7 @@ public class GridQueryNextPageResponse implements Message {
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 8;
+        return 9;
     }
 
     /**
@@ -325,6 +343,20 @@ public class GridQueryNextPageResponse implements Message {
         this.retry = retry;
     }
 
+    /**
+     * @return Last page flag.
+     */
+    public boolean last() {
+        return last;
+    }
+
+    /**
+     * @param last Last page flag.
+     */
+    public void last(boolean last) {
+        this.last = last;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridQueryNextPageResponse.class, this,

http://git-wip-us.apache.org/repos/asf/ignite/blob/1c62fdad/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 e717367..ca978e2 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
@@ -732,7 +732,8 @@ public class GridMapQueryExecutor {
                 page == 0 ? res.rowCount() : -1,
                 res.columnCount(),
                 loc ? null : toMessages(rows, new ArrayList<Message>(res.columnCount())),
-                loc ? rows : null);
+                loc ? rows : null,
+                last);
 
             if (loc)
                 h2.reduceQueryExecutor().onMessage(ctx.localNodeId(), msg);
@@ -758,7 +759,8 @@ public class GridMapQueryExecutor {
             GridQueryNextPageResponse msg = new GridQueryNextPageResponse(reqId, segmentId,
             /*qry*/0, /*page*/0, /*allRows*/0, /*cols*/1,
                 loc ? null : Collections.<Message>emptyList(),
-                loc ? Collections.<Value[]>emptyList() : null);
+                loc ? Collections.<Value[]>emptyList() : null,
+                false);
 
             msg.retry(h2.readyTopologyVersion());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1c62fdad/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
index 86601cd..1c1cfaf 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
@@ -46,7 +46,6 @@ import org.h2.index.IndexType;
 import org.h2.message.DbException;
 import org.h2.result.Row;
 import org.h2.result.SearchRow;
-import org.h2.table.Column;
 import org.h2.table.IndexColumn;
 import org.h2.value.Value;
 import org.jetbrains.annotations.Nullable;
@@ -329,7 +328,7 @@ public abstract class GridMergeIndex extends BaseIndex {
     private void markLastPage(GridResultPage page) {
         GridQueryNextPageResponse res = page.response();
 
-        if (res.allRows() != -2) { // -2 means the last page.
+        if (!res.last()) {
             UUID nodeId = page.source();
 
             initLastPages(nodeId, res);
@@ -337,12 +336,12 @@ public abstract class GridMergeIndex extends BaseIndex {
             ConcurrentMap<SourceKey,Integer> lp = lastPages;
 
             if (lp == null)
-                return; // It was not initialized --> wait for -2.
+                return; // It was not initialized --> wait for last page flag.
 
             Integer lastPage = lp.get(new SourceKey(nodeId, res.segmentId()));
 
             if (lastPage == null)
-                return; // This node may use the new protocol --> wait for -2.
+                return; // This node may use the new protocol --> wait for last page flag.
 
             if (lastPage != res.page()) {
                 assert lastPage > res.page();


Mime
View raw message