codope commented on code in PR #6862:
URL: https://github.com/apache/hudi/pull/6862#discussion_r1008990765


##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/DeltaSync.java:
##########
@@ -255,44 +255,72 @@ public DeltaSync(HoodieDeltaStreamer.Config cfg, 
SparkSession sparkSession, Sche
    */
   public void refreshTimeline() throws IOException {
     if (fs.exists(new Path(cfg.targetBasePath))) {
-      HoodieTableMetaClient meta = HoodieTableMetaClient.builder().setConf(new 
Configuration(fs.getConf())).setBasePath(cfg.targetBasePath).setPayloadClassName(cfg.payloadClassName).build();
-      switch (meta.getTableType()) {
-        case COPY_ON_WRITE:
-          this.commitTimelineOpt = 
Option.of(meta.getActiveTimeline().getCommitTimeline().filterCompletedInstants());
-          this.allCommitsTimelineOpt = 
Option.of(meta.getActiveTimeline().getAllCommitsTimeline());
-          break;
-        case MERGE_ON_READ:
-          this.commitTimelineOpt = 
Option.of(meta.getActiveTimeline().getDeltaCommitTimeline().filterCompletedInstants());
-          this.allCommitsTimelineOpt = 
Option.of(meta.getActiveTimeline().getAllCommitsTimeline());
-          break;
-        default:
-          throw new HoodieException("Unsupported table type :" + 
meta.getTableType());
+      try {
+        HoodieTableMetaClient meta = 
HoodieTableMetaClient.builder().setConf(new 
Configuration(fs.getConf())).setBasePath(cfg.targetBasePath).setPayloadClassName(cfg.payloadClassName).build();
+        switch (meta.getTableType()) {
+          case COPY_ON_WRITE:
+            this.commitTimelineOpt = 
Option.of(meta.getActiveTimeline().getCommitTimeline().filterCompletedInstants());
+            this.allCommitsTimelineOpt = 
Option.of(meta.getActiveTimeline().getAllCommitsTimeline());
+            break;
+          case MERGE_ON_READ:
+            this.commitTimelineOpt = 
Option.of(meta.getActiveTimeline().getDeltaCommitTimeline().filterCompletedInstants());
+            this.allCommitsTimelineOpt = 
Option.of(meta.getActiveTimeline().getAllCommitsTimeline());
+            break;
+          default:
+            throw new HoodieException("Unsupported table type :" + 
meta.getTableType());
+        }
+      } catch (HoodieIOException e) {
+        LOG.warn("Full exception msg " + e.getMessage());
+        if (e.getMessage().contains("Could not load Hoodie properties") && 
e.getMessage().contains(HoodieTableConfig.HOODIE_PROPERTIES_FILE)) {
+          String basePathWithForwardSlash = cfg.targetBasePath.endsWith("/") ? 
cfg.targetBasePath : String.format("%s/", cfg.targetBasePath);
+          boolean hoodiePropertiesExists = fs.exists(new 
Path(basePathWithForwardSlash))
+              && fs.exists(new Path(String.format("%s%s/%s", 
basePathWithForwardSlash, HoodieTableMetaClient.METAFOLDER_NAME, 
HoodieTableConfig.HOODIE_PROPERTIES_FILE)))
+              && fs.exists(new Path(String.format("%s%s/%s", 
basePathWithForwardSlash, HoodieTableMetaClient.METAFOLDER_NAME, 
HoodieTableConfig.HOODIE_PROPERTIES_FILE_BACKUP)));

Review Comment:
   Sounds good. The intention was to avoid extra fs.exists call, but within 
catch block it should be fine.



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

Reply via email to