hmangla98 commented on a change in pull request #2121:
URL: https://github.com/apache/hive/pull/2121#discussion_r674417311



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplDumpTask.java
##########
@@ -268,11 +329,35 @@ private boolean shouldDumpAtlasMetadata() {
     return conf.getBoolVar(HiveConf.ConfVars.REPL_INCLUDE_ATLAS_METADATA);
   }
 
-  private Path getCurrentDumpPath(Path dumpRoot, boolean isBootstrap) throws 
IOException {
+  private Path getCurrentDumpPath(Path dumpRoot, boolean isBootstrap) throws 
IOException, HiveException {
     Path lastDumpPath = ReplUtils.getLatestDumpPath(dumpRoot, conf);
     if (lastDumpPath != null && shouldResumePreviousDump(lastDumpPath, 
isBootstrap)) {
       //Resume previous dump
       LOG.info("Resuming the dump with existing dump directory {}", 
lastDumpPath);
+      FileSystem fs = lastDumpPath.getFileSystem(conf);
+      Path hiveDumpDir = new Path(lastDumpPath, ReplUtils.REPL_HIVE_BASE_DIR);
+      Path failoverMetadataFile = new Path(hiveDumpDir, 
FailoverMetaData.FAILOVER_METADATA);
+      Path failoverReadyMarkerFile = new Path(hiveDumpDir, 
ReplAck.FAILOVER_READY_MARKER.toString());
+      if (fs.exists(failoverReadyMarkerFile)) {
+        //If failoverReadyMarkerFile exists, this means previous dump 
iteration failed while creating dump ACK file.
+        //So, just delete this file and proceed further.
+        LOG.info("Deleting failover ready marker file: {} created in previous 
dump iteration.", failoverReadyMarkerFile);
+        fs.delete(failoverReadyMarkerFile, true);
+      }
+      if (fs.exists(failoverMetadataFile)) {
+        //If failoverMetadata file exists, this means previous dump iteration 
failed after writing failover metadata info
+        //Now, if the failover start config is enabled, then just use the same 
metadata in current iteration also.
+        //    Else just rollback failover initiated in previous failed dump 
iteration.
+        if (conf.getBoolVar(HiveConf.ConfVars.HIVE_REPL_FAILOVER_START)) {
+          FailoverMetaData fmd = new FailoverMetaData(hiveDumpDir, conf);
+          if (fmd.isValidMetadata()) {

Review comment:
       then, it would be recalculated in this dump iteration.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to