This is an automated email from the ASF dual-hosted git repository. tkalkirill pushed a commit to branch ignite-26233-2 in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 956f50784818fd633c5f336cb02f51e1c4838f48 Author: Kirill Tkalenko <[email protected]> AuthorDate: Thu Aug 21 17:52:21 2025 +0300 IGNITE-26233 just add DirtyFullPageId --- .../ignite/internal/pagememory/FullPageId.java | 6 +- .../pagememory/persistence/DirtyFullPageId.java | 75 ++++++++++++++++++++++ 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/FullPageId.java b/modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/FullPageId.java index 4f47f935953..774c56d3721 100644 --- a/modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/FullPageId.java +++ b/modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/FullPageId.java @@ -52,7 +52,7 @@ import org.apache.ignite.internal.util.IgniteUtils; * * <p>Effective page ID is a page ID with zeroed bits used for page ID rotation. */ -public final class FullPageId { +public class FullPageId { /** Null page ID. */ public static final FullPageId NULL_PAGE = new FullPageId(-1, -1); @@ -143,7 +143,7 @@ public final class FullPageId { /** * MH3's plain finalization step. */ - private static int mix32(int k) { + public static int mix32(int k) { k = (k ^ (k >>> 16)) * 0x85ebca6b; k = (k ^ (k >>> 13)) * 0xc2b2ae35; @@ -157,7 +157,7 @@ public final class FullPageId { * * @see "http://zimbry.blogspot.com/2011/09/better-bit-mixing-improving-on.html" */ - private static long mix64(long z) { + public static long mix64(long z) { z = (z ^ (z >>> 32)) * 0x4cd6944c5cc20b6dL; z = (z ^ (z >>> 29)) * 0xfc12c5b19d3259e9L; diff --git a/modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/DirtyFullPageId.java b/modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/DirtyFullPageId.java new file mode 100644 index 00000000000..591a1d6af07 --- /dev/null +++ b/modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/DirtyFullPageId.java @@ -0,0 +1,75 @@ +/* + * 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 org.apache.ignite.internal.lang.IgniteStringBuilder; +import org.apache.ignite.internal.pagememory.FullPageId; + +/** Extension for checkpoint with partition generation at the time the page becomes dirty. */ +public final class DirtyFullPageId extends FullPageId { + private final int partitionGeneration; + + /** + * Constructor. + * + * @param pageId Page ID. + * @param groupId Group ID. + * @param partitionGeneration Partition generation. + */ + public DirtyFullPageId(long pageId, int groupId, int partitionGeneration) { + super(pageId, groupId); + + this.partitionGeneration = partitionGeneration; + } + + /** Returns partition generation. */ + public int partitionGeneration() { + return partitionGeneration; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (!(o instanceof DirtyFullPageId)) { + return false; + } + + DirtyFullPageId that = (DirtyFullPageId) o; + + return effectivePageId() == that.effectivePageId() + && groupId() == that.groupId() + && partitionGeneration == that.partitionGeneration; + } + + @Override + public int hashCode() { + return (int) (mix64(effectivePageId()) ^ mix32(groupId()) ^ mix32(partitionGeneration)); + } + + @Override + public String toString() { + return new IgniteStringBuilder("DirtyFullPageId [pageId=").appendHex(pageId()) + .app(", effectivePageId=").appendHex(effectivePageId()) + .app(", groupId=").app(groupId()) + .app(", partitionGeneration=").app(partitionGeneration) + .app(']').toString(); + } +}
