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

   ### Background
   
   Iceberg retains historical partition specifications; each data or delete 
file keeps the spec under which it was written. Partitioned asynchronous 
materialized views derive Doris ranges from those files and record source 
versions for refresh. Branch-4.2 uses native and HMS Iceberg adapters for this 
metadata.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #71365 (same fix on master), #44726 (introduced the all-spec 
eligibility rule)
   PR Type: Bugfix
   
   Problem Summary:
   
   Partitioned MV creation or refresh rejects tables retaining an unused 
unpartitioned spec or using DATE identity partitions, even when live files have 
compatible ranges. Cherry-pick the master fix and adapt its snapshot-bound 
qualification and range building to branch-4.2. The shared SDK algorithm is 
byte-identical; native/HMS adapters preserve captured authentication, cache 
admission and pre-lock refresh materialization.
   
   ### Details
   
   - **Change map:** Production +433/-119 lines; tests +954/-81; no generated, 
build or documentation changes. Tests account for most additions.
   
     | Part | Size | Purpose |
     | --- | --- | --- |
     | Shared SDK helper | +233 | Reuse master's live data/delete spec 
classification. |
     | Snapshot/range adapter | +121/-61 | Preserve lazy generation-bound views 
and normalize DATE identity. |
     | Native/HMS refresh integration | +67/-55 | Replace cross-generation 
validity flags with pinned qualification and a private view prepared before 
locks. |
     | CREATE resource lifetime | +12/-3 | Keep metadata leases through 
descriptor preparation and close direct/forwarded commands on success or 
failure. |
   
   - **Frequency:** Always in the reproduced v2 unpartitioned → DATE identity → 
day history after all live files are rewritten while old specs/snapshots 
remain. Live DATE identity also fails in the previous range builder.
   - **Root cause:** Eligibility checks every retained spec instead of the 
selected snapshot's live layouts, and range conversion lacks DATE identity 
support. Global validity flags can also describe a different metadata 
generation from the refresh pin. The new lazy lookup exposed query analysis 
closing the caller statement before CREATE finished preparing partitions.
   - **Why existing tests missed it:** `IcebergExternalTableTest` checked the 
spec-only cached predicate, and `IcebergUtilsTest` covered time ranges without 
retained unsupported specs. The existing evolution SQL suite expected 
compatible same-column evolution to fail. Update that expectation and add real 
SDK manifests, fixed-pin/cache boundaries and full-row AUTO-refresh checks. 
Existing `MTMVPlanUtilTest` checked results/errors without verifying subsequent 
statement-resource use; five new lifecycle cases cover that boundary and 
command cleanup.
   - **Fix:** Apply master commit `fb0fe563229113ff5fefb46c0f83496b02670749`, 
resolving connector-refactoring conflicts through existing branch adapters. 
Ordinary pins remain metadata-only; refresh privately materializes the pinned 
full view before internal locks. Shared cache projections remain lazy and 
budgeted. Query analysis now releases only planner locks; the complete CREATE 
command owns statement-resource cleanup, including forwarded requests. 
New-compatible layouts use whole-table snapshot freshness and distinct source 
partition names, so removals and mode transitions cannot preserve stale data.
   - **Other paths and branches:** Native/HMS creation and refresh are covered. 
Unsupported live/default layouts and changed source IDs remain rejected. 
Branch-4.1 has the same gate and is outside this backport.
   
   ### Testing
   
   - Four of five initial real SDK evolution cases fail on the branch baseline 
and pass with the fix; the live-unpartitioned negative remains rejected.
   - Local FE UT: 315 passed across 15 classes, including lifecycle, manifests, 
lock reuse, persisted freshness, cache/generation ownership, schema, views, 
nanosecond, branch/tag and MTMV coverage; zero failures, errors or skips.
   - Five lifecycle cases produce five assertion failures on the unfixed 
ownership code, then pass unchanged after the fix.
   - Local manual SQL/MV replay: four complete base/MV/literal-row comparisons 
and four refresh tasks passed, including NULL overlaps and member removal. 
Seven genuine SDK 1.11 commits wrote Parquet fixtures; native reads/internal MV 
writes used this FE and ASAN BE `9fb6e4905482a6ac332819e339f70ab0e1d611ec`. 
Both AUTO requests selected all partitions (`COMPLETE`).
   - The two unchanged SQL suites were not completed locally: available BE 
artifacts require external-file report acknowledgments absent from branch-4.2 
FE. External SDK fixture writes avoid that unrelated protocol boundary.
   
   ### Notes for Reviewers
   
   DATE identity/day ranges use conservative table-snapshot freshness, which 
can refresh all MV partitions after any snapshot change. Preparing task-owned 
views also adds metadata work for some no-op/self-managed refreshes; ordinary 
pin construction stays metadata-only.
   
   ### Release note
   
   Partitioned asynchronous materialized views support compatible Iceberg 
evolution with unused historical unpartitioned specs and DATE identity 
partitions, while rejecting unsupported live layouts.
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Partially verified: unchanged SQL suites await a 
matching BE; local FE tests and manual native-read/MV replay passed.
   
   ### AI Disclosure
   
   - Tool: Codex (GPT-6)
   - Generated: Backport adaptation, tests and this description.
   - Human review: Not stated.
   - Prompts: Fix master and branch-4.2 consistently, prefer cherry-picking 
master, and resolve every local review finding before submitting both pull 
requests.
   


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