tkalkirill commented on code in PR #4437:
URL: https://github.com/apache/ignite-3/pull/4437#discussion_r1774658561


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/PersistentPageMemory.java:
##########
@@ -1865,32 +1908,28 @@ private void copyPageForCheckpoint(
         // No need to write if exception occurred.
         boolean canWrite = false;
 
-        boolean locked = rwLock.tryWriteLock(absPtr + PAGE_LOCK_OFFSET, 
TAG_LOCK_ALWAYS);
-
-        if (!locked) {
-            // We release the page only once here because this page will be 
copied sometime later and
-            // will be released properly then.
+        if (!rwLock.tryWriteLock(absPtr + PAGE_LOCK_OFFSET, TAG_LOCK_ALWAYS)) {
+            // We release the page only once here because this page will be 
copied sometime later and will be released properly then.
             if (!pageSingleAcquire) {
                 PageHeader.releasePage(absPtr);
             }
 
+            // Since we failed to take the write lock, we will try to do it 
again later, for this we will need to invoke the writer with a
+            // special tag TRY_AGAIN_TAG and also return the page in the dirty 
pages of the segment.
+
             buf.clear();
 
-            if (isInCheckpoint(fullId)) {
-                pageStoreWriter.writePage(fullId, buf, TRY_AGAIN_TAG);
-            }
+            pageStoreWriter.writePage(fullId, buf, TRY_AGAIN_TAG);
 
-            return;
-        }
+            segment.readLock().lock();
 
-        if (!clearCheckpoint(fullId)) {
-            rwLock.writeUnlock(absPtr + PAGE_LOCK_OFFSET, TAG_LOCK_ALWAYS);
+            try {
+                addToCheckpoint(segment, fullId);
 
-            if (!pageSingleAcquire) {
-                PageHeader.releasePage(absPtr);
+                return;
+            } finally {
+                segment.readLock().unlock();
             }

Review Comment:
   Revert it



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/PersistentPageMemory.java:
##########
@@ -1974,16 +2013,14 @@ public void checkpointWritePage(
         seg.readLock().lock();
 
         try {
-            if (!isInCheckpoint(fullId)) {
+            if (!removeFromCheckpoint(seg, fullId)) {
                 return;
             }
 
             relPtr = resolveRelativePointer(seg, fullId, tag = 
generationTag(seg, fullId));
 
             // Page may have been cleared during eviction. We have nothing to 
do in this case.
-            if (relPtr == INVALID_REL_PTR) {
-                return;
-            }
+            assert relPtr != INVALID_REL_PTR : "Page was removed by page 
replacing, which should not have happened: " + fullId;

Review Comment:
   revert it



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