gavinchou opened a new pull request, #61576:
URL: https://github.com/apache/doris/pull/61576

   ## Proposed changes
   
   Add a new FE config `max_bucket_num_per_partition` to limit the maximum 
number of buckets when creating a table or adding a partition.
   
   ### Changes:
   1. Add `max_bucket_num_per_partition` config in Config.java, defaulting to 
`autobucket_max_buckets` (128) for consistency.
   2. Add bucket number validation in `DistributionDescriptor.validate()` for 
CREATE TABLE scenario.
   3. Add bucket number validation in `InternalCatalog.addPartition()` for 
ALTER TABLE ADD PARTITION scenario.
   4. Add unit tests for the new validation logic.
   
   ### Behavior:
   - For user-specified buckets (CREATE TABLE / ALTER TABLE ADD PARTITION): if 
bucket number exceeds this limit, the operation will be rejected with a helpful 
error message.
   - For auto-bucket feature (Dynamic Partition): bucket number is capped by 
`autobucket_max_buckets` automatically, no change.
   - Set to 0 or negative value to disable this limit.
   
   ### Error message example:
   ```
   Number of buckets (200) exceeds the maximum allowed value (128). 
   Generally, a large number of buckets is not needed. 
   If you have a specific use case requiring more buckets, 
   please review your schema design or modify the FE config 
   'max_bucket_num_per_partition' to adjust this limit.
   ```
   
   ## Test plan
   
   - [x] Unit tests added in `DistributionDescriptorTest.java`
   - [x] Verify CREATE TABLE with bucket number exceeding limit is rejected
   - [x] Verify ALTER TABLE ADD PARTITION with bucket number exceeding limit is 
rejected
   - [x] Verify auto-bucket is not affected by this limit
   - [x] Verify setting config to 0 disables the limit


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to