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 2021/05/19 16:07:05 UTC

[GitHub] [ignite] xtern opened a new pull request #9113: IGNITE-14723 Restore cache from the snapshot using CLI.

xtern opened a new pull request #9113:
URL: https://github.com/apache/ignite/pull/9113


   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.

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



[GitHub] [ignite] Mmuzaf merged pull request #9113: IGNITE-14723 Restore cache from the snapshot using CLI.

Posted by GitBox <gi...@apache.org>.
Mmuzaf merged pull request #9113:
URL: https://github.com/apache/ignite/pull/9113


   


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

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



[GitHub] [ignite] xtern commented on a change in pull request #9113: IGNITE-14723 Restore cache from the snapshot using CLI.

Posted by GitBox <gi...@apache.org>.
xtern commented on a change in pull request #9113:
URL: https://github.com/apache/ignite/pull/9113#discussion_r654293890



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteCacheSnapshotManager.java
##########
@@ -49,7 +49,7 @@
 
     /**
      * Try to start local snapshot operation if it's required by discovery event.
-     *
+     *private IgniteFuture<Boolean> executeRestoreManagementTask(

Review comment:
       😳 reverted 

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java
##########
@@ -1995,6 +2051,9 @@ public SnapshotStartDiscoveryMessage(
         /** Snapshot finish time. */
         volatile long endTime;
 
+        /** Interrupted exception. */
+        volatile Exception interruptEx;

Review comment:
       Done




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

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



[GitHub] [ignite] Mmuzaf commented on a change in pull request #9113: IGNITE-14723 Restore cache from the snapshot using CLI.

Posted by GitBox <gi...@apache.org>.
Mmuzaf commented on a change in pull request #9113:
URL: https://github.com/apache/ignite/pull/9113#discussion_r653510021



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
##########
@@ -381,22 +393,58 @@ public void onNodeLeft(UUID leftNodeId) {
     }
 
     /**
-     * Abort the currently running restore procedure (if any).
+     * Cancel the currently running local restore procedure.
+     *
+     * @param reason Interruption reason.
+     * @param snpName Snapshot name.
+     * @return {@code True} if the restore process with the specified snapshot name has been canceled, {@code False} if
+     * the restore process with the specified snapshot name is not running at all.
+     */
+    public boolean cancel(Exception reason, String snpName) {
+        SnapshotRestoreContext opCtx0 = opCtx;
+        boolean ctxStop = opCtx0 != null && (snpName == null || opCtx0.snpName.equals(snpName));

Review comment:
       I think checking for `snpName == null` is unnecessary. We should add an assertion `snpName != null` instead.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
##########
@@ -443,9 +491,18 @@ private void ensureCacheAbsent(String name) {
                 }
             }
 
-            opCtx = prepareContext(req);
+            SnapshotRestoreContext opCtx0 = opCtx = prepareContext(req);
+            ClusterSnapshotFuture fut0 = fut;
 
-            SnapshotRestoreContext opCtx0 = opCtx;
+            if (fut0 != null) {
+                Exception err = fut0.interruptEx;

Review comment:
       Why do we need this check? It seems it affects only the single node where the `fut` exists.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java
##########
@@ -1995,6 +2051,9 @@ public SnapshotStartDiscoveryMessage(
         /** Snapshot finish time. */
         volatile long endTime;
 
+        /** Interrupted exception. */
+        volatile Exception interruptEx;

Review comment:
       I think we can downgrade this exception type to the `IgniteCheckedException` and the same for `cancel` and `interrupt` methods since the `Exception` has a too broader scope.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteCacheSnapshotManager.java
##########
@@ -49,7 +49,7 @@
 
     /**
      * Try to start local snapshot operation if it's required by discovery event.
-     *
+     *private IgniteFuture<Boolean> executeRestoreManagementTask(

Review comment:
       Should we revert this change?

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
##########
@@ -381,22 +393,58 @@ public void onNodeLeft(UUID leftNodeId) {
     }
 
     /**
-     * Abort the currently running restore procedure (if any).
+     * Cancel the currently running local restore procedure.
+     *
+     * @param reason Interruption reason.
+     * @param snpName Snapshot name.
+     * @return {@code True} if the restore process with the specified snapshot name has been canceled, {@code False} if
+     * the restore process with the specified snapshot name is not running at all.
+     */
+    public boolean cancel(Exception reason, String snpName) {
+        SnapshotRestoreContext opCtx0 = opCtx;
+        boolean ctxStop = opCtx0 != null && (snpName == null || opCtx0.snpName.equals(snpName));
+
+        if (ctxStop)
+            interrupt(opCtx0, reason);
+
+        ClusterSnapshotFuture fut0 = fut;
+
+        if (fut0 != null && (snpName == null || fut0.name.equals(snpName))) {

Review comment:
       I think checking for snpName == null is unnecessary.




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

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