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

   ### Background
   
   Auto-detect overwrite (`INSERT OVERWRITE ... PARTITION(*)`) creates 
temporary partitions for the partitions reached by the input rows. The FE 
snapshots their partition and tablet metadata under the table read lock and 
returns it to the BE. Unpartitioned temporary partitions have no partition 
boundary item.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #65282 (introduced the check), #65956 (backport to branch-4.1)
   PR Type: Bugfix
   
   Problem Summary:
   
   Auto-detect overwrite on an unpartitioned table can fail with a misleading 
concurrent-drop error even without any concurrent DDL. Allow its legitimate 
null partition item while retaining missing-partition and missing-item checks 
for partitioned tables. Most of the diff verifies real temporary-partition 
metadata and exercises repeated unpartitioned auto-detect overwrite.
   
   ### Details
   
   - **Frequency:** Reproduced deterministically in the local FE metadata test: 
snapshotting an unpartitioned overwrite temporary partition fails without 
concurrent DDL.
   - **Root cause:** `snapshotPartitionResult` unconditionally rejects a 
missing `PartitionItem`, although `SinglePartitionInfo` deliberately creates 
none for temporary partitions. `OlapTableSink.setPartitionKeys` already accepts 
that case and sends no boundary keys.
   - **Why existing tests missed it:** `FrontendServiceImplTest` covers dropped 
auto RANGE partitions, but not unpartitioned temporary snapshots. The 
auto-detect regression covers RANGE/LIST, while the unpartitioned regression 
previously used ordinary overwrite only.
   - **Fix:** Require a non-null item only when the partition type is not 
`UNPARTITIONED`. Keep the existing table lock and missing `Partition` checks 
unchanged.
   - **Other paths and branches:** The shared helper covers both 
snapshot-by-name and snapshot-by-id, in cloud and shared-nothing mode. The 
unconditional check is present on branch-4.1 and branch-4.2; branch-3.1 and 
branch-4.0 do not have this helper/check. No wire or persisted format changes.
   
   ### Testing
   
   - Added FE tests for a real unpartitioned temporary partition, RANGE/LIST 
boundary preservation, and missing RANGE/LIST items. On the compiled baseline, 
2 test methods ran: the unpartitioned case failed with the exact 
concurrent-drop error, while the RANGE/LIST positive and negative cases passed. 
On the candidate, both new methods and the existing missing-Partition guard 
test passed: 3 methods, 0 failures/errors/skips; the complete preset UT command 
exited successfully.
   - Updated `test_iot_unpartitioned_nereids` to exercise auto-detect overwrite 
with full and partial columns. Existing expected rows remain unchanged; SQL 
regression has not run: the isolated cluster build did not complete its 
third-party dependency download within a 180-second bounded attempt.
   
   ### Notes for Reviewers
   
   The missing-item check must not be removed for RANGE/LIST tables. A null 
item is allowed only for the unpartitioned case.
   
   ### Release note
   
   Fix auto-detect overwrite incorrectly reporting a concurrent partition drop 
for unpartitioned tables.
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Partially verified: SQL regression, cloud 
deployment, and mixed-version validation have not run.
   
   ### AI Disclosure
   
   - Tool: Codex
   - Generated: code, tests, and this description
   - Human review: not stated
   


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