Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HUDI-6998] Fix drop table failure when load table as spark v2 table whose path is delete #9932

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

wecharyu
Copy link
Contributor

Change Logs

We will first try to load schema from hoodie meta client since HUDI-6219, it will throw exception if table directory does not exists, in which case we are unable to drop this hudi table.

20887 [ScalaTest-run-running-TestDropTable] WARN  org.apache.spark.sql.catalyst.catalog.HoodieCatalogTable [] - Failed to load table schema from meta client.
org.apache.hudi.exception.TableNotFoundException: Hoodie table not found in path file:/private/var/folders/6j/vkbrdtgd0x34sqjzgv7s8ckh0000gy/T/spark-8a41e162-dfab-4843-afcd-bb672628747d/h0/.hoodie
	at org.apache.hudi.exception.TableNotFoundException.checkTableValidity(TableNotFoundException.java:57) ~[classes/:?]
	at org.apache.hudi.common.table.HoodieTableMetaClient.<init>(HoodieTableMetaClient.java:149) ~[classes/:?]
	at org.apache.hudi.common.table.HoodieTableMetaClient.newMetaClient(HoodieTableMetaClient.java:734) ~[classes/:?]
	at org.apache.hudi.common.table.HoodieTableMetaClient.access$000(HoodieTableMetaClient.java:91) ~[classes/:?]
	at org.apache.hudi.common.table.HoodieTableMetaClient$Builder.build(HoodieTableMetaClient.java:825) ~[classes/:?]
	at org.apache.spark.sql.catalyst.catalog.HoodieCatalogTable.metaClient$lzycompute(HoodieCatalogTable.scala:85) ~[classes/:3.2.3]
	at org.apache.spark.sql.catalyst.catalog.HoodieCatalogTable.metaClient(HoodieCatalogTable.scala:83) ~[classes/:3.2.3]
	at org.apache.spark.sql.catalyst.catalog.HoodieCatalogTable.loadTableSchemaByMetaClient(HoodieCatalogTable.scala:322) ~[classes/:3.2.3]
	at org.apache.spark.sql.catalyst.catalog.HoodieCatalogTable.tableSchema$lzycompute(HoodieCatalogTable.scala:138) ~[classes/:3.2.3]
	at org.apache.spark.sql.catalyst.catalog.HoodieCatalogTable.tableSchema(HoodieCatalogTable.scala:137) ~[classes/:3.2.3]
	at org.apache.spark.sql.hudi.catalog.HoodieInternalV2Table.tableSchema$lzycompute(HoodieInternalV2Table.scala:57) ~[classes/:?]
	at org.apache.spark.sql.hudi.catalog.HoodieInternalV2Table.tableSchema(HoodieInternalV2Table.scala:57) ~[classes/:?]
	at org.apache.spark.sql.hudi.catalog.HoodieInternalV2Table.schema(HoodieInternalV2Table.scala:61) ~[classes/:?]
	at org.apache.spark.sql.catalyst.analysis.ResolvedTable$.create(v2ResolutionPlans.scala:156) ~[spark-catalyst_2.12-3.2.3.jar:3.2.3]
	at org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveRelations$.$anonfun$lookupTableOrView$1(Analyzer.scala:1232) ~[spark-catalyst_2.12-3.2.3.jar:3.2.3]
...

To prevent this issue, we produce catch and log exception when load table schema by meta client.

Impact

Fix drop table error.

Risk level (write none, low medium or high below)

None.

Documentation Update

Describe any necessary documentation update if there is any new feature, config, or user-facing change

  • The config description must be updated if new configs are added or the default value of the configs are changed
  • Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
    ticket number here and follow the instruction to make
    changes to the website.

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@hudi-bot
Copy link

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@@ -335,6 +335,11 @@ class HoodieCatalogTable(val spark: SparkSession, var table: CatalogTable) exten
}.partition(f => partitionFields.contains(f.name))
StructType(dataFields ++ partFields)
})
catch {
case cause: Throwable =>
logWarning("Failed to load table schema from meta client.", cause)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we ignore all the exceptions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function returns Option value, and we log the details of exception here, so I think it's OK to handle for all exceptions.

@danny0405 danny0405 merged commit c7320f7 into apache:master Oct 31, 2023
27 of 28 checks passed
LXin96 pushed a commit to LXin96/hudi that referenced this pull request Nov 2, 2023
nsivabalan pushed a commit that referenced this pull request Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants