aasha commented on a change in pull request #1358:
URL: https://github.com/apache/hive/pull/1358#discussion_r466544742



##########
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 but this is of type exception




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to