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


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/PartitionProcessingCounterMap.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * 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;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Helper class for thread-safe work with {@link PartitionProcessingCounter} 
for any partition of any group.
+ */
+public class PartitionProcessingCounterMap {
+    private final ConcurrentMap<GroupPartitionId, PartitionProcessingCounter> 
processedPartitions = new ConcurrentHashMap<>();
+
+    /**
+     * Callback at the beginning of checkpoint processing of a partition, for 
example, when writing dirty pages or executing a fsync.
+     *
+     * @param groupId Group ID.
+     * @param partitionId Partition ID.
+     */
+    public void onStartPartitionProcessing(int groupId, int partitionId) {
+        GroupPartitionId groupPartitionId = new GroupPartitionId(groupId, 
partitionId);
+
+        processedPartitions.compute(groupPartitionId, (id, 
partitionProcessingCounter) -> {
+            if (partitionProcessingCounter == null) {
+                PartitionProcessingCounter counter = new 
PartitionProcessingCounter();
+
+                counter.onStartPartitionProcessing();
+
+                return counter;
+            }
+
+            partitionProcessingCounter.onStartPartitionProcessing();
+
+            return partitionProcessingCounter;
+        });
+    }

Review Comment:
   Not suitable for us, you can see the reason in the description for 
`org.apache.ignite.internal.pagememory.persistence.PartitionProcessingCounter`



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