Skip to content

branch-4.2: [fix](fe) Check automatic partition limit before creation - #69502

Merged
yiguolei merged 1 commit into
apache:branch-4.2from
mrhhsg:pick-69128-branch-4.2
Oct 23, 2026
Merged

yiguolei merged 1 commit into
apache:branch-4.2from
mrhhsg:pick-69128-branch-4.2

Conversation

@mrhhsg

@mrhhsg mrhhsg commented Oct 23, 2026

Copy link
Copy Markdown
Member

Summary

Cherry-picked from #69128 for branch-4.2.

Automatic partition creation previously checked max_auto_partition_num only after creating partitions, so an over-limit request could fail after leaving new partitions behind. This change counts only missing partition names under the table read lock and rejects an over-limit batch before creation. It also rechecks capacity under the table write lock before publishing each automatic partition, while preserving the existing behavior of explicit partition DDL.

Backport notes

The branch-4.2 implementation uses its existing AddPartitionClause API and JUnit 4 test conventions. If concurrent requests exhaust capacity during a batch, partitions already published within the limit can remain.

Tests

  • ./build.sh --fe (passed; FE Checkstyle: 0 violations).
  • ./run-fe-ut.sh --run 'org.apache.doris.service.FrontendServiceImplTest#testCreatePartitionRangeLimitDoesNotLeavePartitions+testCreatePartitionListLimitCountsOnlyNewPartitions+testCreatePartitionLimitIsRecheckedAtPublication' (3 passed, 0 failures, 0 errors).
  • git diff origin/branch-4.2...HEAD --check (passed).

### What problem does this PR solve?

Issue Number: None

Related PR: apache#69128

Problem Summary: Automatic partition creation checked max_auto_partition_num only after adding all requested partitions, so a rejected load could leave newly created partitions behind. Count missing partition names under the table read lock before the batch, and recheck capacity under the table write lock just before publishing each automatic partition. Existing-name requests at the limit remain valid; explicit partition DDL keeps its previous behavior. Under concurrent exhaustion, earlier within-limit partitions in a batch may remain.

Cherry-picked from apache#69128 onto branch-4.2. Resolve conflicts by retaining branch-4.2's AddPartitionClause API and JUnit 4 test conventions. The master-only adjacent row-binlog test is not included.

### Release note

Automatic partition requests exceeding max_auto_partition_num are rejected before creating partitions in the normal batch path.

### Check List (For Author)

- Test: FE build and Checkstyle; focused FE unit tests for range overflow, existing LIST partitions, and stale-precheck publication; git diff --check.
- Behavior changed: Yes. Over-limit automatic partition requests no longer leave newly created partitions in the normal batch path.
- Does this need documentation: No.

(cherry picked from commit 33c460d)
@mrhhsg

mrhhsg commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 2.17% (7/322) 🎉
Increment coverage report
Complete coverage report

@mrhhsg
mrhhsg marked this pull request as ready for review October 23, 2026 09:22
@mrhhsg
mrhhsg requested a review from yiguolei as a code owner October 23, 2026 09:22
@yiguolei
yiguolei merged commit eaf1c85 into apache:branch-4.2 Oct 23, 2026
36 of 37 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants