ibessonov commented on code in PR #5590:
URL: https://github.com/apache/ignite-3/pull/5590#discussion_r2034782261


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/tree/BplusTree.java:
##########
@@ -631,17 +631,15 @@ public Result run0(
                 }
 
                 // Retry must reset these fields when we release the whole 
branch without remove.
-                assert r.needReplaceInner == FALSE : "needReplaceInner";
-                assert r.needMergeEmptyBranch == FALSE : 
"needMergeEmptyBranch";
+                assert !r.needReplaceInner && r.needMergeEmptyBranch == FALSE
+                        : "needReplaceInner=" + r.needReplaceInner + ", 
needMergeEmptyBranch=" + r.needMergeEmptyBranch;

Review Comment:
   Honestly, old approach looked better. Complex conditions are more difficult 
to read, you should have replaced it with
   ```
   assert !r.needReplaceInner : "needReplaceInner is true";
   assert r.needMergeEmptyBranch == FALSE : "needMergeEmptyBranch=" + 
r.needMergeEmptyBranch;
   ```
   
   Please do the same for other changed assertions



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/tree/BplusTree.java:
##########
@@ -4903,16 +4901,17 @@ private boolean releaseForRetry(Tail<L> t) {
             // Here we wanted to do a regular merge after all the important 
operations,
             // so we can leave this invalid tail as is. We have no other 
choice here
             // because our tail is not long enough for retry. Exiting.
-            assert isRemoved();
-            assert needReplaceInner != TRUE && needMergeEmptyBranch != TRUE;
+            assert isRemoved() && !needReplaceInner && needMergeEmptyBranch != 
TRUE
+                    : "isRemoved=" + isRemoved() + ", needReplaceInner=" + 
needReplaceInner
+                    + ", needMergeEmptyBranch=" + needMergeEmptyBranch;
 
             return false;
         }
 
         @Override
         protected Result finishTail() throws IgniteInternalCheckedException {
-            assert !isFinished();
-            assert tail.type == Tail.EXACT && tail.lvl >= 0 : tail;
+            assert !isFinished() && tail.type == Tail.EXACT && tail.lvl >= 0 
&& needMergeEmptyBranch != READY
+                    : "isFinished=" + isFinished() + ", tail=" + tail + ", 
needMergeEmptyBranch=" + needMergeEmptyBranch;

Review Comment:
   Here I recommend having 4 assertions, lines of code are free



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to