[ https://issues.apache.org/jira/browse/HIVE-21314?focusedWorklogId=204056&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-204056 ]
ASF GitHub Bot logged work on HIVE-21314: ----------------------------------------- Author: ASF GitHub Bot Created on: 26/Feb/19 04:04 Start Date: 26/Feb/19 04:04 Worklog Time Spent: 10m Work Description: maheshk114 commented on pull request #549: HIVE-21314 : Hive Replication not retaining the owner in the replicated table URL: https://github.com/apache/hive/pull/549#discussion_r260118275 ########## File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ExternalTableCopyTaskBuilder.java ########## @@ -54,14 +59,53 @@ List<Task<? extends Serializable>> tasks(TaskTracker tracker) { List<Task<? extends Serializable>> tasks = new ArrayList<>(); Iterator<DirCopyWork> itr = work.getPathsToCopyIterator(); - while (tracker.canAddMoreTasks() && itr.hasNext()) { + int numTaskCanBeAdded = tracker.numTaskCanBeAdded(); + Task<? extends Serializable> barrierTask = TaskFactory.get(new DependencyCollectionWork(), conf); + while (numTaskCanBeAdded-- > 0 && itr.hasNext()) { DirCopyWork dirCopyWork = itr.next(); Task<DirCopyWork> task = TaskFactory.get(dirCopyWork, conf); tasks.add(task); - tracker.addTask(task); + barrierTask.addDependentTask(task); LOG.debug("added task for {}", dirCopyWork); } - return tasks; + + if (!tasks.isEmpty()) { + tracker.addDependentTask(barrierTask); + tracker.addTaskList(tasks); + return Collections.singletonList(barrierTask); + } else { + return tasks; + } + } + + private static Integer setTargetPathOwnerInt(Path targetPath, Path sourcePath, HiveConf conf) throws IOException { + FileSystem targetFs = targetPath.getFileSystem(conf); + if (!targetFs.exists(targetPath)) { + targetFs.create(targetPath); + } + FileStatus status = sourcePath.getFileSystem(conf).getFileStatus(sourcePath); + if (status == null) { + throw new IOException("source path missing " + sourcePath); + } + targetPath.getFileSystem(conf).setOwner(targetPath, status.getOwner(), status.getGroup()); + return null; + } + + private static Integer setTargetPathOwner(Path targetPath, Path sourcePath, HiveConf conf, String distCpDoAsUser) + throws IOException { + if (distCpDoAsUser == null) { Review comment: same as distcp below ..i think better to handle it ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 Issue Time Tracking ------------------- Worklog Id: (was: 204056) Time Spent: 1.5h (was: 1h 20m) > Hive Replication not retaining the owner in the replicated table > ---------------------------------------------------------------- > > Key: HIVE-21314 > URL: https://issues.apache.org/jira/browse/HIVE-21314 > Project: Hive > Issue Type: Bug > Reporter: mahesh kumar behera > Assignee: mahesh kumar behera > Priority: Major > Labels: pull-request-available > Attachments: HIVE-21314.01.patch > > Time Spent: 1.5h > Remaining Estimate: 0h > > Hive Replication not retaining the owner in the replicated table. The owner > for the target table is set same as the user executing the load command. The > user information should be read from the dump metadata and should be used > while creating the table at target cluster. -- This message was sent by Atlassian JIRA (v7.6.3#76005)