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 2017/01/12 08:01:36 UTC

[10/24] ignite git commit: GG-11414 - Fixed cursor issue with expire time

GG-11414 - Fixed cursor issue with expire time


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

Branch: refs/heads/ignite-gg-11810
Commit: 8852c80a0c6b52531ae6a287344f1ab776e3b32f
Parents: 1ffd04a
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Dec 29 16:52:59 2016 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Dec 29 16:52:59 2016 +0300

----------------------------------------------------------------------
 .../query/h2/database/H2TreeIndex.java          | 36 ++++++++++++--------
 .../query/h2/opt/GridH2IndexBase.java           |  2 +-
 2 files changed, 23 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8852c80a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
index f685f3a..c1eb986 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
@@ -79,18 +79,24 @@ public class H2TreeIndex extends GridH2IndexBase {
 
         name = BPlusTree.treeName(name, "H2Tree");
 
-        IgniteCacheDatabaseSharedManager dbMgr = cctx.shared().database();
-
-        RootPage page = cctx.offheap().rootPageForIndex(name);
-
-        tree = new H2Tree(name, cctx.offheap().reuseListForIndex(name), cctx.cacheId(),
-            dbMgr.pageMemory(), cctx.shared().wal(), cctx.offheap().globalRemoveId(),
-            tbl.rowFactory(), page.pageId().pageId(), page.isAllocated()) {
-            @Override protected int compare(BPlusIO<SearchRow> io, ByteBuffer buf, int idx, SearchRow row)
-                throws IgniteCheckedException {
-                return compareRows(getRow(io, buf, idx), row);
-            }
-        };
+        if (!cctx.kernalContext().clientNode()) {
+            IgniteCacheDatabaseSharedManager dbMgr = cctx.shared().database();
+
+            RootPage page = cctx.offheap().rootPageForIndex(name);
+
+            tree = new H2Tree(name, cctx.offheap().reuseListForIndex(name), cctx.cacheId(),
+                dbMgr.pageMemory(), cctx.shared().wal(), cctx.offheap().globalRemoveId(),
+                tbl.rowFactory(), page.pageId().pageId(), page.isAllocated()) {
+                @Override
+                protected int compare(BPlusIO<SearchRow> io, ByteBuffer buf, int idx, SearchRow row)
+                    throws IgniteCheckedException {
+                    return compareRows(getRow(io, buf, idx), row);
+                }
+            };
+        }
+        else
+            // We need indexes on the client node, but index will not contain any data.
+            tree = null;
 
         initDistributedJoinMessaging(tbl);
     }
@@ -194,9 +200,11 @@ public class H2TreeIndex extends GridH2IndexBase {
     /** {@inheritDoc} */
     @Override public void destroy() {
         try {
-            tree.destroy();
+            if (!cctx.kernalContext().clientNode()) {
+                tree.destroy();
 
-            cctx.offheap().dropRootPageForIndex(tree.getName());
+                cctx.offheap().dropRootPageForIndex(tree.getName());
+            }
         }
         catch (IgniteCheckedException e) {
             throw new IgniteException(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8852c80a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index 56c9edc..bd569df 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -1525,7 +1525,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
          */
         @SuppressWarnings("unchecked")
         protected boolean accept(GridH2Row row) {
-            if (row.expireTime() <= time)
+            if (row.expireTime() != 0 && row.expireTime() <= time)
                 return false;
 
             if (fltr == null)