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


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/PersistentPageMemory.java:
##########
@@ -1495,14 +1494,30 @@ private void resetDirtyPages() {
         }
 
         /**
-         * Prepares a page removal for page replacement, if needed.
+         * Tries to replace the page.
+         *
+         * <p>The replacement will be successful if the following conditions 
are met:</p>
+         * <ul>
+         *     <li>Page is not dirty - just replace it.</li>
+         *     <li>page is dirty, then there should be a checkpoint in the 
process and the following sub-conditions are met:</li>
+         *     <ul>
+         *         <li>If the dirty page sorting phase is complete, otherwise 
we wait for it. This is necessary so that we can safely
+         *         create partition delta files in which the dirty page order 
must be preserved.</li>
+         *         <li>If the checkpoint dirty page writer has not started 
writing the page or has already written it.</li>
+         *         <li>If the delta file fsync phase is not ready to start or 
is not in progress. This is necessary so that the data
+         *         remains consistent after the fsync phase is complete. If 
the phase has not yet begun, we will block it until we complete
+         *         the replacement.</li>
+         *     </ul>
+         * </ul>
+         *
+         * <p>It is expected that if the method returns {@code true}, it will 
not be invoked again for the same page ID.</p>
          *
-         * @param fullPageId Candidate page full ID.
-         * @param absPtr Absolute pointer of the page to evict.
-         * @return {@code True} if it is ok to replace this page, {@code 
false} if another page should be selected.
-         * @throws IgniteInternalCheckedException If failed to write page to 
the underlying store during eviction.
+         * @param pageId Candidate page ID.
+         * @param absPtr Absolute pointer to the candidate page.
+         * @return {@code True} if the page replacement was successful, 
otherwise need to try another one.
+         * @throws StorageException If any error occurred while waiting for 
the dirty page sorting phase to complete at a checkpoint.
          */
-        public boolean tryToRemovePage(FullPageId fullPageId, long absPtr) 
throws IgniteInternalCheckedException {
+        public boolean tryToReplacePage(FullPageId pageId, long absPtr) {
             assert writeLock().isHeldByCurrentThread();
 
             if (isAcquired(absPtr)) {

Review Comment:
   Try to describe.



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