-
Notifications
You must be signed in to change notification settings - Fork 3.7k
branch-3.1: [opt](hive) Speed up Hive insert on partition tables using cache #58166 #58606 #58748 #58886
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
Merged
Conversation
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
…che#58166) 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
…les (apache#58606) ### Problem Reproduction Steps: Create a Hive Catalog, create an unpartitioned table, then insert data. The following failure occurs. ``` copy file failed: software.amazon.awssdk.services.s3.model.NoSuchKeyException: The specified key does not exist. (Service: S3, Status Code: 404, ``` The BE mistakenly treats non-partitioned tables as partitioned ones. For partitioned tables, the system always appends a folder suffix for each partition, organizing data into partition directories. However, non-partitioned tables do not require partition information. In this case, the BE incorrectly added a partition folder suffix for non-partitioned tables, causing the insert operation to fail. ### Solution - Skip setting partition information for non-partitioned tables in the BE. - Maintain current behavior for partitioned tables, including folder suffix handling. ### Result - Inserts into non-partitioned object storage tables succeed. - Partitioned tables continue to work as expected. This issue was introduced in apache#58166
…apache#58748) ### What problem does this PR solve? Followup apache#58166 In apache#58166, the edit log need record "modified partitions" and "new partitions" separately, so that non-master FE can correctly update the partition cache. Otherwise, some new partitions can not be queried in non-master FE after inserting.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
FE UT Coverage ReportIncrement line coverage |
Contributor
Author
|
LGTM |
zy-kkk
approved these changes
Dec 11, 2025
morrySnow
approved these changes
Dec 15, 2025
zy-kkk
added a commit
to zy-kkk/doris
that referenced
this pull request
Dec 25, 2025
…les using cache apache#58166 apache#58606 apache#58748 (apache#58886)" This reverts commit a5ce97a.
morrySnow
pushed a commit
that referenced
this pull request
Dec 25, 2025
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.
picked from #58166 #58606 #58748