ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: Try get rid of extra comparison in ForwardCursor.fillFromBuffer.
Date Wed, 04 Oct 2017 12:47:27 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-3478-tree [created] c72770cf1


Try get rid of extra comparison in ForwardCursor.fillFromBuffer.


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

Branch: refs/heads/ignite-3478-tree
Commit: c72770cf1744bc1a3eb696cf80657a0a670fce43
Parents: 20033c7
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Oct 4 15:47:16 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Oct 4 15:47:16 2017 +0300

----------------------------------------------------------------------
 .../cache/persistence/tree/BPlusTree.java           | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c72770cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
index c73b4c7..1ed5e34 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
@@ -907,7 +907,7 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure
implements
             long pageAddr = readLock(firstPageId, firstPage); // We always merge pages backwards,
the first page is never removed.
 
             try {
-                cursor.init(pageAddr, io(pageAddr), 0);
+                cursor.init(pageAddr, io(pageAddr), -1);
             }
             finally {
                 readUnlock(firstPageId, firstPage, pageAddr);
@@ -4513,7 +4513,7 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure
implements
         /**
          * @param pageAddr Page address.
          * @param io IO.
-         * @param startIdx Start index.
+         * @param startIdx Start index or -1 if need find lower bound.
          * @param cnt Number of rows in the buffer.
          * @return {@code true} If we were able to fetch rows from this page.
          * @throws IgniteCheckedException If failed.
@@ -4523,15 +4523,19 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure
implements
             throws IgniteCheckedException {
             assert io.isLeaf() : io;
             assert cnt != 0 : cnt; // We can not see empty pages (empty tree handled in init).
-            assert startIdx >= 0 : startIdx;
+            assert startIdx >= 0 || startIdx == -1 : startIdx;
             assert cnt >= startIdx;
 
             checkDestroyed();
 
             nextPageId = io.getForward(pageAddr);
 
-            if (lowerBound != null && startIdx == 0)
-                startIdx = findLowerBound(pageAddr, io, cnt);
+            if (startIdx == -1) {
+                if (lowerBound != null)
+                    startIdx = findLowerBound(pageAddr, io, cnt);
+                else
+                    startIdx = 0;
+            }
 
             if (upperBound != null && cnt != startIdx)
                 cnt = findUpperBound(pageAddr, io, startIdx, cnt);
@@ -4638,7 +4642,7 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure
implements
                     try {
                         BPlusIO<L> io = io(pageAddr);
 
-                        if (fillFromBuffer(pageAddr, io, 0, io.getCount(pageAddr)))
+                        if (fillFromBuffer(pageAddr, io, -1, io.getCount(pageAddr)))
                             return true;
 
                         // Continue fetching forward.


Mime
View raw message