[ https://issues.apache.org/jira/browse/HIVE-25397?focusedWorklogId=687834&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-687834 ]
ASF GitHub Bot logged work on HIVE-25397: ----------------------------------------- Author: ASF GitHub Bot Created on: 30/Nov/21 08:17 Start Date: 30/Nov/21 08:17 Worklog Time Spent: 10m Work Description: ArkoSharma commented on a change in pull request #2539: URL: https://github.com/apache/hive/pull/2539#discussion_r759026652 ########## File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplDumpTask.java ########## @@ -1105,17 +1105,15 @@ Long bootStrapDump(Path dumpRoot, DumpMetaData dmd, Path cmRoot, Hive hiveDb) boolean isExternalTablePresent = false; String snapshotPrefix = dbName.toLowerCase(); - ArrayList<String> prevSnaps = new ArrayList<>(); // Will stay empty in case of bootstrap + ArrayList<String> prevSnaps = new ArrayList<>(); if (isSnapshotEnabled) { - // Delete any old existing snapshot file, We always start fresh in case of bootstrap. FileUtils.deleteIfExists(getDFS(SnapshotUtils.getSnapshotFileListPath(dumpRoot), conf), - new Path(SnapshotUtils.getSnapshotFileListPath(dumpRoot), - EximUtil.FILE_LIST_EXTERNAL_SNAPSHOT_CURRENT)); - FileUtils.deleteIfExists(getDFS(SnapshotUtils.getSnapshotFileListPath(dumpRoot), conf), Review comment: made the change. ########## File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/DirCopyTask.java ########## @@ -254,23 +256,55 @@ public boolean canExecuteInParallel() { return true; } - boolean copyUsingDistCpSnapshots(Path sourcePath, Path targetPath, UserGroupInformation proxyUser, + boolean copyUsingDistCpSnapshots(Path sourcePath, Path targetPath, UserGroupInformation proxyUser, boolean isBootstrap, HiveConf clonedConf) throws IOException { DistributedFileSystem targetFs = SnapshotUtils.getDFS(targetPath, clonedConf); boolean result = false; + String snapPrefix = work.getSnapshotPrefix(); + if(isBootstrap && conf.getBoolVar(HiveConf.ConfVars.REPL_REUSE_SNAPSHOTS)) { + // in case of bootstrap replication from B to A (reverse replication), rename snapshots in A + // as they might have been renamed during dump in B + FileStatus[] listing = targetFs.listStatus(new Path(targetPath, ".snapshot")); + for (FileStatus elem : listing) { + String snapShotName = elem.getPath().getName(); + String prefix; + if (snapShotName.contains(OLD_SNAPSHOT)) { + prefix = snapShotName.substring(0, snapShotName.lastIndexOf(OLD_SNAPSHOT)); + if (!prefix.equals(snapPrefix)) { + targetFs.renameSnapshot(targetPath, firstSnapshot(prefix), firstSnapshot(snapPrefix)); + } + } + if (snapShotName.contains(NEW_SNAPSHOT)) { + prefix = snapShotName.substring(0, snapShotName.lastIndexOf(NEW_SNAPSHOT)); + if (!prefix.equals(snapPrefix)) { + targetFs.renameSnapshot(targetPath, secondSnapshot(prefix), secondSnapshot(snapPrefix)); + } + } + } Review comment: done. -- 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. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 687834) Time Spent: 4h 20m (was: 4h 10m) > Snapshot support for controlled failover > ---------------------------------------- > > Key: HIVE-25397 > URL: https://issues.apache.org/jira/browse/HIVE-25397 > Project: Hive > Issue Type: Bug > Reporter: Arko Sharma > Assignee: Arko Sharma > Priority: Major > Labels: pull-request-available > Time Spent: 4h 20m > Remaining Estimate: 0h > > In case the same locations are used for external tables on the source and > target, then the snapshots created during replication can be re-used during > reverse replication. This patch enables re-using the snapshots during > reverse replication using a configuration. -- This message was sent by Atlassian Jira (v8.20.1#820001)