[ 
https://issues.apache.org/jira/browse/HIVE-23351?focusedWorklogId=431151&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-431151
 ]

ASF GitHub Bot logged work on HIVE-23351:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/May/20 10:13
            Start Date: 06/May/20 10:13
    Worklog Time Spent: 10m 
      Work Description: pkumarsinha commented on a change in pull request #1004:
URL: https://github.com/apache/hive/pull/1004#discussion_r420680172



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplDumpTask.java
##########
@@ -144,6 +145,11 @@ public int execute() {
         if (shouldDump(previousValidHiveDumpPath)) {
           Path currentDumpPath = getCurrentDumpPath(dumpRoot, isBootstrap);
           Path hiveDumpRoot = new Path(currentDumpPath, 
ReplUtils.REPL_HIVE_BASE_DIR);
+          work.setCurrentDumpPath(currentDumpPath);
+          if (shouldDumpAuthorizationMetadata()) {
+            LOG.info("Dumping authorization data");
+            initiateAuthorizationDumpTask(currentDumpPath);

Review comment:
       If you don't return here, this will run only after current repl dump 
execution?
   What is the order of execution in the current case?

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplDumpTask.java
##########
@@ -170,6 +175,31 @@ public int execute() {
     return 0;
   }
 
+  private void initiateAuthorizationDumpTask(Path currentDumpPath) throws 
SemanticException, IOException {
+    if 
(RANGER_AUTHORIZER.equalsIgnoreCase(conf.getVar(HiveConf.ConfVars.REPL_AUTHORIZATION_PROVIDER_SERVICE)))
 {
+      Path rangerDumpRoot = new Path(currentDumpPath, 
ReplUtils.REPL_RANGER_BASE_DIR);
+      FileSystem fs = rangerDumpRoot.getFileSystem(conf);
+      if (fs.exists(new Path(rangerDumpRoot, 
ReplAck.RANGER_DUMP_ACKNOWLEDGEMENT.toString()))) {
+        LOG.info("Ranger Authorization Metadata is already exported at {} ", 
rangerDumpRoot);
+      } else {
+        LOG.info("Exporting Authorization Metadata at {} ", rangerDumpRoot);
+        RangerDumpWork rangerDumpWork = new RangerDumpWork(rangerDumpRoot, 
work.dbNameOrPattern);
+        Task<RangerDumpWork> rangerDumpTask = TaskFactory.get(rangerDumpWork, 
conf);
+        if (childTasks == null) {
+          childTasks = new ArrayList<>();
+        }
+        childTasks.add(rangerDumpTask);

Review comment:
       Not getting added to the DAG, how does it get executed? 

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplAck.java
##########
@@ -23,7 +23,9 @@
 public enum ReplAck {
     DUMP_ACKNOWLEDGEMENT("_finished_dump"),
     EVENTS_DUMP("_events_dump"),
-    LOAD_ACKNOWLEDGEMENT("_finished_load");
+    LOAD_ACKNOWLEDGEMENT("_finished_load"),
+    RANGER_DUMP_ACKNOWLEDGEMENT("_finished_ranger_dump"),

Review comment:
       We can use same DUMP_ACKNOWLEDGEMENT LOAD_ACKNOWLEDGEMENT

##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ranger/RangerBaseModelObject.java
##########
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.ql.exec.repl.ranger;
+
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Date;
+
+/** RangerBaseModelObject class to contain common attributes of Ranger Base 
object.
+*
+*/
+@JsonAutoDetect(getterVisibility=Visibility.NONE, 
setterVisibility=Visibility.NONE, fieldVisibility=Visibility.ANY)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+public class RangerBaseModelObject implements java.io.Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Long    id;
+    private String  guid;
+    private Boolean isEnabled;
+    private String  createdBy;
+    private String  updatedBy;
+    private Date    createTime;
+    private Date    updateTime;
+    private Long    version;
+
+    public RangerBaseModelObject() {
+        setIsEnabled(null);
+    }
+
+    public void updateFrom(RangerBaseModelObject other) {
+        setIsEnabled(other.getIsEnabled());
+    }
+
+    /**
+     * @return the id
+     */
+    public Long getId() {
+        return id;
+    }
+    /**
+     * @param id the id to set
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+    /**
+     * @return the guid
+     */
+    public String getGuid() {
+        return guid;
+    }
+    /**
+     * @param guid the guid to set
+     */
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+    /**
+     * @return the isEnabled
+     */
+    public Boolean getIsEnabled() {
+        return isEnabled;
+    }
+    /**
+     * @param isEnabled the isEnabled to set
+     */
+    public void setIsEnabled(Boolean isEnabled) {
+        this.isEnabled = isEnabled == null ? Boolean.TRUE : isEnabled;
+    }
+    /**
+     * @return the createdBy
+     */
+    public String getCreatedBy() {
+        return createdBy;
+    }
+    /**
+     * @param createdBy the createdBy to set
+     */
+    public void setCreatedBy(String createdBy) {
+        this.createdBy = createdBy;
+    }
+    /**
+     * @return the updatedBy
+     */
+    public String getUpdatedBy() {
+        return updatedBy;
+    }
+    /**
+     * @param updatedBy the updatedBy to set
+     */
+    public void setUpdatedBy(String updatedBy) {
+        this.updatedBy = updatedBy;
+    }
+    /**
+     * @return the createTime
+     */
+    public Date getCreateTime() {
+        return new Date(createTime.getTime());
+    }
+    /**
+     * @param createTime the createTime to set
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = new Date(createTime.getTime());
+    }
+    /**
+     * @return the updateTime
+     */
+    public Date getUpdateTime() {
+        return new Date(updateTime.getTime());
+    }
+    /**
+     * @param updateTime the updateTime to set
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = new Date(updateTime.getTime());
+    }
+    /**
+     * @return the version
+     */
+    public Long getVersion() {
+        return version;
+    }
+    /**
+     * @param version the version to set
+     */
+    public void setVersion(Long version) {
+        this.version = version;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        toString(sb);
+        return sb.toString();
+    }
+
+    public StringBuilder toString(StringBuilder sb) {
+        sb.append("id={").append(id).append("} ");
+        sb.append("guid={").append(guid).append("} ");
+        sb.append("isEnabled={").append(isEnabled).append("} ");
+        sb.append("createdBy={").append(createdBy).append("} ");
+        sb.append("updatedBy={").append(updatedBy).append("} ");
+        sb.append("createTime={").append(createTime).append("} ");
+        sb.append("updateTime={").append(updateTime).append("} ");
+        sb.append("version={").append(version).append("} ");
+
+        return sb;

Review comment:
       Format the code to align with existing code




----------------------------------------------------------------
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


Issue Time Tracking
-------------------

            Worklog Id:     (was: 431151)
    Remaining Estimate: 0h
            Time Spent: 10m

> Ranger Replication Scheduling
> -----------------------------
>
>                 Key: HIVE-23351
>                 URL: https://issues.apache.org/jira/browse/HIVE-23351
>             Project: Hive
>          Issue Type: Task
>            Reporter: Aasha Medhi
>            Assignee: Aasha Medhi
>            Priority: Major
>         Attachments: HIVE-23351.01.patch, HIVE-23351.02.patch, 
> HIVE-23351.03.patch
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to