Source:
private List<Path> getFilesToRetry(FileSystem sourceFs, List<ReplChangeManager.FileInfo> srcFileList, FileSystem destinationFs, Path destination, boolean isCopyError) throws IOException { List<Path> pathList = new ArrayList<Path>(); for (ReplChangeManager.FileInfo srcFile : srcFileList) { if (srcFile.isCopyDone()) { continue; } Path srcPath = srcFile.getEffectivePath(); Path destPath = new Path(destination, srcPath.getName()); if (destinationFs.exists(destPath)) { if (isSourceFileMismatch(sourceFs, srcFile)) { destinationFs.delete(destPath, true); srcFile.setIsUseSourcePath(false); } else { if (!isCopyError) { srcFile.setCopyDone(true); continue; } } } else { if (sourceFs.exists(srcPath)) { if (isSourceFileMismatch(sourceFs, srcFile)) { srcFile.setIsUseSourcePath(false); } } else { if (srcFile.isUseSourcePath()) { srcFile.setIsUseSourcePath(false); } else { LOG.error("File Copy Failed. Both source and CM files are missing from source. " + "Missing Source File: " + srcFile.getSourcePath() + ", CM File: " + srcFile.getCmPath() + ". " + "Try setting higher value for hive.repl.cm.retain in source warehouse. " + "Also, bootstrap the system again to get back the consistent replicated state."); throw new IOException("Both source and CM path are missing from source."); } } } srcPath = srcFile.getEffectivePath(); if (null == srcPath) { LOG.error("File copy failed and likely source file is deleted or modified. " + "Source File: " + srcFile.getSourcePath()); throw new IOException("File copy failed and likely source file is deleted or modified."); } pathList.add(srcFile.getEffectivePath()); } return pathList; }

Target:
private List<Path> getFilesToRetry(FileSystem sourceFs, List<ReplChangeManager.FileInfo> srcFileList, FileSystem destinationFs, Path destination, boolean isCopyError) throws IOException { List<Path> pathList = new ArrayList<Path>(); for (ReplChangeManager.FileInfo srcFile : srcFileList) { if (srcFile.isCopyDone()) { continue; } Path srcPath = srcFile.getEffectivePath(); Path destPath = new Path(destination, srcPath.getName()); if (destinationFs.exists(destPath)) { if (isSourceFileMismatch(sourceFs, srcFile)) { destinationFs.delete(destPath, true); srcFile.setIsUseSourcePath(false); } else { if (!isCopyError) { srcFile.setCopyDone(true); continue; } } } else { if (sourceFs.exists(srcPath)) { if (isSourceFileMismatch(sourceFs, srcFile)) { srcFile.setIsUseSourcePath(false); } } else { if (srcFile.isUseSourcePath()) { srcFile.setIsUseSourcePath(false); } else { LOG.error("File Copy Failed. Both source and CM files are missing from source. " + "Missing Source File: " + srcFile.getSourcePath() + ", CM File: " + srcFile.getCmPath() + ". " + "Try setting higher value for hive.repl.cm.retain in source warehouse. " + "Also, bootstrap the system again to get back the consistent replicated state."); throw new IOException("Both source and CM path are missing from source."); } } } srcPath = srcFile.getEffectivePath(); if (null == srcPath) { LOG.error("File copy failed and likely source file is deleted or modified. " + "Source File: " + srcFile.getSourcePath()); throw new IOException("File copy failed and likely source file is deleted or modified."); } pathList.add(srcPath); } return pathList; }