arp7 commented on a change in pull request #1129:
URL: https://github.com/apache/hadoop-ozone/pull/1129#discussion_r447284712



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
##########
@@ -3040,45 +3024,61 @@ public TermIndex installSnapshot(String leaderId) {
     } catch (Exception e) {
       LOG.error("Failed to stop/ pause the services. Cannot proceed with " +
           "installing the new checkpoint.", e);
+
+      // During stopServices, if KeyManager was stopped successfully and
+      // OMMetadataManager stop failed, we should restart the KeyManager.
+      keyManager.start(configuration);
+
       return null;
     }
 
-    //TODO: un-pause SM if any failures and retry?
+    File dbBackup;
+    TermIndex termIndex = omRatisServer.getLastAppliedTermIndex();
+    long currentTerm = termIndex.getTerm();
+    long lastAppliedIndex = termIndex.getIndex();
+    boolean loadSuccess = false;
 
-    long lastAppliedIndex = omRatisServer.getLastAppliedTermIndex().getIndex();
+    try {
+      // Check if current applied log index is smaller than the downloaded
+      // checkpoint transaction index. If yes, proceed by stopping the ratis
+      // server so that the OM state can be re-initialized. If no then do not
+      // proceed with installSnapshot.
+      boolean canProceed = OzoneManagerRatisUtils.verifyTransactionInfo(
+          omTransactionInfo, lastAppliedIndex, leaderId, newDBLocation);
+      if (!canProceed) {
+        return null;
+      }
 
-    boolean canProceed =
-        OzoneManagerRatisUtils.verifyTransactionInfo(omTransactionInfo,
-        lastAppliedIndex, leaderId, newDBlocation);
+      try {
+        dbBackup = replaceOMDBWithCheckpoint(lastAppliedIndex, oldDBLocation,

Review comment:
       Also the marker file should be created before starting the move 
operations, and deleted on success.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to