ayushtkn commented on a change in pull request #2043:
URL: https://github.com/apache/hive/pull/2043#discussion_r600582028



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/util/ReplUtils.java
##########
@@ -453,4 +456,67 @@ public static Path getLatestDumpPath(Path dumpRoot, 
HiveConf conf) throws IOExce
     }
     return null;
   }
+
+  public static void createSnapshotSafe(FileSystem dfs,
+      Path snapshotPath, String snapshotName) {
+    try {
+      dfs.createSnapshot(snapshotPath, snapshotName);
+    } catch (IOException e) {
+      LOG.debug("Couldn't create the snapshot {} under path {}", snapshotName,
+          snapshotPath, e);
+    }
+  }
+
+  public static void deleteSnapshotSafe(DistributedFileSystem dfs,
+      Path snapshotPath, String snapshotName) {
+    try {
+      dfs.deleteSnapshot(snapshotPath, snapshotName);
+    } catch (IOException e) {
+      LOG.debug("Couldn't delete the snapshot {} under path {}", snapshotName,
+          snapshotPath, e);
+    }
+  }
+
+  public static void renameSnapshotSafe(DistributedFileSystem dfs,
+      Path snapshotPath, String oldSnapshotName, String newSnapshotName) {
+    try {
+      dfs.renameSnapshot(snapshotPath, oldSnapshotName, newSnapshotName);
+    } catch (IOException e) {
+      LOG.debug("Couldn't rename the snapshot {} to {} under path {}",
+          oldSnapshotName, newSnapshotName, snapshotPath, e);
+    }
+  }
+
+  public static boolean allowSanapshotSafe(DistributedFileSystem dfs,
+      Path snapshotPath) throws IOException {
+    if (dfs.getFileStatus(snapshotPath).isSnapshotEnabled()) {
+      return true;
+    } else {
+      try {
+        dfs.allowSnapshot(snapshotPath);
+      } catch (Exception e) {
+        LOG.error("Cannot allow snapshot on path {}", snapshotPath, e);
+        throw e;
+      }
+    }
+    return true;
+  }
+
+  public static void disAllowSanapshotSafe(DistributedFileSystem dfs,

Review comment:
       Removed




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