branch-4.0: [opt](hive) Speed up Hive insert on partition tables using cache #58166#58540
Merged
yiguolei merged 1 commit intobranch-4.0from Dec 2, 2025
Merged
branch-4.0: [opt](hive) Speed up Hive insert on partition tables using cache #58166#58540yiguolei merged 1 commit intobranch-4.0from
yiguolei merged 1 commit intobranch-4.0from
Conversation
) ### What problem does this PR solve? For Hive tables with massive partitions (10K+), INSERT operations are extremely slow because: - FE fetches all partition metadata from HMS directly (expensive RPC calls) - Full table cache invalidation after each insert (unnecessary) Problem Summary: 1. **Use cache for partition metadata in INSERT** - FE now fetches partition info from cache instead of directly querying HMS when preparing INSERT - Avoid expensive HMS RPC calls for every INSERT operation 2. **Selective cache refresh after commit** - Only invalidate affected partitions instead of full table cache - Based on partition update info from BE (NEW/APPEND/OVERWRITE) - Significantly reduces cache invalidation overhead 3. **Handle cache inconsistency gracefully** - When BE marks partition as NEW but it already exists in HMS (cache miss) - FE detects this by checking HMS and treats it as APPEND instead of failing - Prevents `AlreadyExistsException` errors For tables with partitions: - **Before**: HMS calls per INSERT + full cache invalidation - **After**: cache lookup + selective partition refresh - Expected speedup: 10x-100x for partition metadata fetching phas
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
yiguolei
approved these changes
Dec 2, 2025
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.
Cherry-picked from #58166