pkumarsinha commented on a change in pull request #1004:
URL: https://github.com/apache/hive/pull/1004#discussion_r422175531
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplLoadTask.java
##########
@@ -103,13 +105,43 @@ public int execute() {
}
work.setRootTask(this);
this.parentTasks = null;
+ if (shouldLoadAuthorizationMetadata()) {
+ LOG.info("Loading authorization data");
+ try {
+ initiateAuthorizationLoadTask(work.dumpDirectory);
+ } catch (Exception e) {
+ LOG.error("failed", e);
+ setException(e);
+ return ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode();
+ }
+ }
if (work.isIncrementalLoad()) {
return executeIncrementalLoad();
} else {
return executeBootStrapLoad();
}
}
+ private boolean shouldLoadAuthorizationMetadata() {
+ return
conf.getBoolVar(HiveConf.ConfVars.REPL_INCLUDE_AUTHORIZATION_METADATA);
+ }
+
+ private void initiateAuthorizationLoadTask(String hiveDumpDirectory) throws
SemanticException {
+ if
(RANGER_AUTHORIZER.equalsIgnoreCase(conf.getVar(HiveConf.ConfVars.REPL_AUTHORIZATION_PROVIDER_SERVICE)))
{
+ Path rangerLoadRoot = new Path(new Path(hiveDumpDirectory).getParent(),
ReplUtils.REPL_RANGER_BASE_DIR);
+ LOG.info("Importing Authorization Metadata from {} ", rangerLoadRoot);
+ RangerLoadWork rangerLoadWork = new RangerLoadWork(rangerLoadRoot,
work.getSourceDbName(), work.dbNameToLoadIn);
+ Task<RangerLoadWork> rangerLoadTask = TaskFactory.get(rangerLoadWork,
conf);
+ if (childTasks == null) {
+ childTasks = new ArrayList<>();
+ }
+ childTasks.add(rangerLoadTask);
Review comment:
Metadata will run as a part of current task.
if (work.isIncrementalLoad()) {
return executeIncrementalLoad();
} else {
return executeBootStrapLoad();
}
in either bootstrap or in incremental, this will run it as part of current
ReplLoadTask
----------------------------------------------------------------
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]