sankarh commented on a change in pull request #569: HIVE-21446 : Hive Server going OOM during hive external table replications URL: https://github.com/apache/hive/pull/569#discussion_r266770131
########## File path: ql/src/java/org/apache/hadoop/hive/ql/parse/repl/CopyUtils.java ########## @@ -57,30 +57,37 @@ private final long maxNumberOfFiles; private final boolean hiveInTest; private final String copyAsUser; + private FileSystem destinationFs; - public CopyUtils(String distCpDoAsUser, HiveConf hiveConf) { + public CopyUtils(String distCpDoAsUser, HiveConf hiveConf, FileSystem destinationFs) { this.hiveConf = hiveConf; maxNumberOfFiles = hiveConf.getLongVar(HiveConf.ConfVars.HIVE_EXEC_COPYFILE_MAXNUMFILES); maxCopyFileSize = hiveConf.getLongVar(HiveConf.ConfVars.HIVE_EXEC_COPYFILE_MAXSIZE); hiveInTest = hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST); this.copyAsUser = distCpDoAsUser; + this.destinationFs = destinationFs; } // Used by replication, copy files from source to destination. It is possible source file is // changed/removed during copy, so double check the checksum after copy, // if not match, copy again from cm - public void copyAndVerify(FileSystem destinationFs, Path destRoot, + public void copyAndVerify(Path destRoot, List<ReplChangeManager.FileInfo> srcFiles) throws IOException, LoginException, HiveFatalException { Map<FileSystem, Map< Path, List<ReplChangeManager.FileInfo>>> map = fsToFileMap(srcFiles, destRoot); UserGroupInformation proxyUser = getProxyUser(); try { for (Map.Entry<FileSystem, Map<Path, List<ReplChangeManager.FileInfo>>> entry : map.entrySet()) { - FileSystem sourceFs = entry.getKey(); Map<Path, List<ReplChangeManager.FileInfo>> destMap = entry.getValue(); for (Map.Entry<Path, List<ReplChangeManager.FileInfo>> destMapEntry : destMap.entrySet()) { Path destination = destMapEntry.getKey(); List<ReplChangeManager.FileInfo> fileInfoList = destMapEntry.getValue(); - boolean useRegularCopy = regularCopy(destinationFs, sourceFs, fileInfoList); + if (fileInfoList.isEmpty()) { Review comment: I think, handling this case is redundant if it doesn't exist today and it is dead code. Also, assert is the best way to represent such assumptions. I think, this is just a copy utility class which is expected to copy the list of source files to target directory. If at all any filtering to be done, it should be done before we make this map. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services