bharatviswa504 commented on a change in pull request #986:
URL: https://github.com/apache/hadoop-ozone/pull/986#discussion_r437780671



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
##########
@@ -3027,30 +3017,59 @@ public TermIndex installSnapshot(String leaderId) {
     DBCheckpoint omDBcheckpoint = getDBCheckpointFromLeader(leaderId);
     Path newDBlocation = omDBcheckpoint.getCheckpointLocation();
 
-    // Check if current ratis log index is smaller than the downloaded
-    // snapshot 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.
     long lastAppliedIndex = omRatisServer.getLastAppliedTermIndex().getIndex();
-    long checkpointSnapshotIndex = omDBcheckpoint.getRatisSnapshotIndex();
-    long checkpointSnapshotTermIndex =
-        omDBcheckpoint.getRatisSnapshotTerm();
-    if (checkpointSnapshotIndex <= lastAppliedIndex) {
-      LOG.error("Failed to install checkpoint from OM leader: {}. The last " +
-          "applied index: {} is greater than or equal to the checkpoint's " +
-          "snapshot index: {}. Deleting the downloaded checkpoint {}", 
leaderId,
-          lastAppliedIndex, checkpointSnapshotIndex,
-          newDBlocation);
-      try {
-        FileUtils.deleteFully(newDBlocation);
-      } catch (IOException e) {
-        LOG.error("Failed to fully delete the downloaded DB checkpoint {} " +
-            "from OM leader {}.", newDBlocation,
-            leaderId, e);
+
+    // Check if current ratis 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.
+
+    OMTransactionInfo omTransactionInfo = null;
+    try {
+      // Set new DB location as DB path
+      OzoneConfiguration tempConfig = getConfiguration();
+
+      Path dbDir = newDBlocation.getParent();
+      if (dbDir != null) {
+        tempConfig.set(OZONE_OM_DB_DIRS, dbDir.toString());
+      } else {
+        LOG.error("Incorrect DB location path {} received from checkpoint.",
+            newDBlocation);
+        return null;
+      }
+
+      OMMetadataManager tempMetadataMgr =
+          new OmMetadataManagerImpl(configuration);

Review comment:
       Done. Removed extra config.




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