Skip to content

[opt](iceberg) Decouple bounded manifest loading from parsed caching - #70410

Merged
924060929 merged 9 commits into
apache:masterfrom
924060929:codex/iceberg-cold-sr-20261109
Nov 23, 2026
Merged

924060929 merged 9 commits into
apache:masterfrom
924060929:codex/iceberg-cold-sr-20261109

Conversation

@924060929

@924060929 924060929 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Background

Iceberg batch scans either use a bounded completion-ordered manifest loader with the parsed Manifest Cache enabled, or SDK file planning with the cache disabled. SDK parallel file planning polls an empty output queue with a fixed 10 ms sleep.

What problem does this PR solve?

Issue Number: None
Related PR: None
PR Type: Performance

Problem Summary:

Use the existing bounded manifest loader for supported cache-disabled data scans too. Parsed-result retention only selects lookup/load functions, while admission, completion notification, cancellation and backend-demand-controlled prefetch remain shared. Preserve SDK streaming for single, oversized or unknown-count manifests and custom/offline scans.

Details

  • Change map: Production: 600 added / 199 removed lines. Tests: 1006 added / 5 removed lines. Documentation: 31 added / 0 removed lines. No generated files.
  • Why it was slow: SDK ParallelIterable can sleep even after files are ready, and its refill/consumption cadence determines the number of fixed sleeps.
  • Optimization: Reuse completion-ordered prefetch and existing metadata scheduling without retaining uncached parsed contents. A request-local FileIO retains cancellation checks. Uncached scans separate predicate-read statistics, window retention and final task statistics using the native SDK scan context. Window copies retain only requested columns plus equality-delete keys; after delete association, tasks retain only requested statistics. Shared cached values keep complete statistics for later predicates. Uncached readers prune adapted borrowed data/delete entries before copying survivors into the window. Delete copies keep only key/path statistics after predicate evaluation; cached payloads stay complete and query-independent. Shared cache reads retain their existing ownership.
  • Results: Initial measurements at d1b11a4b513 (before the review follow-up): with parsed Manifest Cache disabled, ARM64 full-SQL medians for 1000 manifests (10,000 small Parquet files) fall from 910.0 to 162.0ms for a cold single full scan, and 912.1 to 398.4ms for all four concurrent full scans to finish. Cold LIMIT falls 34.5 to 23.3ms. All 16 cold/warm LIMIT/full-scan medians are lower than the unchanged module. Cache-enabled full scans remain essentially flat; a 30-group followup measures 170.6->169.4ms for cold full scan, while warm LIMIT c4 remains 14.27->15.14ms (+0.88ms).

Initial full-SQL medians at d1b11a4b513, before the review follow-up, in ms. Parsed Manifest Cache disabled in both Doris versions:

Manifests FE caches SQL Before, single After, single Before, 4 queries After, 4 queries
100 cold LIMIT 10 34.7 25.7 39.5 29.7
100 cold COUNT + SUM 127.0 105.4 286.5 276.7
100 warm LIMIT 10 23.2 12.0 28.9 16.1
100 warm COUNT + SUM 110.0 104.0 263.0 255.0
1000 cold LIMIT 10 34.5 23.3 39.7 26.8
1000 cold COUNT + SUM 910.0 162.0 912.1 398.4
1000 warm LIMIT 10 22.3 10.9 29.7 21.1
1000 warm COUNT + SUM 897.6 143.5 902.3 376.8

Each cell is the median of 10 synchronized batches; the four-query columns measure completion of all four queries. Both versions use the same ARM64 Release BE, 6 CPUs per engine and the same 10,000 small files. Cold clears FE table/metadata/Manifest caches; BE footers and data pages stay warm. Warm retains the existing caches, with parsed Manifest caching still disabled. SQL/result caching and profiling are disabled during timing.

  • Applicability and cost: Native batch data scans with engine-owned scheduling and known manifest file counts fitting the bounded window. Single/large/unknown manifests retain SDK file streaming. Existing synchronous/COUNT cache-policy gates and SDK/custom-scan fallback remain. Both cache policies share the corrected row projection and bounded parallel delete loading. No wire-format change.
  • Behavior change: Manifest loading no longer depends on enabling the parsed-result cache for supported streaming scans. No new configuration is added.

Testing

  • Native Linux ARM64 build.sh --fe -j2, including Checkstyle: passed.
  • Full Iceberg connector tests through run-fe-ut.sh on the final source: 1937 tests, 5 existing skips, no failures/errors. This includes cancellation, FileIO guards, completion ordering, backpressure, saturated scheduler admission and shared-load cancellation.
  • Native projection without mutating cached statistics; cache-enabled/disabled result equivalence and retention; partition type promotion; pinned historical/current snapshots; delete association; uncached load failure without SDK retry; oversized/unknown/overflow count guard.
  • Earlier-head full-SQL comparisons: 1200 SQLs across old/new/SR, 800 SQLs with parsed caching enabled, and 300 focused followup SQLs. Both fixtures return 50000 rows and SUM(id)=1249975000; LIMIT returns 10 valid distinct ids. Same unchanged Release BE, 6 CPU per engine, swapped connector JAR only, profiling excluded from timing. Cold means FE metadata/manifest caches cleared while BE footer/pages are warm; SQL/result caching disabled.
  • Cache-off main order old/new/SR/SR/new/old; cache-on comparisons old/new/new/old. Warm both cached and cold-read paths before timing. All 14 measured stages have zero storage CPU throttling and zero host swap-out.
  • Initial implementation diagnostics at d1b11a4b513, not a new-head measurement: 6 JFRs and 24 Profiles: 1000-manifest SDK hasNext+sleep samples 2053 before and 0 after; BE GetSplitTime 729/722ms before and 79/75ms after. All profiles have 10000 footer hits, 20000 page hits, 50000 rows and 10000 ranges, with no new footer reads or page writes.

Notes for Reviewers

The follow-up commit 03f344b6a7db addresses the four inline findings:

  • Share inclusive row-to-partition projection for data and delete manifests; ordinary-column and bucket-source predicates no longer fail or silently fall back.
  • Include added, existing and deleted entries in the uncached whole-manifest admission bound, with conservative unknown counts and long arithmetic.
  • Keep the native SnapshotScan.planFiles() event/timer/report lifecycle around local doPlanFiles, with manifest/file/delete counters and one report on full or early close, including historical schemas.
  • Use the existing bounded prefetcher for delete manifests, starting the window immediately. Data keeps its inline first read. Tests cover 2/6 delete manifests, both cache policies, a read budget of 2 with 4 workers, and cancellation before queued reads open any file.

Before the fixes, ten regression cases produced eight assertion failures and two binding exceptions. At 03f344b6a7db, the complete connector suite had 1810 tests, zero failures/errors and five existing skips; FE build/Checkstyle passed with two build CPUs. That revision also passed another 400 complete SQL result checks using the unchanged ARM64 Release BE.

The follow-up commit 290bd57bacfb preserves SDK delete-file pruning and data projection:

  • Filter each adapted delete file with the same metrics/partition predicate helper used for data files before building the request-local index. Query-disjoint equality deletes are excluded, unknown statistics remain conservative, and shared cached values stay complete.
  • Choose the uncached data projection from the built index. Position-only unfiltered scans omit unused column-statistics maps; equality-delete matching, predicates and explicitly requested statistics retain what they need.
  • Add 16 parameterized cases for unpartitioned/bucket/identity specs, matching/disjoint/unknown-statistics deletes, alternating warm predicates, both cache policies, 64-column position/equality-delete data projections and explicit statistics. The initial 14-case regression run had seven assertion failures before the fix. The latest full connector suite has 1826 tests, zero failures/errors and five existing skips; standard ARM64 FE build/Checkstyle passed with two build CPUs. This second review repair did not rerun end-to-end SQL timing.

The follow-up commit 95b02f4ce592 bounds retained query metadata more closely to the work needed:

  • Read borrowed live entries through a small SDK-package bridge and copy only selected entries. Uncached data and delete predicates run after partition type adaptation, before copying/buffering. Every load owns its evaluator/adapter state; cached reads stay complete.
  • Compact retained delete statistics with the native ContentFileUtil policy: equality-key columns or position-delete path bounds. Payload predicates run before compaction. The uncached consumer avoids duplicate pruning and skipped-file counters; the cached consumer filters and compacts a request-local copy.
  • Add 17 cases checking the actual prefetched loader result, empty/selective 64-column manifests, INT-to-LONG partition adaptation, complete cached values, compact position/equality indexes, payload predicates before trimming and borrowed-entry copy ownership. The 12-case pre-fix run has eight assertion failures. The latest complete connector suite has 1843 tests, zero failures/errors and five existing skips; standard ARM64 FE build/Checkstyle passed with two build CPUs. The bridge has one exact-file ImportControl namespace exemption; other style checks remain active. This repair did not rerun end-to-end SQL timing.

The follow-up commit 41183a309266 separates evaluation statistics from retained survivor metadata:

  • Compute an immutable projection in the existing SDK scan adapter. Read statistics needed for predicates, but retain only requested statistics plus indexed equality-delete keys in the uncached prefetch window. After delete association, discard matching-only keys. Shared cached payloads stay complete and immutable.
  • Preserve native no-statistics, selected-column, all-column and explicit-empty requests using ContentFileUtil. Ordinary scans need no extra task copy; only matching keys excluded from the final request require another compact copy after association.
  • Add six parameterized fixtures covering 72 combinations of cache policy, partition/ordinary-column filters, no/position/equality deletes and requested-statistics selections. Compare delete association and final bounds with the native SDK. Before the fix, the six-case regression has three cache-off failures; after it, 24 focused cases pass. The complete connector suite has 1849 tests, zero failures/errors and five skips; standard ARM64 FE build/Checkstyle passes with two build CPUs. This repair did not rerun end-to-end SQL timing.

The performance table above belongs to the initial implementation. Post-repair timing attempts encountered active host paging, including after equal lower-memory overrides, so those timings are excluded from fair performance claims. Fair end-to-end timing for the follow-up remains pending; native reporting/counters can have real cost.

The follow-up commit 12f4a79e161 fixes reads after a metadata delete rewrites a manifest whose partition source column has already been dropped:

  • Reproduced the external regression with Spark 4.0, Iceberg 1.10.1 and REST 1.10: the initial read succeeds, then deleting the NULL-partition file rewrites an old spec under a schema without its source column. The new reader's SDK-header fallback fails strict binding; native SDK planning still reads the same snapshot.
  • Use the native raw spec when the retained writer schema lacks the partition source. If the writer snapshot/schema has expired, recover header types with missing-source binding enabled. Cached/uncached data and delete readers share the fix; bounded scheduling stays active.
  • Four streaming regression cases cover cache off/on and retained/expired manifest writer snapshots, compare with SDK file paths and require scheduler/cache use. The full Iceberg connector suite passes: 1862 tests, zero failures/errors and five existing skips. Standard Linux ARM64 build.sh --fe -j2 and Checkstyle pass.
  • Manual full-SQL validation with local Parquet and ORC files verifies the original failed table, pre-delete row-ID rejection, reads after NULL-partition metadata deletes and cache-off/on cold/warm results. This does not replace the external object-storage CI run. No performance timings were rerun.

The follow-up commit 5124eacce46 fixes delete association when a manifest rewrite overlaps partition-source removal:

  • Reproduced the P1 review finding with eight parameterized cases: cache off/on, INT/FLOAT partitions and equality/position deletes. The native SDK associates one delete per data file while the previous loader associates zero. A full-SQL fixture with rows {1,2} and an equality delete for 1 returns {1,2} through the previous loader, versus {2} through native SDK planning.
  • A manifest snapshot identifies its commit schema, which can lack a partition source even when the rewritten header retains its old physical type. Recover the header spec in that case, then use the shared partition adapter so data and delete keys have the same canonical representation. This supersedes the preceding raw-spec fallback for missing source columns.
  • All eight new cases pass, including cold/warm cache use and bounded streaming. The complete connector suite passes 1870 tests with zero failures/errors and five existing skips; standard ARM64 FE build and Checkstyle pass. The earlier metadata-delete/source-removal regressions remain green.
  • The same real-Parquet SQL fixture now returns only {2} and COUNT(*) = 1 with cache off/on, synchronous/streaming planning and cold/warm reads. SQL/result caching is disabled. Fair performance timing remains pending; no new performance numbers are claimed.

Rebase follow-up on 2026-11-19 (integration commit d99dbb05eb7):

  • Rebased the seven existing commits onto master 6d697e8e044 after [fix](iceberg) Bound encrypted metadata ownership to statements #70675 introduced a statement-owned IcebergManifestReader with the same name as this PR's stateless physical parser.
  • Preserve the upstream statement reader unchanged. Rename the physical parser to IcebergManifestLoader; cached scans keep the upstream reader's leases, private-result isolation and cancellation-independent observers. Physical reads keep the SDK byte-cache isolation. Upstream encrypted-file capability/count and delete descriptor behavior is preserved.
  • The complete run-fe-ut.sh --run "org.apache.doris.connector.iceberg.*Test" invocation passes: 1929 connector tests, zero failures/errors and five existing skips. This includes the upstream statement/encryption tests and the preceding source-removal/delete-association regressions. FE packaging and Checkstyle pass through build.sh --fe -j2 with BE Java extension rebuilding disabled.
  • No full-SQL or performance measurements were rerun for this rebase. The earlier fair-performance limitation still applies. Previous-head cloud P0 retry build 6412 passed; new-head remote CI/review remains pending.

Second rebase follow-up on 2026-11-19 (test commit e4626f166f7):

  • Rebased the eight existing commits onto master 435c387701e after [improvement](external) Refine external file splits in BE #70664 changed file splitting. Cached, uncached bounded and SDK streaming all retain the upstream splitFileTasks helper and receive the request's coarse target; per-file scheduling weights use the same selected target.
  • Add four cache/delete combinations with separate Parquet and ORC manifests. A 96 MiB ordinary file produces 64/32 MiB ranges; a file associated with a position delete keeps six 16 MiB ranges. Verify range counts, scheduling denominators, delete association, BE refinement eligibility, bounded scheduler use and cache retention.
  • All 1937 Iceberg tests pass with zero failures/errors and five existing skips, including the four new cases. Ran the preset run-fe-ut.sh and stopped its remaining reactor only after the complete Iceberg module result and matching XML reports were recorded. FE build/Checkstyle and packaging pass separately through build.sh --fe -j2 with BE Java extension rebuilding disabled.
  • No full-SQL or performance timings were rerun. The previous head's compile/performance CI failures were TeamCity runner startup errors while setting temporary script permissions; new-head CI/review is pending.

Release note

Supported Iceberg batch scans use bounded completion notifications even when the parsed Manifest Cache is disabled, reducing fixed polling waits while retaining early stopping and Split-buffer backpressure. Queries also remain readable after metadata deletes following historical partition-source column removal, and preserve equality/position delete association when manifest rewrites overlap removal of a partition source column.

Check List (For Author)

  • Behavior changed: Yes (see Details)
  • Does this need documentation: No user-facing setting is added. Internal connector scheduling documentation is updated.
  • Pre-submission status: Local Iceberg unit tests (1937 tests, zero failures/errors and five skips), FE build/Checkstyle and package checks passed on the rebased source. Earlier full-SQL validation and initial timings belong to earlier heads; final-head SQL/performance was not rerun. Fair follow-up performance timing and new remote CI/review remain pending.

AI Disclosure

  • Tool: Codex
  • Generated: Code, tests, documentation and commit description
  • Human review: Pending

@924060929
924060929 requested a review from CalvinKirs as a code owner November 9, 2026 12:38
@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Review setup stopped before context preparation ran; inspect the first failed or cancelled setup step.
Workflow run: https://github.com/apache/doris/actions/runs/42618794927

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Review setup stopped before context preparation ran; inspect the first failed or cancelled setup step.
Workflow run: https://github.com/apache/doris/actions/runs/42791172715

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes: four verified regressions in the newly enabled cache-disabled batch/streaming path: one P1 query failure and three P2 first-split/reporting regressions. All four are inline. No existing inline findings or blockers were present in the refreshed PR state.

Reviewed all eight changed files and the full authoritative diff at d1b11a4, with independent correctness, lifecycle and risk-focused reviews. The review converged after two rounds: all three latest-round reviewers returned NO_NEW_VALUABLE_FINDINGS; every candidate and initial risk has an evidenced disposition, with no unresolved assigned coverage gaps. No additional user focus was supplied.

Critical checkpoint conclusions:

  • Goal and evidence: separating scheduling from parsed retention is implemented and exercised by new cache-on/off equivalence and retention tests. Predicate/delete failure, physical-manifest eligibility, table reporting and delete-read parallelism still need the inline fixes.
  • Scope and reuse: focused parser extraction and loader selection reuse existing prefetch/admission machinery; no unrelated implementation changes found.
  • Concurrency and locks: one SPLIT consumer advances files; METADATA workers load manifests; cancellation can arrive separately. Pending-window state is synchronized, with remote reads, waits and scheduler admission outside the registry lock. No new lock-order cycle found. Delete-manifest I/O is newly serialized for uncached streaming scans.
  • Lifecycle: request-local FileIO borrows catalog IO; readers close through try-with-resources. Actual read bodies retain table leases, authentication and plugin TCCL; permits and TCCL unwind in finally. Engine stop signals scan cancellation before cleanup. Shared cached loads preserve their independent ownership; no additional lifecycle defect found.
  • Configuration: no new setting; existing cache and concurrency controls remain. Streaming requires the session batch gates; custom/offline/direct-scheduler scans retain SDK behavior. No dynamic-configuration propagation change.
  • Compatibility: no storage, wire or shared plugin SPI changes. Internal renames match callers and the reflection test. Existing synchronous/COUNT cache gates remain.
  • Thrift/protobuf IDs: not applicable; no definition changes.
  • Parallel paths: inspected cached/uncached, SDK/custom/offline, synchronous/COUNT, empty/current/historical snapshots, and single/large/unknown-count manifests. The inline findings concern newly routed streaming behavior and its fallback boundary.
  • Special conditions: exact native-class/scheduler gates and statistics projection conditions are explained. Projection retains full statistics for predicates/deletes and never mutates shared cached values. The live-count admission condition misses physically read deleted entries, as reported inline.
  • Test coverage: inspected new JUnit 5 policy, projection, snapshot/type promotion, delete association, overflow/unknown-count and failure-propagation cases. They miss non-partition/transformed-source predicates with deletes, deleted-entry-heavy data manifests, streaming table reporters and parallel delete-manifest reads. No new end-to-end regression suite is included.
  • Expected results: changed assertions are consistent with their fixtures; reflection rename is correct. No .out/result files changed. Tests were inspected, not executed.
  • Observability: existing manifest/table error context and engine split metrics remain; native table/catalog ScanReport delivery is lost on the new path, as reported inline.
  • Transactions/persistence/failover: no EditLog or write-transaction change; pinned read metadata remains the snapshot/schema source. The P1 finding fails planning rather than publishing partial results.
  • Writes/atomicity: no changed data-write path. Read-side delete association, sequence metadata and partition adaptation were traced.
  • FE/BE variables: none added; scan-range wire format unchanged.
  • Performance/memory: completion ordering and retained live-result windows remain bounded; uncached projection avoids unused statistics. Sparse-live large manifests and eager serial delete loading introduce the two inline first-split regressions. No unbounded-memory or measured-latency claim is made.
  • Other concerns: all initial risks and candidate duplicates were resolved in the ledger; no additional verified issue remained after the final sweep.

Validation limits: static inspection only. No builds, tests, benchmarks, source edits or submodule initialization were performed. The author's reported runtime and performance results were not independently reproduced.

Review converged after 2 round(s).

@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review of #70410 at 03f344b. Two new P2 performance/resource regressions are reported inline: lost per-file predicate pruning of deletes, and unnecessary full data-file statistics for unfiltered position-delete-only scans.

Critical checkpoint conclusions:

  • Goal and evidence: eligible cache-disabled native streaming scans now reuse bounded completion-ordered loading. The new policy, cancellation, projection, snapshot/delete and reporting tests exercise that routing; the two inline cases remain uncovered.
  • Scope and reuse: the parser extraction, loader-policy selection and reuse of the existing prefetcher are focused within Iceberg; no unrelated production changes found.
  • Concurrency: producer SPLIT and reader METADATA pools are independent. Pending/ready state is bounded, admission and IO occur outside the registry lock, completion is once-only, and cancellation wakes consumers. No new deadlock or lock-order defect found.
  • Lifecycle: permit, authentication, plugin TCCL and table leases follow the actual read callable through success/failure. Shared-cache observation detaches on cancellation; request-local uncached IO checks cancellation. Source close preserves iterator/resource ownership. No new static-initialization issue applies.
  • Configuration: no new configuration; the existing 1..64 concurrency validation and cache gates remain.
  • Compatibility: no SPI, wire or stored-format changes. Pinned snapshot/schema/spec adaptation and immutable cached payloads remain intact in the inspected paths.
  • Thrift/protobuf: no changes; cross-branch field-ID checks are inapplicable.
  • Parallel paths: synchronous and COUNT retain their cache policy; custom/offline, single, oversized and unknown-count native scans retain SDK fallback. Both retention policies share delete projection and bounded scheduling.
  • Conditions: native-class/scheduler eligibility and physical-entry bounds have concrete fallback reasons. Added/existing/deleted counts use conservative unknown handling and long arithmetic.
  • Test coverage: added JUnit cases cover both policies, row predicates with position deletes, schema promotion/historical snapshots, cache retention, failures without SDK retry, reporting and latch-based parallelism/cancellation. Missing cases are query-disjoint equality deletes and native data projection when only position deletes exist.
  • Test results: no golden/output artifacts changed. This review inspected source and tests only; no builds, tests, benchmarks, cluster runs or source modifications were performed. Author-reported test/performance results were not independently reproduced.
  • Observability: the native ScanEvent, planning timer and table/catalog close-time report are preserved, including historical schema context and idempotent close. Extra indexed/result deletes under the first finding are a consequence of lost pruning.
  • Transactions/persistence: no write, transaction, EditLog, atomicity or failover changes.
  • FE/BE variables: no new transmitted variables or send paths. Existing delete-carrier conversion transmits all attached delete files, confirming the downstream effect of the first finding.
  • Performance/memory: completion notification removes the SDK polling route for eligible inputs, but query-local delete pruning and compact data projection must also be preserved. Final-head timing remains unverified; the PR itself identifies follow-up timing as pending.
  • Other concerns/user focus: no additional user-provided focus. No further verified defect found in the covered changed files and their related control flow.

Known review context: the earlier P1 row-to-partition binding issue (4545082518) is fixed by inclusive projection. The earlier P2 physical-entry bound (4545082650), native reporting (4545082966), and serial delete loading (4545083105) are also fixed in this head. Those findings are not duplicated; no existing P0/P1 finding is confirmed to remain applicable.

Convergence: converged after 2 review rounds. All ten changed paths, initial risk items and candidate dispositions were covered; every latest-round reviewer returned NO_NEW_VALUABLE_FINDINGS and the final sweep found no unresolved static coverage question. Static scope does not establish workload timing or runtime validation.

Review converged after 2 round(s).

@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review of all 10 changed paths at 290bd57 found two new P2 memory/performance regressions: rejected data files are materialized before query pruning, and retained delete files keep statistics for unrelated payload columns. Both are inline. No new P0/P1 issue was verified.

All six earlier findings were rechecked against this head and appear addressed: inclusive delete-manifest predicate projection, physical entry counts including deleted/unknown/overflow cases, native reporting, parallel delete reads, per-file delete pruning, and unfiltered position-only data projection. The new findings concern different instances: rejected data-file materialization with no deletes, and statistics retained in the complete delete index when every delete is relevant. No previously reported P0/P1 remains applicable, so no existing blocking IDs are carried forward. There was no additional user-provided focus.

Critical checkpoint conclusions:

  • Goal and proof: scheduling is separated from parsed-result retention, with parameterized tests for both cache policies. The two inline issues leave avoidable heap/CPU regressions in the default uncached route.
  • Scope and reuse: the change is focused on Iceberg manifest planning and reuses the existing prefetcher, read controls and SDK report lifecycle; the extracted parser avoids duplicate implementations.
  • Concurrency: source production uses SPLIT workers and manifest loading uses separate METADATA workers. The pending registry, atomics/futures and query semaphore protect shared state; IO, admission and waits occur outside its lock. No new lock-order or same-pool deadlock was substantiated.
  • Lifecycle: reader/delete-prefetch cleanup, cancellation wakeups, lazy source close, shared-load ownership, table leases, TCCL restoration and permit release were traced through failure and early termination. No new lifecycle defect was verified.
  • Configuration: no new public configuration; existing cache and concurrency settings remain, with an internal entry-count admission bound.
  • Compatibility: no wire/storage format or shared SPI change. Snapshot/schema/spec adaptation and native/custom scan guards preserve the reviewed read semantics.
  • Thrift/protobuf: no definitions changed; cross-branch field-ID checks are inapplicable.
  • Parallel paths: synchronous/COUNT cache gates and SDK fallback for unsupported/custom/offline/single/large/unknown-count inputs were inspected. Engine-selected v3 streaming remains excluded.
  • Conditional guards: native eligibility, deleted-entry counting and conservative fallback cover concrete alternative semantics and read-work limits.
  • Test coverage: inspected result/delete parity, warm-cache independence, historical/current schemas, partition type promotion, projection, reporting, parallel overlap, cancellation, admission boundaries and uncached failure propagation. The retained-memory cases described inline lack equivalent coverage; no new end-to-end regression SQL is included.
  • Test result changes: no golden/result files changed. This review ran no builds or tests; author-reported results were not reproduced.
  • Observability: native ScanEvent, planning timer, close-time reports and file/manifest/delete counters are supplied, with full/early/idempotent-close test cases.
  • Transactions and persistence: read planning only; no EditLog, write transaction or failover changes.
  • Data modifications and crash behavior: no write path added; pinned reads and exceptional cleanup were inspected.
  • FE/BE propagation: existing task/range payloads remain; no new cross-process field requires propagation.
  • Performance: completion notifications and backend-demand backpressure are retained. Entry-count bounds do not bound per-column maps; the two inline issues identify unnecessary retained payload. Fair performance timing of the repaired head remains pending, as the PR description already discloses.
  • Other/core invariants: no additional data-visibility or error-propagation defect was substantiated. Doris partition visible-version and MoW bitmap code are untouched.

Coverage is complete for this static review. Runtime timing, heap measurements and build/test execution are outside its authorized scope.

Review converged after 2 round(s).

@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review of all 12 changed files at 95b02f4: one new P2 performance finding, published inline. No new P0/P1 correctness issue was verified.

The reviewed flow is engine SPLIT producer -> native eligibility -> SDK scan-report lifecycle -> bounded eager delete loading/index -> lazy data-manifest prefetch -> file pruning/delete association -> split conversion. Parsed-cache policy selects shared immutable results or request-local reads.

Critical checkpoint conclusions:

  • Goal and proof: supported native streaming scans now use completion notifications with parsed caching disabled. Added tests inspect scheduling, result equivalence and cache retention; they were read, not run.
  • Scope and clarity: changes stay within Iceberg manifest planning, its SDK-package bridges, tests and scheduling documentation. The exact-file style exemption is limited to ImportControl.
  • Concurrency and locks: SPLIT producers and METADATA loaders use separate engine executors. The statement semaphore bounds reads; pending-list locks cover registration, with I/O, waits and cancellation outside. No new deadlock or lock-order defect was verified.
  • Lifecycle: reader-owned streams close through try-with-resources; retained entries own copies before SDK reuse. Query-local loads hold table leases, preserve authentication/TCCL, and check cancellation before further I/O. Shared cache loads keep their existing independent lifetime.
  • Configuration: no setting is added. Existing cache policy and manifest concurrency settings retain their roles; no new dynamic-configuration obligation.
  • Compatibility: native-only admission preserves custom scan semantics. No persisted format, shared connector SPI version or FE/BE protocol change.
  • Thrift/protobuf: no definitions changed; cross-branch field-ID comparison is inapplicable.
  • Parallel paths: synchronous and COUNT cache gates, SDK fallback for single/oversized/unknown manifests, both cache policies, historical snapshots and both delete types were inspected.
  • Conditions and errors: physical counts include deleted entries using long arithmetic; missing counts conservatively select SDK streaming. Uncached failures and cancellation propagate instead of retrying planning; existing eager cache-failure fallback remains.
  • Test coverage: added cases cover ownership, selective/empty pruning, partition promotion, payload predicates before delete compaction, cache completeness, reporting, parallel delete reads and queued cancellation. Latches/queues make concurrency assertions explicit. Survivor-statistics compaction is missing; current wide-table assertions expect the excessive maps described inline.
  • Result changes: no regression .out files changed. New Java assertions were checked against source behavior and pinned SDK semantics.
  • Observability: uncached native planning retains ScanEvent, planning timer, close-time reporter and manifest/file/delete counters. Current/historical and full/early-close assertions inspect exactly-once reporting.
  • Transactions and persistence: no EditLog or transaction change; selected snapshot/schema remains the read boundary. Native visible-version and MoW bitmap checkpoints do not apply to this external read-only change.
  • Writes and atomicity: no data-write path is added or modified; no new write/crash-atomicity requirement.
  • FE/BE variables: none added; scan-range conversion continues through existing interfaces.
  • Performance and memory: bounded admission and early filtering remove polling/rejected-entry retention, but full statistics for surviving filtered data files remain unnecessarily buffered (the P2 finding). These are Java metadata allocations; BE MemTracker changes are inapplicable.
  • Other concerns: no additional verified source issue after independent rechecks of inheritance, partition adaptation, delete compaction, reporting and shutdown.

All eight prior inline issues were independently rechecked and are addressed at this head: row-to-partition projection (4545082518), deleted-entry admission counts (4545082650), scan reporting (4545082966), parallel delete loading (4545083105), per-file delete pruning (4545895515), unfiltered position-only projection (4545895704), pruning rejected data entries before copying (4547306904), and compact delete statistics (4547307099). No existing P0/P1 remains applicable, so no blocking comment ID is carried forward. The new finding concerns surviving filtered data files, a separate instance from those earlier triggers. No additional user-provided focus was supplied.

Review converged after two rounds: all assigned reviewers returned NO_NEW_VALUABLE_FINDINGS against the frozen payload, all changed paths and risk items have evidence dispositions, and no source-level candidate remains unresolved. Validation limits: static inspection only; no builds, tests, benchmarks or runtime heap measurements were executed. The PR's timings precede the follow-up repairs; fair end-to-end timing of the final head remains pending and is not established by this review.

Review converged after 2 round(s).

@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review of 41183a3: no new substantiated findings. Converged after 1 round: two complete-scope reviewers and a separate risk reviewer all returned NO_NEW_VALUABLE_FINDINGS; main independently checked their evidence, all 12 changed paths and the final candidate/risk dispositions.

Existing findings: P1 thread is fixed: both delete/data manifest pruning now apply inclusive row-to-partition projection. The eight existing P2 concerns have concrete repairs: deleted-entry admission, native reporting, parallel delete reads, delete pruning, position-only projection, pre-retention data pruning, compact delete statistics and survivor statistics retention. No existing P0/P1 remains confirmed applicable; no duplicate comments are submitted. No additional user focus was supplied.

Critical checkpoint conclusions:

  • Goal: eligible native streaming scans share bounded completion-driven loading with either cache policy; equivalence and fallback tests cover the intent.
  • Scope/reuse: changes stay in Iceberg planning, reader extraction, SDK bridges, focused tests/documentation and one exact-file style exception; the existing scheduler and prefetcher are reused.
  • Concurrency: SPLIT consumers and METADATA readers use separate workers. The pending registry is synchronized, closure/demand signals are visible across threads, and evaluators/adapters are load-local. I/O, admission and waits are outside the registry lock; no new lock cycle found.
  • Lifecycle: readers own streams, retained entries own copies, and actual read bodies retain table leases and release permits in finally. Cancellation, early close and failure paths were traced; no static initialization-order change.
  • Configuration: no new settings; existing cache and concurrency controls retained.
  • Compatibility: no storage/wire or public connector SPI change; unsupported/custom/incremental scans retain SDK planning.
  • Thrift/proto: untouched; field-ID audit is not applicable.
  • Parallel paths: cached/uncached streaming, synchronous/COUNT, offline/DIRECT/custom and historical/current schemas were inspected.
  • Conditional checks: native-class/scheduler/count guards have documented reasons and conservative fallback, including single, oversized, unknown and deleted-heavy manifests.
  • Test coverage: inspected native-result/statistics comparisons, borrowed-copy ownership, partition promotion, snapshot pins, delete association, no/partial/all/empty statistics, cache isolation, scheduler budgets, cancellation and injected failure. No tests were executed here.
  • Test results: no golden/result files changed; author-reported runs were not independently reproduced.
  • Observability: local planning retains the native SnapshotScan lifecycle and supplies manifest/file/delete counters.
  • Transactions/persistence: no EditLog, transaction or failover changes; pinned reads were traced.
  • Writes/atomicity: no write path changes; query-local filtering/copies preserve shared metadata.
  • FE-BE variables: none added; no protocol send points changed.
  • Performance: predicates precede uncached retention; window copies keep requested/equality-key statistics, and matching-only keys are removed after delete association. No additional worker pool; the complete delete index remains necessary.
  • Other invariants: no additional concrete failure found in schema evolution, sequence metadata, conservative unknown metrics, snapshot visibility or error propagation; BE version/delete-bitmap/memory-tracker behavior is unaffected.

Validation limits: static inspection only. No builds, tests, benchmarks, source changes or submodule initialization. The author explicitly leaves fair end-to-end timing of the final repair pending; the initial performance measurements do not certify this head's speedup. No unresolved code candidate or uncovered static-review scope remains.

Review converged after 1 round(s).

@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929
924060929 force-pushed the codex/iceberg-cold-sr-20261109 branch from 41183a3 to a170bfd Compare November 16, 2026 07:26
@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Review setup stopped before context preparation ran; inspect the first failed or cancelled setup step.
Workflow run: https://github.com/apache/doris/actions/runs/43823944695

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@924060929
924060929 force-pushed the codex/iceberg-cold-sr-20261109 branch from a170bfd to 50a77d4 Compare November 16, 2026 11:48
@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Review setup stopped before context preparation ran; inspect the first failed or cancelled setup step.
Workflow run: https://github.com/apache/doris/actions/runs/43861012961

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

924060929 added a commit to 924060929/incubator-doris that referenced this pull request Nov 17, 2026
### What problem does this PR solve?

Issue Number: None

Related PR: apache#70410

Problem Summary: After removing a partition field and its source column, a metadata delete can rewrite a retained manifest using a schema without that source column. Bounded manifest loading then falls back to the SDK header parser, which strictly binds the old partition spec and throws ValidationException. Native SDK planning still reads the same snapshot successfully.

Use the native raw spec when a retained writer schema no longer contains the partition source. When the writer snapshot/schema has expired, recover the header spec with the same missing-source allowance used for retained historical specs. Keep this logic shared by cached and uncached data/delete readers. Add four streaming cases covering both cache policies and retained/expired manifest writer snapshots, comparing with SDK paths and checking bounded scheduling/cache population.

### Release note

Fix Iceberg queries failing after metadata deletes when a historical partition source column has been dropped.

### Check List (For Author)

- Test: Unit Test and Manual test
    - run-fe-ut.sh Iceberg connector suite: 1862 tests, 0 failures/errors, 5 existing skips
    - build.sh --fe -j2, including Checkstyle: passed on Linux ARM64
    - Spark 4.0 / Iceberg 1.10.1 / REST 1.10 with local Parquet and ORC files: reproduced the original failure before the fix; verified reads after NULL-partition metadata deletes with cache off/on and cold/warm reads after the fix; checked pre-delete row-ID rejection
- Behavior changed: Yes, valid rewritten manifests remain readable
- Does this need documentation: No
924060929 added a commit to 924060929/incubator-doris that referenced this pull request Nov 19, 2026
### What problem does this PR solve?

Issue Number: None
Related PR: apache#70410

Problem Summary: Rebase bounded manifest scheduling onto master after apache#70675 introduced a statement-owned reader with the same class name as this PR's physical manifest reader. Keep the upstream reader and its cache isolation, cancellation-independent observers and table leases intact. Rename the stateless physical parser to IcebergManifestLoader, route cached scans through the upstream statement reader, and retain the SDK byte-cache isolation for physical reads. Preserve the upstream encryption/count and delete descriptor changes.

### Release note

None

### Check List (For Author)

- Test: Full Iceberg connector unit tests through run-fe-ut.sh; FE build and Checkstyle through build.sh --fe -j2; git diff --check
- Behavior changed: No (preserve both upstream statement ownership and this PR's bounded scheduling)
- Does this need documentation: No
924060929 added a commit to 924060929/incubator-doris that referenced this pull request Nov 19, 2026
### What problem does this PR solve?

Issue Number: None
Related PR: apache#70410

Problem Summary: Master apache#70664 adds dedicated coarse file splitting and overlaps this PR's streaming manifest entry points. The rebase preserves the shared splitFileTasks helper and forwards the coarse target for cached, uncached and SDK scans. Add four parameterized cases with two small manifests, Parquet/ORC files and optional position deletes. Ordinary files use the 64 MiB target; the file with deletes retains the 16 MiB fallback. Verify range counts, target scheduling weights, delete associations, backend refinement eligibility, bounded scheduler use and cache retention. Remove the obsolete TableScanUtil import after switching all streaming branches to the shared split helper.

### Release note

None

### Check List (For Author)

- Test: Unit Test - 1937 Iceberg tests, zero failures/errors, five existing skips, including four new cases, through run-fe-ut.sh; runner stopped after the targeted module completed. FE build/Checkstyle through build.sh --fe -j2 with BE Java extension rebuilding disabled; git diff --check.
- Behavior changed: No (preserve upstream coarse splitting alongside bounded manifest scheduling)
- Does this need documentation: No
@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review of e4626f166f7755ab49c669c5091a5769baeeff7f completed across all 12 changed files and their relevant caller/consumer paths. No new actionable finding was substantiated. The review converged after 1 round: two general reviewers and one separate risk-focused reviewer all returned NO_NEW_VALUABLE_FINDINGS, and the main review resolved every candidate and risk focus with evidence.

Critical checkpoint conclusions:

Checkpoint Conclusion
Goal and evidence Eligible cache-disabled batch scans now use the existing bounded completion-ordered loader. Added tests assert SDK-equivalent files/deletes and actual scheduler/cache use.
Scope and reuse The change stays within Iceberg scan planning, its package-access bridge, tests and scheduling documentation. Cache policy selects loading/retention while admission and cancellation remain shared.
Concurrency and locks SPLIT producers and METADATA loaders use separate executors. Pending-state locks protect short registry operations; I/O, admission and waits occur outside them. No new lock-order or same-pool wait defect was found.
Lifecycle Permits and table/reader leases surround actual loads; cancellation wakes consumers and stops queued reads. Engine LIMIT/error cleanup cancels the scan context before closing sources. Borrowed survivors are copied; cached values remain query-independent. No new static-initialization concern.
Configuration No configuration item is added. Existing concurrency and cache-policy settings remain the controls.
Compatibility No storage or wire format changes. Native/custom scan gates, pinned schemas/snapshots and source-removal/type-promotion adaptation were inspected.
Thrift/protobuf IDs Not applicable: no generated protocol definition changes.
Parallel paths Cached/uncached streaming, SDK fallback, synchronous and COUNT paths were traced. All streaming routes retain the shared coarse/fallback split helper and matching scheduling denominator.
Conditional gates Native table/scan and engine scheduler requirements are explicit. Single, oversized, unknown-count and custom/offline uncached scans retain SDK planning; deleted entries and overflow-safe totals are included in admission.
Tests Added unit fixtures cover both cache policies, historical/type-evolved snapshots, equality/position deletes, row/partition pruning, no/partial/all/empty statistics, borrowed ownership, parallelism, cancellation, reporting and failure without SDK retry. Assertions inspect paths, delete associations, retained metadata and scheduler usage.
Test results No regression output files changed. Test source and expected assertions were inspected; this review did not execute tests or verify the author's reported passes.
Observability Local uncached enumeration remains inside the native ScanEvent/timer/close-time report lifecycle, with manifest/file/delete counters. Current/historical and full/early-close report assertions are present.
Transactions and persistence Not applicable: no EditLog, transaction commit/replay or persisted-state write change. Snapshot pinning remains the read boundary.
Data writes and crashes No data-write path changes. Read failure, cancellation and resource cleanup were inspected; no new leak or deadlock scenario was established.
FE-BE variables No new transmitted variable or protocol field. Delete descriptors and split/refinement decisions remain covered by the inspected range fixtures.
Performance The polling-removal path and bounded retained metadata are supported structurally. Predicate statistics are discarded only after pruning/delete association; shared cache values remain complete. Final-head speedups are unverified here; fair follow-up timing is explicitly pending in the PR.
Other issues Final sweep found no additional substantiated issue or unresolved static coverage gap.

The earlier P1 row-predicate projection finding is addressed by shared inclusive manifest projection. The earlier P1 physical partition-type finding is addressed by header recovery and canonical query-local adaptation. Both were independently rechecked at this head; neither is retained as a current blocker. Earlier statistics/pruning, count-bound, reporting and parallel-delete findings are also addressed in the inspected code and fixtures, so no duplicate comments are posted.

User focus: no additional user-provided focus was supplied. Coverage limits: static inspection only; no builds, tests, benchmarks or runtime validation were performed. Native behavior was compared with the pinned Iceberg 1.12.0 planner and reporting lifecycle.

Review converged after 1 round(s).

Iceberg batch scans either use a bounded completion-ordered manifest loader with the parsed Manifest Cache enabled, or SDK file planning with the cache disabled. SDK parallel file planning polls an empty output queue with a fixed 10 ms sleep.

Issue Number: None
Related PR: None
PR Type: Performance

Problem Summary:

Use the existing bounded manifest loader for supported cache-disabled data scans too. Parsed-result retention only selects lookup/load functions, while admission, completion notification, cancellation and backend-demand-controlled prefetch remain shared. Preserve SDK streaming for single, oversized or unknown-count manifests and custom/offline scans.

- **Change map:** Extract the immutable manifest parser from the cache; share file enumeration across both cache policies; retain SDK streaming where whole-manifest buffering would delay first delivery or exceed the file window; add cache-policy and snapshot/type/delete tests and document the boundary.
- **Why it was slow:** SDK ParallelIterable can sleep even after files are ready, and its refill/consumption cadence determines the number of fixed sleeps.
- **Optimization:** Reuse completion-ordered prefetch and existing metadata scheduling without retaining uncached parsed contents. A request-local FileIO retains cancellation checks. Unfiltered scans without deletes reuse the native SDK column projection; cached values keep complete statistics for later predicates. Shared cache reads retain their existing ownership.
- **Results:** With parsed Manifest Cache disabled, ARM64 full-SQL medians for 1000 manifests (10,000 small Parquet files) fall from 910.0 to 162.0ms for a cold single full scan, and 912.1 to 398.4ms for all four concurrent full scans to finish. Cold LIMIT falls 34.5 to 23.3ms. All 16 cold/warm LIMIT/full-scan medians are lower than the unchanged module. Cache-enabled full scans remain essentially flat; a 30-group followup measures 170.6->169.4ms for cold full scan, while warm LIMIT c4 remains 14.27->15.14ms (+0.88ms).
- **Applicability and cost:** Native batch data scans with engine-owned scheduling and known manifest file counts fitting the bounded window. Single/large/unknown manifests retain SDK file streaming. Parsed-cache, synchronous COUNT, custom scan and wire-format behavior remain unchanged.
- **Behavior change:** Manifest loading no longer depends on enabling the parsed-result cache for supported streaming scans. No new configuration is added.

- Native Linux ARM64 build.sh --fe -j2, including Checkstyle: passed.
- Full Iceberg connector tests through run-fe-ut.sh on the final source: 1796 tests, 5 existing skips, no failures/errors. This includes cancellation, FileIO guards, completion ordering, backpressure, saturated scheduler admission and shared-load cancellation.
- Native projection without mutating cached statistics; cache-enabled/disabled result equivalence and retention; partition type promotion; pinned historical/current snapshots; delete association; uncached load failure without SDK retry; oversized/unknown/overflow count guard.
- Full-SQL comparisons: 1200 SQLs across old/new/SR, 800 SQLs with parsed caching enabled, and 300 focused followup SQLs. Both fixtures return 50000 rows and SUM(id)=1249975000; LIMIT returns 10 valid distinct ids. Same unchanged Release BE, 6 CPU per engine, swapped connector JAR only, profiling excluded from timing. Cold means FE metadata/manifest caches cleared while BE footer/pages are warm; SQL/result caching disabled.
- Cache-off main order old/new/SR/SR/new/old; cache-on comparisons old/new/new/old. Warm both cached and cold-read paths before timing. All 14 measured stages have zero storage CPU throttling and zero host swap-out.
- Separate 6 JFRs and 24 Profiles: 1000-manifest SDK hasNext+sleep samples 2053 before and 0 after; BE GetSplitTime 729/722ms before and 79/75ms after. All profiles have 10000 footer hits, 20000 page hits, 50000 rows and 10000 ranges, with no new footer reads or page writes.

Supported Iceberg batch scans use bounded completion notifications even when the parsed Manifest Cache is disabled, reducing fixed polling waits while retaining early stopping and Split-buffer backpressure.

- Behavior changed: Yes (see Details)
- Does this need documentation: No user-facing setting is added. Internal connector scheduling documentation is updated.
- Pre-submission status: Local self-review, tests, build, package layout and controlled performance comparisons completed. The small cache-enabled warm-LIMIT c4 median difference is disclosed above.

- Tool: Codex
- Generated: Code, tests, documentation and commit description
- Human review: Pending
The bounded local Manifest planner is also used when parsed caching is disabled. It must preserve the SDK's predicate projection, delete-index prerequisites and table reporting lifecycle.

Issue Number: None
Related PR: None
PR Type: Bugfix

Problem Summary:

Row predicates on non-partition columns fail when pruning delete manifests. The uncached eligibility guard ignores deleted entries, table scan reporting is bypassed, and delete reads run serially before any split can be delivered. Restore these semantics through the existing projection, prefetch and native scan lifecycle.

- **Frequency:** Deterministic for affected row predicates with deletes, sparse-live large manifests and configured table reporters. Serial delete loading affects cold scans with multiple delete manifests.
- **Root cause:** Delete pruning used a partition expression API with a row predicate; the buffering guard counted only live entries; bypassing native planFiles omitted its lifecycle; the eager index loop and first-inline-read policy prevented full delete parallelism.
- **Why existing tests missed it:** They covered identity partition predicates, live counts, synchronous reporting and delete associations, but not ordinary/bucket-source predicates with deletes, streaming reporter closure or overlapping first delete reads.
- **Fix:** Reuse the common inclusive row-to-partition projection. Include known deleted-entry counts with long arithmetic. Run local enumeration inside the native SnapshotScan lifecycle and supply counters. Reuse the bounded prefetcher for deletes with immediate admission, retaining the inline first data read and existing query budget/cancellation ownership.
- **Other paths and branches:** Both cache policies share corrected predicate/deletion logic. Existing cache gates, custom/offline scans, SDK fallback, snapshots and shared cache immutability remain. No BE, wire or shared plugin SPI changes.
- **Behavior change:** Affected predicates plan correctly without a cached-path fallback. Large or unknown physical entry counts retain SDK streaming. Native table reporters receive one report when a full or early-stopped source closes. Even two delete manifests can overlap; cancelling queued loads opens no new file.

- Before production changes: 10 regression cases produced 8 assertion failures and 2 ValidationExceptions, demonstrating all four review findings.
- Final run-fe-ut.sh --run 'org.apache.doris.connector.iceberg.*Test': 1810 tests, 0 failures, 0 errors, 5 existing skips. Linux ARM64/JDK17, 2 CPUs/8GiB.
- Includes current/historical and full/early-close native reports, ordinary and bucket-source predicates with deletes under both cache policies, deleted-entry/unknown/overflow eligibility, 2/6 delete manifests with cache on/off, and cancellation of all queued reads.
- Standard build.sh --fe -j2 including Checkstyle passed. The isolated plugin JAR is absent from parent FE lib.
- 400 full-SQL result checks passed with the unchanged ARM64 Release BE. Post-repair timing trials encountered host paging and are not accepted as fair performance evidence; initial implementation timings are labeled with their original revision.

Preserve filtered scans with delete files, native Iceberg scan reporting and bounded parallel delete-manifest loading when using local streaming planning.

- Behavior changed: Yes (see Details)
- Does this need documentation: No user setting is added; internal scheduling documentation is updated.
- Pre-submission status: Partially verified: correctness tests, FE build and package layout passed; fair post-repair performance timing awaits a stable host.

- Tool: Codex
- Generated: Code, tests, documentation and this description
- Human review: Pending
Native Iceberg planning filters delete files against the query before building the delete index, then loads data statistics when equality-delete matching needs them. Parsed cached manifests remain query-independent.

Issue Number: None
Related PR: None
PR Type: Bugfix

Problem Summary:

The bounded manifest planner indexed query-disjoint equality deletes and requested full data statistics whenever any delete manifest existed. Apply per-file predicates at the request-local boundary and select the uncached data projection from the completed delete index.

- **Frequency:** Filtered scans with equality deletes, and unfiltered uncached scans containing only position deletes.
- **Root cause:** Manifest-summary pruning does not replace file-level pruning; a nonempty delete-manifest list does not imply equality deletes exist.
- **Why existing tests missed it:** Delete predicates used position deletes without disjoint equality metrics, and the compact-projection fixture had no delete manifest.
- **Fix:** Reuse a shared data/delete file-predicate helper after partition adaptation. Preserve complete shared cached values. Defer data-loader projection until the filtered delete index is built.
- **Other paths and branches:** Both retention policies share file pruning; existing SDK/custom-scan fallback and scheduling remain unchanged. No shared SPI or wire change.

The initial 14-case regression run had seven assertion failures before the fix. The repaired 14-case focused run passed. The final full Iceberg connector suite has 1826 tests, zero failures/errors and five existing skips, including 16 added cases. Standard ARM64 build.sh --fe -j2 and Checkstyle passed. Builds used two CPUs and an 8 GiB container limit. No new end-to-end SQL timing was run.

Iceberg scans avoid indexing and reading query-disjoint equality deletes, and uncached position-delete-only scans avoid retaining unneeded data-file statistics.

- Behavior changed: Yes (see Details)
- Does this need documentation: Internal scan scheduling documentation updated.
- Pre-submission status: Local source validation recorded in the PR; new-head remote checks pending.

- Tool: Codex
- Generated: Code, tests, documentation and commit description
- Human review: Pending
Bounded Iceberg loading materializes live manifest entries before delivering file tasks. Uncached retained data is query-local, while cached manifests must remain complete for other predicates and snapshots.

Issue Number: None
Related PR: None
PR Type: Bugfix

Problem Summary:

The uncached reader copied rejected data files before predicates, and delete indexes retained statistics for unrelated payload columns. Filter adapted borrowed entries before copying survivors and compact delete copies after predicates using the native SDK retention policy.

- **Frequency:** The concrete query and retention paths described above.
- **Root cause:** ManifestReader.iterator copied entries before the parser copied them again; predicates ran after whole-manifest buffering, and the already-loaded delete index builder did not trim statistics.
- **Why existing tests missed it:** Final split parity tests did not inspect rejected intermediate files or retained delete-payload statistics.
- **Fix:** The uncached reader copied rejected data files before predicates, and delete indexes retained statistics for unrelated payload columns. Filter adapted borrowed entries before copying survivors and compact delete copies after predicates using the native SDK retention policy.
- **Other paths and branches:** Cached reads remain complete; their consumer filters and compacts query-local copies. Uncached workers own private evaluator/adapter state, and the consumer avoids duplicate predicate evaluation. Snapshot, scheduling, cancellation and SDK fallback ownership are preserved.

Twelve pre-fix cases produce eight assertion failures. The final complete Iceberg suite has1843tests, zero failures/errors and five existing skips, including17new cases for retained contents, type evolution, index keys, payload predicates and entry reuse. Standard ARM64 FE build and Checkstyle passed with a hard 2 CPU / 8 GiB container limit. No new end-to-end timing was run.

The uncached reader copied rejected data files before predicates, and delete indexes retained statistics for unrelated payload columns. Filter adapted borrowed entries before copying survivors and compact delete copies after predicates using the native SDK retention policy.

- Behavior changed: Yes (see Details)
- Does this need documentation: Internal scheduling notes updated where applicable; no public setting added.
- Pre-submission status: Local tests recorded above; standard build and new-head CI status recorded at publication.

- Tool: Codex
- Generated: Code, tests and commit description
- Human review: Pending
Uncached bounded manifest reads evaluate predicates before retaining files. Equality-delete matching may still need a subset of statistics after that evaluation.

Issue Number: None
Related PR: None
PR Type: Bugfix

Problem Summary:

Surviving uncached data files still retained all statistics read for filtering, even when no task statistics were requested. Separate read-time, buffered matching and task projections without changing shared cached files.

- **Frequency:** Cache-disabled bounded scans with filters or equality deletes and files with column statistics.
- **Root cause:** Reader copies retained evaluation-only maps instead of applying the scan's requested-statistics policy after pruning.
- **Why existing tests missed it:** They checked rejected-file retention and matching correctness but expected full maps on surviving filtered files.
- **Fix:** Build an immutable projection from the native scan context. Keep requested columns plus equality keys in worker copies, associate deletes, then retain only requested task statistics. Use native ContentFileUtil for none, partial, all and empty selections.
- **Other paths and branches:** Cached contents remain full and immutable. SDK/custom/offline fallbacks, cancellation, admission and backpressure are unchanged.

- Before fix: new six-case regression has three cache-off assertion failures.
- After fix: 24 targeted tests pass; the six new fixtures exercise 72 comparisons with native SDK behavior.
- Complete Iceberg suite through run-fe-ut.sh: 1849 tests, zero failures/errors, five skips.
- Standard ARM64 build.sh --fe -j2 and Checkstyle pass, limited to two CPUs. Package layout and final source fingerprints verified.
- No new end-to-end SQL performance timing in this repair.

Equality-key statistics are removed only after DeleteFileIndex.forDataFile, preserving delete association. The immutable projection belongs to the existing SDK adapter, where the native protected scan context is available.

Reduce retained metadata for filtered uncached Iceberg manifest scans while preserving requested statistics and delete matching.

- Behavior changed: Yes (see Details)
- Does this need documentation: No new configuration; internal scheduling documentation updated.
- Pre-submission status: Partially verified: local tests, FE build and self-review passed; new remote CI/review and end-to-end timing remain pending.

- Tool: Codex
- Generated: Code, tests, documentation and commit description
- Human review: Pending
Issue Number: None

Related PR: apache#70410

Problem Summary: After removing a partition field and its source column, a metadata delete can rewrite a retained manifest using a schema without that source column. Bounded manifest loading then falls back to the SDK header parser, which strictly binds the old partition spec and throws ValidationException. Native SDK planning still reads the same snapshot successfully.

Use the native raw spec when a retained writer schema no longer contains the partition source. When the writer snapshot/schema has expired, recover the header spec with the same missing-source allowance used for retained historical specs. Keep this logic shared by cached and uncached data/delete readers. Add four streaming cases covering both cache policies and retained/expired manifest writer snapshots, comparing with SDK paths and checking bounded scheduling/cache population.

Fix Iceberg queries failing after metadata deletes when a historical partition source column has been dropped.

- Test: Unit Test and Manual test
    - run-fe-ut.sh Iceberg connector suite: 1862 tests, 0 failures/errors, 5 existing skips
    - build.sh --fe -j2, including Checkstyle: passed on Linux ARM64
    - Spark 4.0 / Iceberg 1.10.1 / REST 1.10 with local Parquet and ORC files: reproduced the original failure before the fix; verified reads after NULL-partition metadata deletes with cache off/on and cold/warm reads after the fix; checked pre-delete row-ID rejection
- Behavior changed: Yes, valid rewritten manifests remain readable
- Does this need documentation: No
Issue Number: None

Related PR: apache#70410

Problem Summary: A manifest rewrite can retain old INT/FLOAT partition specs while committing after the partition field and source column are removed. Its snapshot ID identifies the commit schema, which does not necessarily describe the physical manifest header. The missing-source fallback decoded rewritten data with UNKNOWN partition types while retained delete manifests were decoded with their original types and adapted to Long/Double. Incompatible partition keys silently omitted equality and position deletes. A full SQL reproduction returned rows {1,2} after an equality delete of 1, while native SDK planning returned only {2}.

Recover the header spec whenever the commit schema is unavailable or lacks any partition source. Keep physical types until the shared adapter canonicalizes the partition values. Add eight SDK-parity cases covering both cache policies, INT/FLOAT partitions, equality/position deletes and cold/warm scans across the rewrite/source-removal interleaving.

Fix queries returning deleted rows when manifest rewrites overlap removal of a partition source column.

- Test: Unit Test and Manual test
    - run-fe-ut.sh Iceberg connector suite: 1870 tests, zero failures/errors, five existing skips
    - build.sh --fe -j2 with Checkstyle: passed on Linux ARM64
    - Full SQL with real local Parquet data and an equality-delete file: reproduced deleted-row resurrection before the fix; verified only row 2 and COUNT(*)=1 with cache off/on, synchronous/streaming and cold/warm reads after the fix
- Behavior changed: Yes, rewritten manifests preserve delete association
- Does this need documentation: No
### What problem does this PR solve?

Issue Number: None
Related PR: apache#70410

Problem Summary: Rebase bounded manifest scheduling onto master after apache#70675 introduced a statement-owned reader with the same class name as this PR's physical manifest reader. Keep the upstream reader and its cache isolation, cancellation-independent observers and table leases intact. Rename the stateless physical parser to IcebergManifestLoader, route cached scans through the upstream statement reader, and retain the SDK byte-cache isolation for physical reads. Preserve the upstream encryption/count and delete descriptor changes.

### Release note

None

### Check List (For Author)

- Test: Full Iceberg connector unit tests through run-fe-ut.sh; FE build and Checkstyle through build.sh --fe -j2; git diff --check
- Behavior changed: No (preserve both upstream statement ownership and this PR's bounded scheduling)
- Does this need documentation: No
### What problem does this PR solve?

Issue Number: None
Related PR: apache#70410

Problem Summary: Master apache#70664 adds dedicated coarse file splitting and overlaps this PR's streaming manifest entry points. The rebase preserves the shared splitFileTasks helper and forwards the coarse target for cached, uncached and SDK scans. Add four parameterized cases with two small manifests, Parquet/ORC files and optional position deletes. Ordinary files use the 64 MiB target; the file with deletes retains the 16 MiB fallback. Verify range counts, target scheduling weights, delete associations, backend refinement eligibility, bounded scheduler use and cache retention. Remove the obsolete TableScanUtil import after switching all streaming branches to the shared split helper.

### Release note

None

### Check List (For Author)

- Test: Unit Test - 1937 Iceberg tests, zero failures/errors, five existing skips, including four new cases, through run-fe-ut.sh; runner stopped after the targeted module completed. FE build/Checkstyle through build.sh --fe -j2 with BE Java extension rebuilding disabled; git diff --check.
- Behavior changed: No (preserve upstream coarse splitting alongside bounded manifest scheduling)
- Does this need documentation: No
@924060929
924060929 force-pushed the codex/iceberg-cold-sr-20261109 branch from e4626f1 to 04bb762 Compare November 20, 2026 02:20
@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review of PR #70410 at 04bb762 found no new actionable issue. All 12 changed paths, relevant upstream/downstream control flow, added tests, and existing review threads were inspected.

Critical checkpoints:

  • Goal and supporting tests: eligible native cache-disabled streaming scans now use bounded, completion-ordered manifest loading; inspected fixtures compare planned paths and delete associations with native SDK planning and verify cache retention policy.
  • Scope and clarity: the loader extraction, package-access bridge, projection helper, metrics setter, documentation and focused fixtures support the scheduling/retention separation without a shared SPI expansion.
  • Concurrency: SPLIT producers and METADATA readers use separate workers; per-query permits bound reads, completed results count against the prefetch window, and evaluators/adapters are confined to each load.
  • Locks and deadlock: registry updates use the existing pending monitor; remote IO, admission, waits and cancellation work occur outside it. No new lock-order or same-pool child-wait defect was established.
  • Lifecycle: retained entries own copies of borrowed SDK objects; readers close registered streams, cancellation wakes consumers and removes queued loads, and actual read bodies retain table leases until completion. Shared cache loads remain independent of one observer's cancellation.
  • Configuration: no new setting; existing cache policy and manifest concurrency are captured for scan planning.
  • Compatibility: no new persisted format, public connector SPI, function symbol or wire protocol; current/historical partition schemas and dropped-source header recovery were traced through data/delete matching.
  • Thrift/protobuf: no definitions or field IDs change.
  • Parallel paths: cache on/off, current/historical, synchronous/count/streaming, SDK/custom-scan fallback and coarse/delete splitting were checked. Oversized, unknown-count and single-manifest uncached inputs retain SDK streaming.
  • Conditional guards: native scan/scheduler admission and added+existing+deleted entry bounds have concrete purposes and boundary fixtures; version >=3 remains outside engine streaming admission.
  • Test coverage: inspected predicate pruning, complete shared-cache values, explicit partial/all/empty statistics, equality/position deletes, schema evolution, expired sources, concurrent rewrites, cancellation, parallel reads, reporting, failure propagation and Parquet/ORC coarse splitting. No builds or tests were executed in this static-only review; final-head end-to-end correctness and fair performance timing remain unverified here.
  • Expected results: no regression result files change; added unit-test expectations were checked against their fixtures and native SDK comparisons.
  • Observability: the uncached path preserves native ScanEvent/planning timer/close-time ScanReport and supplies manifest/file/delete counters; no new heavy per-file logging.
  • Transactions and persistence: no write, EditLog, replay or failover behavior changes.
  • Data modification and atomicity: this is read planning; no new data-write/crash-recovery path.
  • FE-BE variables: no new transmitted variable or serialization path.
  • Performance: entry/window bounds, pre-copy pruning, compact delete statistics and requested/equality-key projections support the intended memory/scheduling behavior. Source inspection does not prove end-to-end speedup; the PR's stated fair follow-up timing limitation remains.
  • Other issues: no additional substantiated defect or unresolved static coverage gap remained after the final rechecks.

Existing review disposition: both prior P1 findings (4545082518 row-predicate projection and 4597907436 physical-type recovery after source removal) have corresponding fixes and inspected targeted cases at this head. The earlier P2 pruning/projection/parallelism/reporting/window findings are also addressed; no duplicate inline comments are added and no existing P0/P1 blocker was independently confirmed to remain.

User focus: no additional user-provided focus points were supplied. Review convergence: converged after 2 rounds; no remaining candidate or static coverage limit. Runtime and performance validation were not executed.

Review converged after 2 round(s).

@924060929

Copy link
Copy Markdown
Contributor Author

run cloud_p0

@924060929

Copy link
Copy Markdown
Contributor Author

run external

@924060929

Copy link
Copy Markdown
Contributor Author

run p0

@924060929
924060929 merged commit af7b0c7 into apache:master Nov 23, 2026
33 of 34 checks passed
@924060929
924060929 deleted the codex/iceberg-cold-sr-20261109 branch November 23, 2026 03:09
924060929 added a commit to 924060929/incubator-doris that referenced this pull request Nov 23, 2026
924060929 added a commit to 924060929/incubator-doris that referenced this pull request Nov 23, 2026
924060929 added a commit to 924060929/incubator-doris that referenced this pull request Nov 25, 2026
yiguolei pushed a commit that referenced this pull request Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants