[refactor](fe) Modularize external metadata cache - #66382
Draft
924060929 wants to merge 2 commits into
Draft
Conversation
### What problem does this PR solve? Issue Number: None Related PR: apache#65126 Problem Summary: External metadata caching had parallel implementations in FE core and connector modules, which duplicated cache policy, statistics, invalidation, and concurrency behavior. Introduce an implementation-free MetaCache SPI module and a shared Caffeine-backed runtime module, move the common lifecycle and entry machinery into them, and keep only FE-specific catalog routing, configuration, refresh orchestration, edit-log integration, and schema validation in FE core. Migrate Hive, HMS, Iceberg, Paimon, and MaxCompute consumers to the single shared implementation while preserving refresh, scoped invalidation, bulk-load generation fences, and plugin class identity. ### Release note None ### Check List (For Author) - Test: Unit Test and FE build - SPI and shared runtime unit tests - FE metadata cache and refresh unit tests - Affected connector cache unit tests and plugin package/install - ./build.sh --fe -j8 - Behavior changed: No - Does this need documentation: No
### What problem does this PR solve? Issue Number: None Related PR: apache#65126 Problem Summary: The shared MetaCache runtime selected FE defaults for the connector-facing convenience constructor and did not advance its publication generations for guarded bulk values. Source-migrated connector caches could unexpectedly enable automatic refresh and manual miss loading, while an older manual load, exact-key action, or refresh admitted before a guarded bulk result could outlive that result and publish stale cache or auxiliary state. Restore the documented connector defaults and make guarded values participate in the existing short generation protocol. ### Release note None ### Check List (For Author) - Test: Unit Test - All seven MetaCache runtime test classes (87 tests) - CachingHmsClientTest (23 tests) - Full FE build with ./build.sh --fe -j8 - Behavior changed: Yes. Restore connector constructor defaults and fence older admitted cache publications after guarded bulk puts. - Does this need documentation: No
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
Author
|
/review |
Contributor
There was a problem hiding this comment.
Reviewed the full PR; there was no additional user-provided focus beyond the whole change. I found no PR-introduced correctness issue that warrants an inline comment.
Checkpoint conclusions:
- Goal and tests: The new JDK-only SPI plus shared Caffeine runtime matches the stated behavior-preserving modularization. The relocated and added tests cover cache policy, registry/lifecycle, concurrency/deadlock, compatibility, and connector consumers; the nested modules remain in the standard FE
-amreactor path. - Scope and focus: Reviewed all 81 authoritative changed paths plus the required upstream/downstream lifecycle, classloader, assembly, configuration, metadata-stats, and test-runner paths. No extra review focus was supplied.
- Concurrency: Traced manual miss loading, async refresh, public mutation, exact-key actions, invalidation, synchronous removal, and HMS bulk publication. The new coordination preserves the moved FE implementation's invalidation and mutation fences without introducing a new deadlock or lost-side-effect path. A possible same-key HMS completion-order race was checked against the deleted implementation and unchanged caller and dismissed as pre-existing, not introduced here.
- Lifecycle and persistence: Catalog create/init, ordinary REFRESH, ALTER/reset, replay, drop/removal, routing, schema validation, index cleanup, and cache close ownership retain their prior distinctions. No transaction or external write path is changed.
- Configuration and edge conditions: FE configuration is explicitly injected across the module boundary, compatibility overlays remain intact, and enabled/disabled, zero/no-expiry TTL, contextual-only, auto-refresh, and cold/hot entry cases retain their intended behavior.
- Compatibility and parallel paths: Current/previous FE-plugin directions resolve the intended runtime through the parent-first connector namespace with plugin fallback, and the inspected assemblies ship the SPI/runtime and appropriate Caffeine dependency. Hive/HMS, Iceberg, Paimon, MaxCompute, default FE, and Doris-engine cache paths were all traced.
- Observability and performance: The shared stats contract remains wired into metadata reporting. The refactor preserves the existing bounded stripe/publication model and does not introduce an identified hot-path or cache-capacity regression.
- Other issues: Repository-wide checks found no remaining old package/artifact consumer, reflective/build reference, or parallel implementation left behind.
This was a static-only review as required by the review instructions; I did not run local builds or tests.
Contributor
TPC-H: Total hot run time: 28733 ms |
Contributor
TPC-DS: Total hot run time: 169704 ms |
Contributor
ClickBench: Total hot run time: 24.06 s |
Contributor
FE Regression Coverage ReportIncrement line coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: None
Related PR: #65126
Problem Summary: External metadata caching currently has parallel implementations in FE core and connector
modules. Cache policy, statistics, invalidation, lifecycle, and concurrency behavior are therefore duplicated,
while connector implementations still depend on FE-owned concepts.
This PR introduces an implementation-free MetaCache SPI module and a shared Caffeine-backed runtime module.
Common lifecycle, entry, registry, statistics, invalidation, and ID/name coordination are moved into these
modules. FE core retains only FE-specific catalog routing, configuration injection, refresh orchestration,
edit-log integration, and schema validation. Hive, HMS, Iceberg, Paimon, and MaxCompute consumers are migrated
to the shared implementation.
The refactor preserves the existing connector constructor policy and the guarded bulk-load contract. A guarded
bulk publication participates in the same short generation protocol as manual miss loads, exact-key actions, and
asynchronous refreshes, while REFRESH/flush invalidation continues to win without holding a publication monitor
during external I/O.
Release note
None
Check List (For Author)
Test
CachingHmsClientTest: 23 tests./build.sh --fe -j8Behavior changed:
invalidation, bulk-load generation-fence, and plugin class-identity behavior.
Does this need documentation?
Check List (For Reviewer who merge this PR)