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

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

                Author: ASF GitHub Bot
            Created on: 06/Aug/20 17:31
            Start Date: 06/Aug/20 17:31
    Worklog Time Spent: 10m 
      Work Description: pkumarsinha commented on a change in pull request #1358:
URL: https://github.com/apache/hive/pull/1358#discussion_r466574279



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/AtlasDumpTask.java
##########
@@ -132,31 +130,40 @@ private AtlasReplInfo createAtlasReplInfo() throws 
SemanticException, MalformedU
 
   private long lastStoredTimeStamp() throws SemanticException {
     Path prevMetadataPath = new Path(work.getPrevAtlasDumpDir(), 
EximUtil.METADATA_NAME);
-    BufferedReader br = null;
+    Retryable retryable = Retryable.builder()
+      .withHiveConf(conf)
+      .withRetryOnException(IOException.class)
+      .withFailOnException(FileNotFoundException.class).build();
     try {
-      FileSystem fs = prevMetadataPath.getFileSystem(conf);
-      br = new BufferedReader(new InputStreamReader(fs.open(prevMetadataPath), 
Charset.defaultCharset()));
-      String line = br.readLine();
-      if (line == null) {
-        throw new SemanticException("Could not read lastStoredTimeStamp from 
atlas metadata file");
-      }
-      String[] lineContents = line.split("\t", 5);
-      return Long.parseLong(lineContents[1]);
-    } catch (Exception ex) {
-      throw new SemanticException(ex);
-    } finally {
-      if (br != null) {
+      return retryable.executeCallable(() -> {
+        BufferedReader br = null;
         try {
-          br.close();
-        } catch (IOException e) {
-          throw new SemanticException(e);
+          FileSystem fs = prevMetadataPath.getFileSystem(conf);
+          br = new BufferedReader(new 
InputStreamReader(fs.open(prevMetadataPath), Charset.defaultCharset()));
+          String line = br.readLine();
+          if (line == null) {
+            throw new 
SemanticException(ErrorMsg.REPL_INVALID_CONFIG_FOR_SERVICE
+              .format("Could not read lastStoredTimeStamp from atlas metadata 
file", "atlas"));
+          }
+          String[] lineContents = line.split("\t", 5);
+          return Long.parseLong(lineContents[1]);
+        } finally {
+          if (br != null) {
+            try {
+              br.close();
+            } catch (IOException e) {
+              //Do nothing
+            }
+          }
         }
-      }
+      });
+    } catch (Exception e) {
+      throw new 
SemanticException(ErrorMsg.REPL_RETRY_EXHAUSTED.format(e.getMessage()), e);

Review comment:
       yes, here we are catching as that, I was referring to line 144:if (line 
== null) {
               throw new 
SemanticException(ErrorMsg.REPL_INVALID_CONFIG_FOR_SERVICE
                 .format("Could not read lastStoredTimeStamp from atlas 
metadata file", "atlas"));
             }
   where we are throwing SemanticException already which we catch here, can't 
we just throw the same e in that case?




----------------------------------------------------------------
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: 467447)
    Time Spent: 1h 10m  (was: 1h)

> Classification of Error Codes in Replication
> --------------------------------------------
>
>                 Key: HIVE-23955
>                 URL: https://issues.apache.org/jira/browse/HIVE-23955
>             Project: Hive
>          Issue Type: Task
>            Reporter: Aasha Medhi
>            Assignee: Aasha Medhi
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-23955.01.patch, HIVE-23955.02.patch, Retry Logic 
> for Replication.pdf
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>




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

Reply via email to