private static void cleanUpSnapshots(ArrayList<String> diffList, String prefix, ReplSnapshotCount snapshotCount,
      HiveConf conf) throws IOException {
    DistributedFileSystem dfs =
        diffList.size() > 0 ? (DistributedFileSystem) new Path(diffList.get(0)).getFileSystem(conf) : null;
    for (String path : diffList) {
      Path snapshotPath = new Path(path);
      boolean isFirstDeleted = deleteSnapshotIfExists(dfs, snapshotPath, firstSnapshot(prefix), conf);
      boolean isSecondDeleted = deleteSnapshotIfExists(dfs, snapshotPath, secondSnapshot(prefix), conf);
      // Only attempt to disallowSnapshot, we have deleted the snapshots related to our replication policy, so if
      // this path was only used by this policy for snapshots, then the disallow will be success, if it is used by
      // some other applications as well, it won't be success, in that case we ignore.
      disallowSnapshot(dfs, snapshotPath);
      if (snapshotCount != null) {
        if (isFirstDeleted) {
          snapshotCount.incrementNumDeleted();
        }
        if (isSecondDeleted) {
          snapshotCount.incrementNumDeleted();
        }
      }
    }
  }
Deletes the snapshots present in the list.
@param diffList Elements to be deleted.
@param prefix Prefix used in snapshot names,
@param snapshotCount snapshot counter to track the number of snapshots deleted.
@param conf the Hive Configuration.
@throws IOException in case of any error.
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/util/SnapshotUtils.java