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



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplExternalTables.java
##########
@@ -162,7 +194,77 @@ private void dirLocationToCopy(String tableName, FileList 
fileList, Path sourceP
       targetPath = new Path(Utils.replaceHost(targetPath.toString(), 
sourcePath.toUri().getHost()));
       sourcePath = new Path(Utils.replaceHost(sourcePath.toString(), 
remoteNS));
     }
-    fileList.add(new DirCopyWork(tableName, sourcePath, 
targetPath).convertToString());
+    fileList.add(new DirCopyWork(tableName, sourcePath, targetPath, copyMode, 
snapshotPrefix).convertToString());
+  }
+
+  private SnapshotUtils.SnapshotCopyMode createSnapshotsAtSource(Path 
sourcePath, String snapshotPrefix,
+      boolean isSnapshotEnabled, HiveConf conf, 
SnapshotUtils.ReplSnapshotCount replSnapshotCount, FileList snapPathFileList,
+      ArrayList<String> prevSnaps, boolean isBootstrap) throws IOException {
+    if (!isSnapshotEnabled) {
+      LOG.info("Snapshot copy not enabled for path {} Will use normal distCp 
for copying data.", sourcePath);
+      return FALLBACK_COPY;
+    }
+    DistributedFileSystem sourceDfs = SnapshotUtils.getDFS(sourcePath, conf);
+    try {
+      if(isBootstrap) {
+        // Delete any pre existing snapshots.
+        SnapshotUtils.deleteSnapshotSafe(sourceDfs, sourcePath, 
firstSnapshot(snapshotPrefix));

Review comment:
       Changed behaviour, If it exists it will delete, and if the deletion 
fails, replication fails




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