ignite-db - minor
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/54f26992 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/54f26992 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/54f26992 Branch: refs/heads/ignite-db-x-10884 Commit: 54f269925e0bdda79b6b251335d1481494e9fdcd Parents: 420caba Author: S.Vladykin <[email protected]> Authored: Tue Apr 12 01:41:52 2016 +0300 Committer: S.Vladykin <[email protected]> Committed: Tue Apr 12 01:41:52 2016 +0300 ---------------------------------------------------------------------- .../processors/query/h2/database/BPlusTree.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/54f26992/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/BPlusTree.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/BPlusTree.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/BPlusTree.java index 21c5a75..33a7080 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/BPlusTree.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/BPlusTree.java @@ -1281,12 +1281,12 @@ public abstract class BPlusTree<L, T extends L> { */ private T insertWithSplit(Page meta, BPlusIO<T> io, final ByteBuffer buf, T row, int idx, long rightId, int lvl) throws IgniteCheckedException { - try (Page fwdPage = allocatePage()) { + try (Page fwd = allocatePage()) { // Need to check this before the actual split, because after the split we will have new forward page here. boolean hadFwd = io.getForward(buf) != 0; - ByteBuffer fwdBuf = fwdPage.getForInitialWrite(); - io.initNewPage(fwdBuf, fwdPage.id()); + ByteBuffer fwdBuf = fwd.getForInitialWrite(); + io.initNewPage(fwdBuf, fwd.id()); splitPage(io, buf, fwdBuf); @@ -1296,7 +1296,8 @@ public abstract class BPlusTree<L, T extends L> { if (idx <= cnt) { insertSimple(io, buf, row, idx, rightId); - if (idx == cnt && !io.isLeaf()) // Fix leftmost child of fwdPage, because newly inserted row will go up. + // Fix leftmost child of forward page, because newly inserted row will go up. + if (idx == cnt && !io.isLeaf()) inner(io).setLeft(fwdBuf, 0, rightId); } else @@ -1306,7 +1307,7 @@ public abstract class BPlusTree<L, T extends L> { cnt = io.getCount(buf); assert io.canGetRow(); // TODO refactor to use io.store for move up, this assert is wrong in general case - T moveUpRow = getRow(io, buf, cnt - 1); // Last item from backward goes up. + T moveUpRow = getRow(io, buf, cnt - 1); // Last item from backward row goes up. if (!io.isLeaf()) // Leaf pages must contain all the links, inner pages remove moveUpLink. io.setCount(buf, cnt - 1); @@ -1327,7 +1328,7 @@ public abstract class BPlusTree<L, T extends L> { io.setCount(newRootBuf, 1); inner(io).setLeft(newRootBuf, 0, PageIO.getPageId(buf)); io.store(newRootBuf, 0, moveUpRow); // TODO refactor - inner(io).setRight(newRootBuf, 0, fwdPage.id()); + inner(io).setRight(newRootBuf, 0, fwd.id()); } int res = writePage(meta, updateRoot, newRootId, lvl + 1, FALSE);
