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


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/PartitionMeta.java:
##########
@@ -86,24 +113,89 @@ public int pageCount() {
     }
 
     /**
-     * Sets count of pages in the partition.
-     *
-     * @param pageCount Count of pages in the partition.
+     * Increases the number of pages in a partition.
      */
-    public void pageCount(int pageCount) {
-        this.pageCount = pageCount;
+    public void incrementPageCount(@Nullable UUID checkpointId) {
+        updateSnapshot(checkpointId);
+
+        PAGE_COUNT_UPDATER.incrementAndGet(this);
     }
 
     /**
-     * Returns {@code true} if the partition meta was created, {@code false} 
if it was read from a partition file.
+     * Returns the latest snapshot of the partition meta.
+     *
+     * @param checkpointId Checkpoint ID.
      */
-    public boolean isCreated() {
-        return created;
+    public PartitionMetaSnapshot metaSnapshot(@Nullable UUID checkpointId) {
+        updateSnapshot(checkpointId);
+
+        return metaSnapshot;
+    }
+
+    private void updateSnapshot(@Nullable UUID checkpointId) {
+        PartitionMetaSnapshot current = this.metaSnapshot;
+
+        if (current.checkpointId != checkpointId) {
+            META_SNAPSHOT_VH.compareAndSet(this, current, new 
PartitionMetaSnapshot(checkpointId, this));

Review Comment:
   Fix 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