← Back to Pull requests

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

Closed
unknown closed this pull request without merging on Nov 23, 2026 03:08 UTC
View on GitHub
unknown unknown commented on Nov 09, 2026 12:38 UTC
Author

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 #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 #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
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: morrySnow Review duration: 19590m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #70410"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%
    Repository