You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/09/13 06:28:24 UTC

[GitHub] [ignite] timoninmaxim opened a new pull request, #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

timoninmaxim opened a new pull request, #10247:
URL: https://github.com/apache/ignite/pull/10247

   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] nizhikov commented on a diff in pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10247:
URL: https://github.com/apache/ignite/pull/10247#discussion_r977890791


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotMetadata.java:
##########
@@ -97,6 +101,7 @@ public SnapshotMetadata(
         List<Integer> grpIds,
         Set<String> bltNodes,
         Set<GroupPartitionId> pairs,
+        @Nullable Long lastSegIdx,

Review Comment:
   It seems `lastSegIdx` can be null only when we read existing snapshot metadata from disk.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] timoninmaxim commented on a diff in pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on code in PR #10247:
URL: https://github.com/apache/ignite/pull/10247#discussion_r977928341


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotMetadata.java:
##########
@@ -97,6 +101,7 @@ public SnapshotMetadata(
         List<Integer> grpIds,
         Set<String> bltNodes,
         Set<GroupPartitionId> pairs,
+        @Nullable Long lastSegIdx,

Review Comment:
   It could be null if wal() is disabled by user while snapshot is creating.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] nizhikov merged pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
nizhikov merged PR #10247:
URL: https://github.com/apache/ignite/pull/10247


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] nizhikov commented on a diff in pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10247:
URL: https://github.com/apache/ignite/pull/10247#discussion_r978605719


##########
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/SnapshotView.java:
##########
@@ -41,22 +45,23 @@ public class SnapshotView {
     /** Cache group names that were included in the snapshot. */
     private final String cacheGrps;
 
+    /** WAL segment that contains {@link ClusterSnapshotRecord} if exists. */
+    private final String snpRecSeg;

Review Comment:
   Let's make this field long.
   Also, we can store only meta, cacheGrps and just proxy calls to it from view getters.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] timoninmaxim commented on a diff in pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on code in PR #10247:
URL: https://github.com/apache/ignite/pull/10247#discussion_r978492159


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java:
##########
@@ -822,14 +822,17 @@ private IgniteInternalFuture<SnapshotOperationResponse> initLocalSnapshotStartSt
 
                 snpDir.mkdirs();
 
+                SnapshotFutureTaskResult res = (SnapshotFutureTaskResult)fut.result();
+
                 SnapshotMetadata meta = new SnapshotMetadata(req.requestId(),
                     req.snapshotName(),
                     cctx.localNode().consistentId().toString(),
                     pdsSettings.folderName(),
                     cctx.gridConfig().getDataStorageConfiguration().getPageSize(),
                     grpIds,
                     blts,
-                    (Set<GroupPartitionId>)fut.result(),
+                    res.parts(),
+                    res.snapshotPointer() == null ? null : res.snapshotPointer().index() - 1,

Review Comment:
   Remove segment rollover. Store full WALRecord instead



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] nizhikov commented on a diff in pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10247:
URL: https://github.com/apache/ignite/pull/10247#discussion_r977890335


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotFutureTaskResult.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.processors.cache.persistence.snapshot;
+
+import java.util.Collections;
+import java.util.Set;
+import org.apache.ignite.internal.pagemem.wal.record.delta.ClusterSnapshotRecord;
+import org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId;
+import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents result of {@link SnapshotFutureTask}.
+ */
+class SnapshotFutureTaskResult {
+    /**
+     * Partitions for which snapshot was created.
+     */
+    private final Set<GroupPartitionId> parts;
+
+    /**
+     * Pointer to {@link ClusterSnapshotRecord} in WAL.
+     */
+    private final @Nullable WALPointer snpPtr;
+
+    /** */
+    SnapshotFutureTaskResult(Set<GroupPartitionId> parts, @Nullable WALPointer snpPtr) {

Review Comment:
   It seems `snpPtr` can't be null.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotFutureTaskResult.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.processors.cache.persistence.snapshot;
+
+import java.util.Collections;
+import java.util.Set;
+import org.apache.ignite.internal.pagemem.wal.record.delta.ClusterSnapshotRecord;
+import org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId;
+import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents result of {@link SnapshotFutureTask}.
+ */
+class SnapshotFutureTaskResult {
+    /**
+     * Partitions for which snapshot was created.
+     */
+    private final Set<GroupPartitionId> parts;
+
+    /**
+     * Pointer to {@link ClusterSnapshotRecord} in WAL.
+     */
+    private final @Nullable WALPointer snpPtr;
+
+    /** */
+    SnapshotFutureTaskResult(Set<GroupPartitionId> parts, @Nullable WALPointer snpPtr) {
+        this.parts = Collections.unmodifiableSet(parts);
+        this.snpPtr = snpPtr;
+    }
+
+    /** */
+    Set<GroupPartitionId> parts() {
+        return parts;
+    }
+
+    /** */
+    @Nullable WALPointer snapshotPointer() {

Review Comment:
   It seems `snpPtr` can't be null.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] nizhikov commented on a diff in pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10247:
URL: https://github.com/apache/ignite/pull/10247#discussion_r978495931


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java:
##########
@@ -2183,7 +2186,12 @@ private SnapshotView snapshotViewSupplier(SnapshotMetadata meta) {
         List<File> dirs = snapshotCacheDirectories(meta.snapshotName(), null, meta.folderName(), name -> true);
         Collection<String> cacheGrps = F.viewReadOnly(dirs, FilePageStoreManager::cacheGroupName);
 
-        return new SnapshotView(meta.snapshotName(), meta.consistentId(), F.concat(meta.baselineNodes(), ","), F.concat(cacheGrps, ","));
+        return new SnapshotView(
+            meta.snapshotName(),
+            meta.consistentId(),
+            F.concat(meta.baselineNodes(), ","),
+            F.concat(cacheGrps, ","),
+            String.valueOf(meta.snapshotRecordPointer().index()));

Review Comment:
   NPE here if snpPtr == null? 



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] timoninmaxim commented on a diff in pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on code in PR #10247:
URL: https://github.com/apache/ignite/pull/10247#discussion_r977928904


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotFutureTaskResult.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.processors.cache.persistence.snapshot;
+
+import java.util.Collections;
+import java.util.Set;
+import org.apache.ignite.internal.pagemem.wal.record.delta.ClusterSnapshotRecord;
+import org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId;
+import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents result of {@link SnapshotFutureTask}.
+ */
+class SnapshotFutureTaskResult {
+    /**
+     * Partitions for which snapshot was created.
+     */
+    private final Set<GroupPartitionId> parts;
+
+    /**
+     * Pointer to {@link ClusterSnapshotRecord} in WAL.
+     */
+    private final @Nullable WALPointer snpPtr;
+
+    /** */
+    SnapshotFutureTaskResult(Set<GroupPartitionId> parts, @Nullable WALPointer snpPtr) {
+        this.parts = Collections.unmodifiableSet(parts);
+        this.snpPtr = snpPtr;
+    }
+
+    /** */
+    Set<GroupPartitionId> parts() {
+        return parts;
+    }
+
+    /** */
+    @Nullable WALPointer snapshotPointer() {

Review Comment:
   It could be null if wal() is disabled by user while snapshot is creating.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotFutureTaskResult.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.processors.cache.persistence.snapshot;
+
+import java.util.Collections;
+import java.util.Set;
+import org.apache.ignite.internal.pagemem.wal.record.delta.ClusterSnapshotRecord;
+import org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId;
+import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents result of {@link SnapshotFutureTask}.
+ */
+class SnapshotFutureTaskResult {
+    /**
+     * Partitions for which snapshot was created.
+     */
+    private final Set<GroupPartitionId> parts;
+
+    /**
+     * Pointer to {@link ClusterSnapshotRecord} in WAL.
+     */
+    private final @Nullable WALPointer snpPtr;
+
+    /** */
+    SnapshotFutureTaskResult(Set<GroupPartitionId> parts, @Nullable WALPointer snpPtr) {

Review Comment:
   It could be null if wal() is disabled by user while snapshot is creating.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] nizhikov commented on a diff in pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10247:
URL: https://github.com/apache/ignite/pull/10247#discussion_r978496523


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java:
##########
@@ -2183,7 +2186,12 @@ private SnapshotView snapshotViewSupplier(SnapshotMetadata meta) {
         List<File> dirs = snapshotCacheDirectories(meta.snapshotName(), null, meta.folderName(), name -> true);
         Collection<String> cacheGrps = F.viewReadOnly(dirs, FilePageStoreManager::cacheGroupName);
 
-        return new SnapshotView(meta.snapshotName(), meta.consistentId(), F.concat(meta.baselineNodes(), ","), F.concat(cacheGrps, ","));
+        return new SnapshotView(

Review Comment:
   You also, must regenerate `SnapshotViewWalker` - just run `SystemViewRowAttributeWalkerGenerator` and commit generated changes.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] nizhikov commented on a diff in pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10247:
URL: https://github.com/apache/ignite/pull/10247#discussion_r978495335


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java:
##########
@@ -2183,7 +2186,12 @@ private SnapshotView snapshotViewSupplier(SnapshotMetadata meta) {
         List<File> dirs = snapshotCacheDirectories(meta.snapshotName(), null, meta.folderName(), name -> true);
         Collection<String> cacheGrps = F.viewReadOnly(dirs, FilePageStoreManager::cacheGroupName);
 
-        return new SnapshotView(meta.snapshotName(), meta.consistentId(), F.concat(meta.baselineNodes(), ","), F.concat(cacheGrps, ","));
+        return new SnapshotView(

Review Comment:
   Can we make constructor with only `meta, cacheGrps` and perform transformation inside view.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] nizhikov commented on a diff in pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10247:
URL: https://github.com/apache/ignite/pull/10247#discussion_r977899447


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java:
##########
@@ -822,14 +822,17 @@ private IgniteInternalFuture<SnapshotOperationResponse> initLocalSnapshotStartSt
 
                 snpDir.mkdirs();
 
+                SnapshotFutureTaskResult res = (SnapshotFutureTaskResult)fut.result();
+
                 SnapshotMetadata meta = new SnapshotMetadata(req.requestId(),
                     req.snapshotName(),
                     cctx.localNode().consistentId().toString(),
                     pdsSettings.folderName(),
                     cctx.gridConfig().getDataStorageConfiguration().getPageSize(),
                     grpIds,
                     blts,
-                    (Set<GroupPartitionId>)fut.result(),
+                    res.parts(),
+                    res.snapshotPointer() == null ? null : res.snapshotPointer().index() - 1,

Review Comment:
   The logic with `seg - 1` is not clear for me. Can you, please, explain.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] nizhikov commented on a diff in pull request #10247: IGNITE-17645 Write lastSnpSeg into SnapshotMetadata

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10247:
URL: https://github.com/apache/ignite/pull/10247#discussion_r977891069


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotMetadata.java:
##########
@@ -170,6 +176,13 @@ public Map<Integer, Set<Integer>> partitions() {
         return Collections.unmodifiableMap(locParts);
     }
 
+    /**
+     * @return Index of last WAL segment that contains data of snapshot.
+     */
+    public Long lastSegIdx() {

Review Comment:
   `lastSegIdx` can be null here.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org