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

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

                Author: ASF GitHub Bot
            Created on: 13/Mar/20 10:17
            Start Date: 13/Mar/20 10:17
    Worklog Time Spent: 10m 
      Work Description: maheshk114 commented on pull request #949: HIVE-22990 
Add file based ack for replication
URL: https://github.com/apache/hive/pull/949#discussion_r392089082
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplDumpTask.java
 ##########
 @@ -126,21 +126,30 @@ public int execute() {
       Path dumpRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLDIR),
               
Base64.getEncoder().encodeToString(work.dbNameOrPattern.toLowerCase()
                       .getBytes(StandardCharsets.UTF_8.name())));
-      Path currentDumpPath = new Path(dumpRoot, getNextDumpDir());
-      Path hiveDumpRoot = new Path(currentDumpPath, 
ReplUtils.REPL_HIVE_BASE_DIR);
-      DumpMetaData dmd = new DumpMetaData(hiveDumpRoot, conf);
-      // Initialize ReplChangeManager instance since we will require it to 
encode file URI.
-      ReplChangeManager.getInstance(conf);
-      Path cmRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLCMDIR));
-      Long lastReplId;
-      if (!dumpRoot.getFileSystem(conf).exists(dumpRoot)
-              || dumpRoot.getFileSystem(conf).listStatus(dumpRoot).length == 
0) {
-        lastReplId = bootStrapDump(hiveDumpRoot, dmd, cmRoot, hiveDb);
+      Path previousDumpMetaPath = getPreviousDumpMetadataPath(dumpRoot);
+      Path previousHiveDumpPath =
+              previousDumpMetaPath != null ? new Path(previousDumpMetaPath, 
ReplUtils.REPL_HIVE_BASE_DIR) : null;
+      //If no previous dump is present or previous dump was loaded, proceed
+      if (shouldDump(previousHiveDumpPath)) {
+        Path currentDumpPath = new Path(dumpRoot, getNextDumpDir());
+        Path hiveDumpRoot = new Path(currentDumpPath, 
ReplUtils.REPL_HIVE_BASE_DIR);
+        DumpMetaData dmd = new DumpMetaData(hiveDumpRoot, conf);
+        // Initialize ReplChangeManager instance since we will require it to 
encode file URI.
+        ReplChangeManager.getInstance(conf);
+        Path cmRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLCMDIR));
+        Long lastReplId;
+        if (previousHiveDumpPath == null) {
+          lastReplId = bootStrapDump(hiveDumpRoot, dmd, cmRoot, hiveDb);
+        } else {
+          
work.setEventFrom(getEventFromPreviousDumpMetadata(previousHiveDumpPath));
+          lastReplId = incrementalDump(hiveDumpRoot, dmd, cmRoot, hiveDb);
+        }
+        prepareReturnValues(Arrays.asList(currentDumpPath.toUri().toString(), 
String.valueOf(lastReplId)));
+        writeDumpCompleteAck(hiveDumpRoot);
+        deletePreviousDumpMeta(previousDumpMetaPath);
 
 Review comment:
   what if delete fails /system goes down after the dump ..how to cleanup the 
previous dump directory ?
 
----------------------------------------------------------------
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]


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

    Worklog Id:     (was: 402771)
    Time Spent: 50m  (was: 40m)

> Build acknowledgement mechanism for repl dump and load
> ------------------------------------------------------
>
>                 Key: HIVE-22990
>                 URL: https://issues.apache.org/jira/browse/HIVE-22990
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Aasha Medhi
>            Assignee: Aasha Medhi
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-22990.01.patch, HIVE-22990.02.patch, 
> HIVE-22990.03.patch, HIVE-22990.04.patch, HIVE-22990.05.patch, 
> HIVE-22990.06.patch, HIVE-22990.07.patch, HIVE-22990.08.patch, 
> HIVE-22990.09.patch, HIVE-22990.10.patch, HIVE-22990.11.patch, 
> HIVE-22990.12.patch, HIVE-22990.patch
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>




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

Reply via email to