xtern commented on code in PR #9992:
URL: https://github.com/apache/ignite/pull/9992#discussion_r883648481


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java:
##########
@@ -6347,4 +6491,137 @@ protected String lockRetryErrorMessage(String op) {
             getClass().getSimpleName() + " [grpName=" + grpName + ", 
treeName=" + name() + ", metaPageId=" +
             U.hexLong(metaPageId) + "].";
     }
+
+    /**
+     * The operation of deleting a range of values.
+     * <p>
+     * Performs the removal of several elements from the leaf at once.
+     */
+    protected class RemoveRange extends Remove {
+        /** Upper bound. */
+        private final L upper;
+
+        /** Lower bound. */
+        private final L lower;
+
+        /** List of removed rows. */
+        private final List<L> removedRows;
+
+        /** The number of remaining rows to remove ({@code -1}, if the limit 
hasn't been specified). */
+        private int remaining;
+
+        /** Flag indicating that no more rows were found from the specified 
range. */
+        private boolean completed;
+
+        /** The index of the highest row found on the page from the specified 
range. */
+        private int highIdx;
+
+        /**
+         * @param lower Lower bound (inclusive).
+         * @param upper Upper bound (inclusive).
+         * @param needOld {@code True} If need return old value.
+         */
+        protected RemoveRange(L lower, L upper, boolean needOld, int limit) {
+            super(lower, needOld, rmvRangeFromLeaf);
+
+            this.lower = lower;
+            this.upper = upper;
+
+            remaining = limit <= 0 ? -1 : limit;
+            removedRows = needOld ? new LinkedList<>() : null;
+        }
+
+        /**
+         * @return {@code True} if operation is completed.
+         */
+        private boolean isDone() {
+            return completed || remaining == 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override boolean notFound(BPlusIO<L> io, long pageAddr, int idx, int 
lvl) throws IgniteCheckedException {
+            if (lvl != 0)
+                return false;
+
+            assert !completed;
+            assert tail == null;
+
+            // If the lower bound is higher than the rightmost item, or if 
this item is outside the given range,
+            // then the search is completed - there are no items from the 
given range.
+            if (idx == io.getCount(pageAddr) || compare(io, pageAddr, idx, 
upper) > 0)
+                completed = true;
+
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        @Override protected boolean ceil() {
+            return !completed;
+        }
+
+        /** {@inheritDoc} */
+        @Override protected void removeDataRowFromLeaf(long pageId, long page, 
long pageAddr, Boolean walPlc, BPlusIO<L> io,

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to