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

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

                Author: ASF GitHub Bot
            Created on: 18/May/20 14:33
            Start Date: 18/May/20 14:33
    Worklog Time Spent: 10m 
      Work Description: pkumarsinha commented on a change in pull request #1021:
URL: https://github.com/apache/hive/pull/1021#discussion_r426671412



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/AtlasDumpTask.java
##########
@@ -0,0 +1,91 @@
+/*
+ * 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;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.ErrorMsg;
+import org.apache.hadoop.hive.ql.exec.Task;
+import org.apache.hadoop.hive.ql.exec.repl.atlas.AtlasProcess;
+import org.apache.hadoop.hive.ql.exec.repl.atlas.AtlasReplInfo;
+import org.apache.hadoop.hive.ql.exec.repl.atlas.AtlasExportProcess;
+import org.apache.hadoop.hive.ql.parse.EximUtil;
+import org.apache.hadoop.hive.ql.parse.SemanticException;
+import org.apache.hadoop.hive.ql.parse.repl.dump.Utils;
+import org.apache.hadoop.hive.ql.plan.api.StageType;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Atlas Metadata Replication Task.
+ **/
+public class AtlasDumpTask extends Task<AtlasDumpWork> implements Serializable 
{
+
+  private static final long serialVersionUID = 1L;
+
+  @Override
+  public int execute() {
+    try {
+      AtlasReplInfo atlasReplInfo = work.getAtlasReplInfo();
+      LOG.info("Dumping Atlas metadata of srcDb: {}, for TgtDb: {} to staging 
location:",
+              atlasReplInfo.getSrcDB(), atlasReplInfo.getTgtDB(), 
atlasReplInfo.getStagingDir());
+      AtlasProcess atlasProcess = new AtlasExportProcess();
+      String entityGuid = 
atlasProcess.checkHiveEntityGuid(atlasReplInfo.getAtlasEndpoint(),
+              atlasReplInfo.getSrcCluster(), atlasReplInfo.getSrcDB(), conf);
+      long currentModifiedTime = 
atlasProcess.getCurrentTimestamp(atlasReplInfo, entityGuid);
+      atlasProcess.run(atlasReplInfo);
+      createDumpMetadata(atlasReplInfo, currentModifiedTime);
+      return 0;
+    } catch (Exception e) {
+      LOG.error("Exception during AtlasDumpTask.execute", e);
+      setException(e);
+      return ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode();
+    }
+  }
+
+  private void createDumpMetadata(AtlasReplInfo atlasReplInfo, long 
lastModifiedTime) throws SemanticException {
+    Path dumpFile = new Path(atlasReplInfo.getStagingDir(), 
EximUtil.METADATA_NAME);
+    List<List<String>> listValues = new ArrayList<>();
+    listValues.add(
+            Arrays.asList(
+                    atlasReplInfo.getSrcFsUri(),
+                    String.valueOf(lastModifiedTime)
+            )
+    );
+    Utils.writeOutput(listValues, dumpFile, conf, true);

Review comment:
       yes




----------------------------------------------------------------
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: 434415)
    Time Spent: 1.5h  (was: 1h 20m)

> Atlas metadata replication scheduling
> -------------------------------------
>
>                 Key: HIVE-23353
>                 URL: https://issues.apache.org/jira/browse/HIVE-23353
>             Project: Hive
>          Issue Type: Task
>            Reporter: PRAVIN KUMAR SINHA
>            Assignee: PRAVIN KUMAR SINHA
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-23353.01.patch
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>




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

Reply via email to