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


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/checkpoint/CheckpointPagesWriter.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.pagememory.persistence.checkpoint;
+
+import static org.apache.ignite.internal.pagememory.PageIdAllocator.FLAG_DATA;
+import static org.apache.ignite.internal.pagememory.io.PageIo.getType;
+import static org.apache.ignite.internal.pagememory.io.PageIo.getVersion;
+import static 
org.apache.ignite.internal.pagememory.persistence.PageMemoryImpl.TRY_AGAIN_TAG;
+import static 
org.apache.ignite.internal.pagememory.persistence.checkpoint.IgniteConcurrentMultiPairQueue.EMPTY;
+import static org.apache.ignite.internal.pagememory.util.PageIdUtils.flag;
+import static org.apache.ignite.internal.util.IgniteUtils.hexLong;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.LongAdder;
+import java.util.function.BooleanSupplier;
+import org.apache.ignite.internal.pagememory.FullPageId;
+import org.apache.ignite.internal.pagememory.persistence.PageMemoryImpl;
+import org.apache.ignite.internal.pagememory.persistence.PageStoreWriter;
+import org.apache.ignite.internal.pagememory.persistence.store.PageStore;
+import org.apache.ignite.lang.IgniteInternalCheckedException;
+import org.apache.ignite.lang.IgniteLogger;
+
+/**
+ * Implementation of page writer which able to store pages to disk during 
checkpoint.
+ */
+public class CheckpointPagesWriter implements Runnable {
+    /** Logger. */
+    private final IgniteLogger log;
+
+    /** Checkpoint specific metrics tracker. */
+    private final CheckpointMetricsTracker tracker;
+
+    /** Collection of page IDs to write under this task. Overall pages to 
write may be greater than this collection. */
+    private final IgniteConcurrentMultiPairQueue<PageMemoryImpl, FullPageId> 
writePageIds;
+
+    /** Page store used to write -> Count of written pages. */
+    private final ConcurrentMap<PageStore, LongAdder> updStores;
+
+    /** Future which should be finished when all pages would be written. */
+    private final CompletableFuture<?> doneFut;
+
+    /** Some action which will be executed every time before page will be 
written. */
+    private final Runnable beforePageWrite;
+
+    /** Thread local with buffers for the checkpoint threads. Each buffer 
represent one page for durable memory. */
+    private final ThreadLocal<ByteBuffer> threadBuf;
+
+    /** Current checkpoint. This field is updated only by checkpoint thread. */
+    private final CheckpointProgressImpl checkpointProgress;
+
+    /** Writer which able to write one page. */
+    private final CheckpointPageWriter pageWriter;
+
+    /** Shutdown now. */
+    private final BooleanSupplier shutdownNow;

Review Comment:
   It could be changed in the future, but checking for a single condition seems 
easier to implement.



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