Skip to content

[MINOR] Check for the .hoodie folder before loading a Hudi meta client - #1031

Open
the-other-tim-brown wants to merge 3 commits into
apache:mainfrom
the-other-tim-brown:perf/hudi-missing-table-check
Open

the-other-tim-brown wants to merge 3 commits into
apache:mainfrom
the-other-tim-brown:perf/hudi-missing-table-check

Conversation

@the-other-tim-brown

Copy link
Copy Markdown
Contributor

What is the purpose of the pull request

Every first sync to a new Hudi target waited about 5 seconds for nothing.

HudiTableManager.loadTableMetaClientIfExists and HudiBackedSecondaryIndexUtils.getMetaClient find out a table is missing by catching TableNotFoundException. In Hudi 1.x that exception is thrown only after HoodieTableConfig has tried to read hoodie.properties and its backup 5 times, sleeping 1 second between attempts (ConfigUtils.fetchConfigs). A wall-clock profile with async-profiler showed this sleep as the single largest cost in the Hudi target ITs.

Hudi's own writers check for the .hoodie folder before they build a meta client: FSUtils.isTableExists, HoodieSparkSqlWriter and Flink's StreamerUtil.tableExists. This PR does the same.

Brief change log

  • Add HudiTableManager.metaFolderExists, which delegates to Hudi's FSUtils.isTableExists.
  • loadTableMetaClientIfExists returns empty, and HudiBackedSecondaryIndexUtils.getMetaClient throws TableNotFoundException, without waiting for the retries. Existing callers are unchanged.
  • A table whose .hoodie folder already exists still goes through Hudi's retry path, which is there to handle concurrent updates to the properties file.

Local results, with 4 JUnit threads:

  • ITHudiConversionTarget: 105.8s → 30.5s.
  • The "Could not read properties" warnings, one pair per retry, drop to 0 in three IT classes:
before after
ITConversionController 340 0
ITHudiBackedSecondaryIndex 250 0
ITHudiConversionTarget 140 0

Verify this pull request

This pull request is already covered by existing tests: ITHudiConversionTarget, ITHudiBackedSecondaryIndex, ITConversionController and TestHudiTableManager.

🤖 Generated with Claude Code

Hudi only reports a missing table after retrying the read of hoodie.properties
five times with one-second sleeps, so every first sync to a new Hudi target
waited ~5s. Check for the .hoodie folder first, as Hudi's own writers do
(FSUtils.isTableExists).

This branch has not been deployed

No deployments
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.

1 participant