LuciferYang opened a new pull request, #10104:
URL: https://github.com/apache/paimon/pull/10104

   ### Purpose
   
   close #10103
   
   Buckets of a dynamic-bucket partition are owned by `bucket % numAssigners == 
assignId % numAssigners`. When `dynamic-bucket.max-buckets` is positive but 
does not admit an assigner's smallest owned bucket (`assignId % numAssigners`), 
that assigner owns no bucket at all. It then failed in a way that hid the 
cause: on a fresh partition `PartitionIndex.assign` ended in a random pick over 
its empty bucket list and threw an opaque `IllegalArgumentException: list is 
empty`, and `SimpleHashBucketAssigner` (the overwrite path, no index to load) 
was worse, because its constructor ignored the failed `loadNewBucket()` and 
silently defaulted to bucket 0, which belongs to another assigner. The value is 
only validated against `[1, MAX_DYNAMIC_BUCKETS]`, and the writer parallelism 
is not known at table-creation time, so this can only be caught at runtime.
   
   This fails fast with a message naming the option. `SimpleHashBucketAssigner` 
rejects a cap that leaves this assigner bucketless in its constructor, and 
`PartitionIndex.assign` reports the empty-bucket case instead of the opaque 
pick failure. `HashBucketAssigner` keeps accepting the configuration, because 
an assigner that already owns buckets beyond a later-lowered cap must keep 
serving them; only the genuinely bucketless case now fails clearly.
   
   ### Tests
   
   
`SimpleHashBucketAssignerTest#testRejectsMaxBucketsSmallerThanAssignerNumber`: 
a cap that does not admit the assigner's smallest owned bucket is rejected at 
construction (caps 2 and 3 for assigner id 3), while `-1` and the tightest 
legal cap are accepted. It fails against the pre-fix constructor, which did not 
throw.
   
   
`HashBucketAssignerTest#testAssignFailsDescriptivelyWhenAssignerOwnsNoBucket` 
and `#testFreshPartitionFailsDescriptivelyWhenAssignerOwnsNoBucket`: a 
bucketless assigner's assign throws a message containing 
`dynamic-bucket.max-buckets` rather than the opaque `list is empty`. Both fail 
against the pre-fix code with `IllegalArgumentException: list is empty`.
   
   `HashBucketAssignerTest#testAssignReusesLoadedBucketBeyondCap`: an assigner 
that already owns a loaded bucket beyond the cap keeps serving it instead of 
throwing, pinning the behavior the fix deliberately preserves.
   
   ### API and Format
   
   no
   
   ### Documentation
   
   no
   


-- 
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]

Reply via email to