Phillippko commented on code in PR #6343:
URL: https://github.com/apache/ignite-3/pull/6343#discussion_r2284576325


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/checkpoint/CheckpointDirtyPages.java:
##########
@@ -177,6 +177,22 @@ public PersistentPageMemory pageMemory() {
         public int size() {
             return toPosition - fromPosition;
         }
+
+        /** Returns number of modified (not newly allocated) pages. */
+        int modifiedPages(int persistedPages) {
+            FullPageId[] dirtyPages = 
dirtyPagesAndPartitions.get(this.regionIndex).dirtyPages;
+            int partitionId = dirtyPages[fromPosition].partitionId();
+            int groupId = dirtyPages[fromPosition].groupId();
+
+            FullPageId endPageId = new FullPageId(pageId(partitionId, (byte) 
0, persistedPages - 1), groupId);
+
+            int index = binarySearch(dirtyPages, fromPosition, toPosition, 
endPageId, DIRTY_PAGE_COMPARATOR);
+
+            // If exact index is not found, binary search returns a bitwise 
complement to a potential insertion point.

Review Comment:
   Replaced with explicit bitwise operation (equal to -index - 1)



-- 
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