Class BPlusTree.Remove

java.lang.Object
BPlusTree<L,T>.Get
org.apache.ignite.internal.persistence.tree.BPlusTree.Remove
All Implemented Interfaces:
ReuseBag
Direct Known Subclasses:
BPlusTree.RemoveRange
Enclosing class:
BPlusTree<L,T extends L>

public class BPlusTree.Remove extends BPlusTree<L,T>.Get implements ReuseBag
Remove operation.
  • Method Details

    • pollFreePage

      public long pollFreePage()
      Specified by:
      pollFreePage in interface ReuseBag
      Returns:
      Free page ID for reuse or 0 if empty.
    • addFreePage

      public void addFreePage(long pageId)
      Specified by:
      addFreePage in interface ReuseBag
      Parameters:
      pageId - Free page ID for reuse.
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface ReuseBag
      Returns:
      true if no contained page IDs for reuse.
    • ceil

      protected boolean ceil()
      Returns:
      Flag indicating that values are removed using an interval (i.e. BPlusTree.Get.row specifies the start of the interval, not an exact match).
    • finish

      protected BPlusTree.Result finish(BPlusTree.Result res)
      Finish the operation.
    • isRemoved

      protected boolean isRemoved()
      Returns:
      true If already removed from leaf.
    • releaseForRetry

      protected boolean releaseForRetry(org.apache.ignite.internal.persistence.tree.BPlusTree.Tail<L> t) throws IgniteCheckedException
      Parameters:
      t - Tail to release.
      Returns:
      true If we need to retry or false to exit.
      Throws:
      IgniteCheckedException
    • finishTail

      protected BPlusTree.Result finishTail() throws IgniteCheckedException
      Process tail and finish. Same as finishOrLockTail(long, long, long, long, int) but doesn't add the page to the tail.
      Returns:
      Result.
      Throws:
      IgniteCheckedException - If failed.
    • doRemoveFromLeaf

      protected BPlusTree.Result doRemoveFromLeaf() throws IgniteCheckedException
      Returns:
      Result code.
      Throws:
      IgniteCheckedException - If failed.
    • lockForward

      protected BPlusTree.Result lockForward(int lvl) throws IgniteCheckedException
      Parameters:
      lvl - Level.
      Returns:
      Result code.
      Throws:
      IgniteCheckedException - If failed.
    • removeDataRowFromLeaf

      protected void removeDataRowFromLeaf(long pageId, long page, long pageAddr, Boolean walPlc, BPlusIO<L> io, int cnt, int idx) throws IgniteCheckedException
      Parameters:
      pageId - Page ID.
      page - Page pointer.
      pageAddr - Page address.
      walPlc - Full page WAL record policy.
      io - IO.
      cnt - Count.
      idx - Index to remove.
      Throws:
      IgniteCheckedException - If failed.
    • doRemove

      protected void doRemove(long pageId, long page, long pageAddr, Boolean walPlc, BPlusIO<L> io, int cnt, int idx) throws IgniteCheckedException
      Parameters:
      pageId - Page ID.
      page - Page pointer.
      pageAddr - Page address.
      walPlc - Full page WAL record policy.
      io - IO.
      cnt - Count.
      idx - Index to remove.
      Throws:
      IgniteCheckedException - If failed.
    • finishOrLockTail

      protected BPlusTree.Result finishOrLockTail(long pageId, long page, long backId, long fwdId, int lvl) throws IgniteCheckedException
      Method that's invoked when operation goes up from the recursion and BPlusTree.Get.isFinished() returns false. Either finishes the operation or locks the page for further processing on another level.

      Returns BPlusTree.Result.FOUND if operation has finished and BPlusTree.Get.isFinished() returns true now.

      Returns BPlusTree.Result.RETRY if operation should be retried.

      Returns BPlusTree.Result.NOT_FOUND if operation has added the page to tail, meaning that operation can't be finished on current level.

      Parameters:
      pageId - Page ID.
      page - Page pointer.
      backId - Back page ID.
      fwdId - Forward ID.
      lvl - Level.
      Returns:
      Result.
      Throws:
      IgniteCheckedException - If failed.
    • releaseTail

      protected final void releaseTail() throws IgniteCheckedException
      Release pages for all locked levels at the tail.
      Throws:
      IgniteCheckedException
    • checkTailLevel

      protected final boolean checkTailLevel(int rootLvl)
      Parameters:
      rootLvl - Actual root level.
      Returns:
      true If tail level is correct.
    • doReleaseTail

      protected final void doReleaseTail(org.apache.ignite.internal.persistence.tree.BPlusTree.Tail<L> t) throws IgniteCheckedException
      Parameters:
      t - Tail.
      Throws:
      IgniteCheckedException - If failed.
    • canRelease

      public final boolean canRelease(long pageId, int lvl)
      Overrides:
      canRelease in class BPlusTree<L,T extends L>.Get
      Parameters:
      pageId - Page.
      lvl - Level.
      Returns:
      true If we can release the given page.
    • isTail

      protected final boolean isTail(long pageId, int lvl)
      Parameters:
      pageId - Page ID.
      lvl - Level.
      Returns:
      true If the given page is in tail.
    • addTail

      protected final org.apache.ignite.internal.persistence.tree.BPlusTree.Tail<L> addTail(long pageId, long page, long pageAddr, BPlusIO<L> io, int lvl, byte type)
      Parameters:
      pageId - Page ID.
      page - Page pointer.
      pageAddr - Page address.
      io - IO.
      lvl - Level.
      type - Type.
      Returns:
      Added tail.
    • getTail

      protected final org.apache.ignite.internal.persistence.tree.BPlusTree.Tail<L> getTail(org.apache.ignite.internal.persistence.tree.BPlusTree.Tail<L> tail, int lvl)
      Parameters:
      tail - Tail to start with.
      lvl - Level.
      Returns:
      Tail of BPlusTree.Tail.EXACT type at the given level.
    • insertionPoint

      protected final int insertionPoint(org.apache.ignite.internal.persistence.tree.BPlusTree.Tail<L> tail) throws IgniteCheckedException
      Parameters:
      tail - Tail.
      Returns:
      Insertion point. May be negative.
      Throws:
      IgniteCheckedException - If failed.
    • printTail

      protected final String printTail(boolean keys) throws IgniteCheckedException
      Parameters:
      keys - If we have to show keys.
      Returns:
      Tail as a String.
      Throws:
      IgniteCheckedException - If failed.