/** * Allows a search to continue into a split node by selecting the original node or the * sibling. If the original node is returned, its shared lock is still held. If the * sibling is returned, it will have a shared latch held and the original node's latch * is released. * * @param node node which was split; shared latch must be held * @return original node or sibling */ final _Node selectNode(_Node node, byte[] key) { _Node sibling = mSibling; sibling.acquireShared(); _Node left, right; if (mSplitRight) { left = node; right = sibling; } else { left = sibling; right = node; } if (compare(key) < 0) { right.releaseShared(); return left; } else { left.releaseShared(); return right; } }
/** * Allows a search to continue into a split node by selecting the original node or the * sibling. If the original node is returned, its shared lock is still held. If the * sibling is returned, it will have a shared latch held and the original node's latch * is released. * * @param node node which was split; shared latch must be held * @return original node or sibling */ final _Node selectNode(_Node node, byte[] key) { _Node sibling = mSibling; sibling.acquireShared(); _Node left, right; if (mSplitRight) { left = node; right = sibling; } else { left = sibling; right = node; } if (compare(key) < 0) { right.releaseShared(); return left; } else { left.releaseShared(); return right; } }
/** * Allows a search to continue into a split node by selecting the original node or the * sibling. If the original node is returned, its shared lock is still held. If the * sibling is returned, it will have a shared latch held and the original node's latch * is released. * * @param node node which was split; shared latch must be held * @return original node or sibling */ final _Node selectNode(_Node node, byte[] key) { _Node sibling = mSibling; sibling.acquireShared(); _Node left, right; if (mSplitRight) { left = node; right = sibling; } else { left = sibling; right = node; } if (compare(key) < 0) { right.releaseShared(); return left; } else { left.releaseShared(); return right; } }
/** * Performs a binary search against the split, returning the position * within the original node as if it had not split. */ final int binarySearchLeaf(_Node node, byte[] key) throws IOException { _Node sibling = latchSibling(); _Node left, right; if (mSplitRight) { left = node; right = sibling; } else { left = sibling; right = node; } int searchPos; if (compare(key) < 0) { searchPos = left.binarySearch(key); } else { int highestPos = left.highestLeafPos(); searchPos = right.binarySearch(key); if (searchPos < 0) { searchPos = searchPos - highestPos - 2; } else { searchPos = highestPos + 2 + searchPos; } } sibling.releaseShared(); return searchPos; }
/** * Performs a binary search against the split, returning the position * within the original node as if it had not split. */ final int binarySearchLeaf(_Node node, byte[] key) throws IOException { _Node sibling = latchSibling(); _Node left, right; if (mSplitRight) { left = node; right = sibling; } else { left = sibling; right = node; } int searchPos; if (compare(key) < 0) { searchPos = left.binarySearch(key); } else { int highestPos = left.highestLeafPos(); searchPos = right.binarySearch(key); if (searchPos < 0) { searchPos = searchPos - highestPos - 2; } else { searchPos = highestPos + 2 + searchPos; } } sibling.releaseShared(); return searchPos; }
/** * Performs a binary search against the split, returning the position * within the original node as if it had not split. */ final int binarySearchLeaf(_Node node, byte[] key) throws IOException { _Node sibling = latchSibling(); _Node left, right; if (mSplitRight) { left = node; right = sibling; } else { left = sibling; right = node; } int searchPos; if (compare(key) < 0) { searchPos = left.binarySearch(key); } else { int highestPos = left.highestLeafPos(); searchPos = right.binarySearch(key); if (searchPos < 0) { searchPos = searchPos - highestPos - 2; } else { searchPos = highestPos + 2 + searchPos; } } sibling.releaseShared(); return searchPos; }
if (split.compare(key) < 0) { selected = left; selectedPos = _Node.internalPos(left.binarySearch(key));
if (split.compare(key) < 0) { selected = left; selectedPos = _Node.internalPos(left.binarySearch(key));
if (split.compare(key) < 0) { selected = left; selectedPos = _Node.internalPos(left.binarySearch(key));