You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/09/13 05:22:31 UTC

[GitHub] [hudi] yihua commented on a diff in pull request #5344: [HUDI-3879] Suppress exceptions that are not fatal in HoodieMetadataTableValidator

yihua commented on code in PR #5344:
URL: https://github.com/apache/hudi/pull/5344#discussion_r969160839


##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieMetadataTableValidator.java:
##########
@@ -465,18 +474,29 @@ public void doMetadataTableValidation() {
    * Check metadata is initialized and available to ready.
    * If not we will log.warn and skip current validation.
    */
-  private void checkMetadataTableIsAvailable() {
+  private boolean checkMetadataTableIsAvailable() {
     try {
       HoodieTableMetaClient mdtMetaClient = HoodieTableMetaClient.builder()
           .setConf(jsc.hadoopConfiguration()).setBasePath(new Path(cfg.basePath, HoodieTableMetaClient.METADATA_TABLE_FOLDER_PATH).toString())
           .setLoadActiveTimelineOnLoad(true)
           .build();
       int finishedInstants = mdtMetaClient.getActiveTimeline().filterCompletedInstants().countInstants();
       if (finishedInstants == 0) {
-        throw new HoodieValidationException("There is no completed instant for metadata table.");
+        if (metaClient.getActiveTimeline().filterCompletedInstants().countInstants() == 0) {
+          LOG.info("There is no completed instant both in metadata table and corresponding data table.");
+          return false;
+        } else {
+          throw new HoodieValidationException("There is no completed instant for metadata table.");
+        }
       }
+      return true;
+    } catch (TableNotFoundException tbe) {
+      // Suppress the TableNotFound exception if Metadata table is not available to read for now
+      LOG.warn("Meta data table is not found. Skip current validation.");

Review Comment:
   nit: `Meta data` -> `Metadata`



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org