Skip to content

[fix](iceberg) Bound encrypted metadata ownership to statements - #70675

Merged
Gabriel39 merged 3 commits into
apache:masterfrom
Gabriel39:fix/iceberg-encrypted-cache-lifetime
Nov 19, 2026
Merged

Gabriel39 merged 3 commits into
apache:masterfrom
Gabriel39:fix/iceberg-encrypted-cache-lifetime

Conversation

@Gabriel39

@Gabriel39 Gabriel39 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Background

Iceberg table encryption managers can cache unwrapped metadata keys. Decoded manifests can also contain plaintext data-file and delete-file keys. Doris reuses table owners and parsed manifests through catalog caches, while statement leases keep resources alive during planning.

What problem does this PR solve?

Issue Number: None
Related PR: #64304 (introduced the connector cache implementation), #70693 (separate private RPC transport work)
PR Type: Bugfix

Problem Summary:

After encrypted metadata is warmed, another statement can reuse a cached manager or decoded manifest without performing its own metadata-key authorization. Keep encrypted table ownership within statement leases, isolate unclassified loads and publish only shareable plaintext values. A statement reader coalesces its active manifest reads and removes completed private registrations. Most of the diff is SDK and concurrency coverage; encrypted SQL admission remains closed.

A shared-cache probe after loading a manifest containing file-key metadata demonstrates the retention boundary:

Before After
Returns a ManifestCacheValue Returns null

Details

  • Change map: 664 changed production lines for cache retention, scoped table ownership and manifest-reader orchestration; 1,260 test/fixture lines and 51 documentation lines. No generated protocol sources.
  • Frequency: Always when an encrypted manager or key-bearing manifest is reused after warming. Concurrent unclassified reads also shared work across statements before classification.
  • Root cause: Catalog ownership and path-only SDK caching outlive statement key authorization. Per-invocation isolation alone then prevents safe reuse inside one statement.
  • Why existing tests missed it: Unit tests primarily exercised plaintext metadata; the encrypted fixture did not enable the SDK byte cache. An existing cancellation assertion assumed unclassified reads could be shared; it now requires independent reads followed by plaintext cache reuse. The HMS/REST encrypted-metadata regressions exercise the closed SQL admission path, so they cannot test accepted encrypted scan ownership.
  • Fix: Reuse the cache's invalidation-guarded publication with a retention predicate and one reader per frozen statement table. Route synchronous/future/probe/data/delete reads through it, keep private results with current consumers and hold actual I/O leases through cancellation. Preserve per-call optional statistics and lazy schema projection.
  • Other paths and branches: Covers count/weight limits, direct/bulk publication, refresh/replacement, data and both delete descriptor kinds, SDK byte caching and catalog retirement. Checked 3.1/4.0/4.1/4.2 tips do not contain this connector-cache path; legacy release-cache behavior was not audited and no backport is prepared.
  • Behavior change: Cold loads from different statements may perform independent I/O before plaintext publication. Warm plaintext hits remain reusable. JVM memory zeroization is not promised.

Testing

  • Real SDK table/manifest cases reproduce retention and missing-descriptor cache bypass. New coalescing cases fail with a one-shot adapter over the original API; active-body lease tests preserve cancellation safety.
  • Full cache/SPI/Iceberg suites: 2,376 tests, zero failures/errors, 11 existing skips. They cover KMS revocation, key-sensitive coalescing, cross-statement isolation, plaintext hits, registration races, bounded private retention and optional statistics. These modules are upstream of the repository FE UT reactor through fe-core test dependencies.
  • Fresh ASAN build after the actual-conflict rebase: 163 native encryption/delete/scan/cache tests passed.
  • FE Checkstyle, clang-format 16, header hygiene and clang-tidy passed on the final candidate.

Release note

Encrypted Iceberg metadata is excluded from shared table and manifest caches across statements. Encrypted SQL read admission is unchanged.

Check List (For Author)

  • Behavior changed: Yes (see Details)
  • Does this need documentation: Yes; the connector encryption-read design note documents ownership and reuse.
  • Pre-submission status: Ready

AI Disclosure

  • Tool: Codex (GPT-6)
  • Generated: Implementation, tests, documentation and this description.
  • Human review: not stated

@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

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 18 changed files at 3b7847c1d3a543558f041158e66ebdb90be28b45 found one P2 performance regression: retention classification eagerly evaluates lazy partition-adaptation views on warm manifest scans. The inline finding describes the trigger and fix. No new P0/P1 findings or existing blocking comments were identified.

Critical checkpoint conclusions:

  1. Goal and proof: The inspected retention predicates, isolated load scopes and IO views support statement ownership for encrypted tables and adapter-loaded key-bearing manifests. New fixtures cover these mechanisms; the warm-scan regression remains to fix.
  2. Scope and clarity: Changes stay focused on cache ownership, IO views, tests and documentation; preserving the already-computed retention flag would avoid coupling classification to scan projection.
  3. Concurrency: Independent caller/metadata-worker loads use identity scopes; existing scope/key publication locks and atomic owner references protect publication and retirement. Loaders remain outside cache locks; no new lock-order defect found.
  4. Lifecycle: Cache, loader, statement and active-callable leases balance across discard, invalidation and close. The supported HMS path creates fresh table operations per load, with the manager owned by those operations (Iceberg 1.12 HiveTableOperations). No new static-initialization dependency found.
  5. Configuration: No configuration keys or dynamic-update semantics change.
  6. Compatibility: No persisted storage format or FE/BE protocol change; existing admission remains closed. Cache API changes are additive and internal to the connector cache module.
  7. Thrift/protobuf: No gensrc definitions or field/enum IDs change.
  8. Parallel paths: Inspected synchronous/future and direct/bulk/replacement/refresh publication, data/position/equality-delete manifests, streaming/synchronous scans, COUNT and system-table admission. Undeclared external file-key cases on raw SDK paths predate this diff and remain outside the documented table-level contract; this review does not claim universal SDK cache cleanup.
  9. Conditions: New encryption and retention branches explain concrete descriptor/key-lifetime failures; no new silent-success error path found.
  10. Tests: Inspected count/weight admission, independent loads, descriptor failure/retry, KMS revocation, cancellation, catalog retirement and native reader close coverage. Negative and concurrency cases use explicit assertions/barriers. No end-to-end encrypted SQL execution is established.
  11. Expected results: No regression result files change; new unit assertions match the inspected ownership behavior, but do not detect the eager partition-projection work.
  12. Observability: Existing cache counters, load errors and encryption classifications cover affected operations; no additional logging need identified.
  13. Transactions/persistence: No EditLog, replay, failover or transaction logic changes.
  14. Writes/atomicity: No data-write path changes; cache publication retains its existing guarded commit semantics.
  15. FE/BE variables: No new transport variables or send paths. BE changes add tests only.
  16. Performance: Cold independent IO is an explicit classification-isolation tradeoff. The extra whole-manifest adaptation/allocation pass on warm schema-evolved scans is the P2 finding.
  17. Other invariants: No additional data-correctness, version-visibility, delete-consistency, memory-ownership or exception-propagation defect attributable to this diff was established.

User focus: none supplied. Coverage limits: static inspection only; no builds, tests, benchmarks or runtime/KMS validation were executed, and author-reported test results were not independently reproduced. Encrypted SQL admission remains closed. No unresolved in-scope candidate or changed-path coverage gap remains.

Review converged after 2 round(s).

Gabriel39 added a commit to Gabriel39/incubator-doris that referenced this pull request Nov 17, 2026
### Background

Cached manifests expose query-local partition views after schema evolution.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70675
PR Type: Bugfix

Problem Summary:

Retention classification eagerly consumed lazy partition views before streaming scans could read their first file. Preserve the source manifest's retention decision when projecting partitions.

### Details

- **Frequency:** Warm scans whose partition types require adaptation.
- **Root cause:** The projected value constructor repeated key classification through transformed lists.
- **Why existing tests missed it:** Functional adaptation checks did not measure evaluation before consumption.
- **Fix:** Carry the unchanged key-retention classification into the query-local view.
- **Other paths and branches:** Cover data and delete files with and without key metadata. Disable automatic manifest merging in cancellation fixtures so their queue cardinality is independent of processor count.

### Testing

Four regression cases failed before the fix and passed afterward. Connector cache, SPI and Iceberg suites ran 2,342 tests with zero failures/errors and 11 existing skips. FE Checkstyle passed.

### Release note

Warm Iceberg scans preserve lazy partition adaptation after schema evolution.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Ready

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Code, tests and this description.
- Human review: Pending.
@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

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 19 changed files at 7c04a372b900997dd71864031d25ece1bb65d982 found no new substantiated defect. The existing P2 comment 4597416579 is fixed: projected manifest values carry the source retention decision without traversing lazy partition views. No existing P0/P1 inline blocker remains.

Critical checkpoint conclusions:

  1. Goal and proof: Retention predicates, isolated load scopes and uncached IO views support statement ownership of encrypted table owners and adapter-loaded key-bearing manifests. Focused unit fixtures cover the changed mechanisms; this review inspected them statically.
  2. Scope and abstraction: Changes stay focused on shared cache policy, Iceberg ownership, tests and documentation, reusing existing cache and IO abstractions.
  3. Concurrency: Caller/metadata-worker loads use identity scopes. Existing scope/key publication guards and atomic references protect publication and retirement; loaders stay outside publication/prefetch locks. No new lock-order defect found.
  4. Lifecycle: Loader bridge, cache, statement and active-callable leases preserve table owners across declined admission, replacement, cancellation, invalidation and catalog retirement. Construction failures clean up. No new production static-initialization dependency found.
  5. Configuration: No configuration keys or dynamic-update semantics change.
  6. Compatibility: No persisted storage format, production native ABI or public connector SPI change. Cache APIs are additive; encrypted SQL admission remains closed.
  7. Thrift/protobuf: No definitions, field IDs or enum values change.
  8. Parallel paths: Checked synchronous/future, direct/bulk/CAS/refresh, count/weight, data/position/equality-delete, snapshot/SDK and COUNT/system-table paths. Unchanged raw SDK probes for undeclared file keys remain a pre-existing boundary, described below.
  9. Conditions and errors: Comments explain key-lifetime, descriptor-validation and lazy-projection conditions. No new silent-success error path established; read failures continue to propagate.
  10. Tests: Inspected negative descriptor/key/AAD/KMS, failure/retry, concurrent load, cancellation, retirement, weighted retention and lazy-projection coverage. Native additions exercise independent readers and close after success/cancellation/failed initialization. Encrypted SQL end-to-end execution is not established.
  11. Expected results: No regression output files change; new unit assertions match the inspected control flow. The four lazy data/delete projection cases address the prior P2.
  12. Observability: Existing cache hit/miss/failure counters, path-bearing read failures and encryption classifications remain available. No additional logging requirement identified.
  13. Transactions/persistence: No EditLog, replay, failover or transaction implementation changes.
  14. Writes/atomicity: No production data-write path changes; guarded cache publication semantics remain intact.
  15. FE/BE variables: No new transport variables or send paths. C++ changes add tests only.
  16. Performance: Independent simultaneous cold IO is an explicit isolation tradeoff until classification. Completed plaintext cache hits remain reusable, and schema-evolved partition projections remain lazy. No additional performance defect substantiated.
  17. Other invariants: No new data-correctness, visibility, delete-consistency, memory-ownership or exception-propagation defect established. Native tests add no hub/PCH/template/unity change.

User focus: no additional focus supplied. Existing review context was refreshed and deduplicated against this head.

Coverage limits: static inspection only; no builds, tests, benchmarks or runtime/KMS validation ran, and author-reported test results were not independently reproduced. The unchanged canProveCountFromManifests raw SDK COUNT probe can still populate SDK bytes for otherwise plaintext tables with undeclared per-file key metadata; it is present at the merge base and has no new trigger in this diff. This review does not claim universal SDK cache cleanup, deterministic JVM key zeroization, or encrypted SQL enablement. No unresolved in-scope candidate or changed-file coverage gap remains.

Convergence: all three assigned reviewers returned NO_NEW_VALUABLE_FINDINGS in round 1; main verification and the final sweep are complete.

Review converged after 1 round(s).

@924060929 924060929 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.

Suggestion to make statement-scoped manifest loading and cross-statement cache reuse explicit.

Iceberg uses table encryption managers to unwrap metadata keys, and manifests can contain plaintext data-file or delete-file keys. Doris caches table owners and parsed manifests across statements; the SDK can also cache decrypted manifest bytes.

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

Problem Summary:

A cached encryption manager can reuse an unwrapped key after the next statement loses KMS access. Parsed manifests, SDK byte-cache hits and shared unclassified loads can likewise reuse key-bearing metadata without validating the current read. Bound encrypted table ownership to statement leases, isolate unclassified loads and retain only plaintext manifest values. Encrypted SQL admission remains closed.

- **Change map:** About 200 lines of production changes in cache retention/scoped loading and encrypted IO views, 774 lines of tests, and 37 lines of documentation.
- **Frequency:** When encrypted metadata is warmed and then read by another statement or concurrently loaded before classification.
- **Root cause:** Catalog-scoped cache ownership outlives statement-scoped key authorization. The SDK manifest byte cache is keyed by path and cannot validate the current descriptor from cached decrypted bytes.
- **Why existing tests missed it:** Earlier cache tests primarily used plaintext metadata, and the encrypted fixture did not enable the SDK byte cache. Existing cancellation tests assumed unclassified results were safe to share.
- **Fix:** Add a value-retention predicate covering count/weight limits and publication variants; use independent load scopes; bypass decoded encrypted results and SDK manifest byte caching; preserve active table leases until their final release.
- **Other paths and branches:** Covers data, position-delete and equality-delete descriptors, synchronous/future reads, direct/bulk publication, replacement, refresh, concurrent cancellation and catalog retirement. No protocol fields or SQL enablement change.
- **Behavior change:** Cold unclassified table/manifest misses may perform independent IO before a plaintext result is published. Completed plaintext entries remain reusable. Key-bearing metadata is not retained across statements; deterministic JVM memory zeroization is not promised.

- Full connector cache, SPI and Iceberg suites: 2,178 tests, zero failures/errors, five existing skips; FE Checkstyle passed.
- ASAN native encryption/delete/scan tests: 147 passed. New coverage includes eight concurrent readers across AES key sizes, independent decryptor state, wrong-key/AAD retries and cleanup after success, cancellation and failed initialization.
- Observed failing baselines for encrypted table retention, unclassified concurrent manifest loads, and a missing manifest descriptor bypassing the SDK byte cache; all corresponding tests now pass.
- clang-format 16, BE header hygiene, clang-tidy and staged-diff checks passed.

Encrypted Iceberg metadata no longer remains in shared table or manifest caches across statements. Encrypted SQL read admission is unchanged.

- Behavior changed: Yes (see Details)
- Does this need documentation: Yes; the connector encryption-read design note is updated in this PR.
- Pre-submission status: Ready for cache and lifetime hardening; encrypted SQL transport and end-to-end enablement are separate work.

- Tool: Codex (GPT-6)
- Generated: Code, tests, documentation and this description.
- Human review: Pending.
### Background

Cached manifests expose query-local partition views after schema evolution.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70675
PR Type: Bugfix

Problem Summary:

Retention classification eagerly consumed lazy partition views before streaming scans could read their first file. Preserve the source manifest's retention decision when projecting partitions.

### Details

- **Frequency:** Warm scans whose partition types require adaptation.
- **Root cause:** The projected value constructor repeated key classification through transformed lists.
- **Why existing tests missed it:** Functional adaptation checks did not measure evaluation before consumption.
- **Fix:** Carry the unchanged key-retention classification into the query-local view.
- **Other paths and branches:** Cover data and delete files with and without key metadata. Disable automatic manifest merging in cancellation fixtures so their queue cardinality is independent of processor count.

### Testing

Four regression cases failed before the fix and passed afterward. Connector cache, SPI and Iceberg suites ran 2,342 tests with zero failures/errors and 11 existing skips. FE Checkstyle passed.

### Release note

Warm Iceberg scans preserve lazy partition adaptation after schema evolution.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Ready

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Code, tests and this description.
- Human review: Pending.
### Background

Iceberg scan planning reads data and delete manifests through the connector cache.
A statement already holds a frozen table lease and bounded manifest-read admission.

### What problem does this PR solve?

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

Problem Summary:

A per-invocation load identity prevents concurrent scans of one statement from
sharing a manifest read. Bind a reader to the existing statement table lease and
retain private results only for current consumers. Preserve per-caller optional
statistics while using one statement identity for in-flight work.

### Details

- Change map: 504 changed production lines (including the scan-path ownership wrapper), 387 test lines and 22 documentation lines; no generated sources.
- Frequency: Always for overlapping unclassified reads that use independent invocation identities.
- Root cause: Cache safety and statement reuse were modeled through the same per-call entry point.
- Why existing tests missed it: Cache tests covered cross-statement isolation; they did not require same-statement coalescing or bound completed private results. Guarded SQL regression paths do not enable encrypted execution.
- Fix: Use a statement-owned reader for synchronous, future, cached-only, data and delete reads. Preserve guarded plaintext publication, remove completed private registrations before callbacks, and hold I/O leases until the callable exits.
- Other paths and branches: Covers encrypted tables/manifests, unknown file-key descriptors, observer cancellation, unused registration races and unscoped cleanup. The connector implementation is absent at the checked 3.1/4.0/4.1/4.2 branch paths.

### Testing

- Coalescing tests fail with a one-shot adapter over the original cache API. Cancellation tests verify the new reader preserves the existing active-I/O lease invariant.
- Full connector cache/SPI/Iceberg suites: 2376 tests, zero failures/errors and 11 existing skips.
- Fresh ASAN native build and selection: 163 tests pass on the rebased candidate.
- FE Checkstyle, clang-format16, header hygiene and clang-tidy pass.

### Release note

None

### Check List (For Author)

- Behavior changed: No
- Does this need documentation: Yes; the connector encryption-read design note describes ownership and reuse.
- Pre-submission status: Ready

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Code, tests, documentation and this description.
- Human review: not stated
@Gabriel39
Gabriel39 force-pushed the fix/iceberg-encrypted-cache-lifetime branch from 7c04a37 to 93a9fdb Compare November 18, 2026 05:41
@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

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 24 changed files at 93a9fdbe3de47876ef7cae41c001c301fe7cda6d found no new substantiated defect. The existing lazy-partition-adaptation P2 (4597416579) is fixed, and the statement-owned reader suggestion (4608399054) is implemented. No existing P0/P1 inline blocker was identified.

Critical checkpoint conclusions:

  1. Goal and evidence: Encrypted table ownership is declined by shared caches; statement readers coalesce active loads while private results stay with consumers. Inspected fixtures cover classification, authorization retry and ownership boundaries. Encrypted SQL admission remains closed.
  2. Scope and abstraction: Changes focus on cache retention, statement ownership, manifest orchestration, tests and documentation, reusing existing guarded publication, admission and IO wrappers.
  3. Concurrency and locks: Scan pumps and metadata workers race cancellation/teardown. Reader state uses its monitor, elections use concurrent maps, and cache publication retains scope/key guards. Remote IO and owner cleanup stay outside reader/prefetch locks; no new lock-order defect was established.
  4. Lifecycle: Cache, loader, statement and actual-callable leases balance through declined retention, invalidation, cancellation and retirement. Losing/rejected reader registrations release ownership; completed registrations are removed before callbacks. No new static-initialization dependency is introduced.
  5. Configuration: No new setting or dynamic-update behavior is introduced.
  6. Compatibility: Cache API additions preserve existing callers; no public connector SPI, persisted storage format or production native ABI changes. Existing encrypted-read admission is preserved.
  7. Thrift/protobuf: No generated definitions, field IDs or enum values change.
  8. Parallel paths: Inspected synchronous/future/probe, data/position/equality-delete, count/weight, direct/bulk/CAS/refresh, streaming/eager and snapshot/SDK paths. All ordinary scans use the same frozen table namespace; snapshot/ref selection does not replace the reader's IO/spec generation. The pre-existing raw SDK boundary is described below.
  9. Conditions and errors: New branches explain concrete key-retention, descriptor-validation and lazy-projection cases. Errors remain exceptional; no new silent-success path was found.
  10. Tests: Inspected real encrypted manifests, invalid descriptors, KMS revocation, cross-statement isolation, same-statement coalescing, cancellation, registration races, bounded private retention and optional statistics. Native additions cover independent key/AAD state and cleanup after successful, cancelled and failed initialization. No encrypted SQL end-to-end acceptance is established.
  11. Expected results: No regression output files change. New unit assertions agree with the inspected control flow, including lazy data/delete partition projections; execution was not reproduced.
  12. Observability: Existing cache counters, path-bearing read failures, fallback logs and encryption classifications remain available. No additional logging requirement was identified.
  13. Transactions and persistence: No EditLog, replay, failover or transaction logic changes.
  14. Writes and atomicity: No production data-write path changes; existing invalidation-guarded cache commits remain intact.
  15. FE/BE variables: No transport variables or send paths change; C++ changes add tests only.
  16. Performance: Cold reads across statements may duplicate IO until plaintext classification, as documented. Warm probes avoid futures, completed plaintext entries remain reusable, and schema-evolved partition projections stay lazy. No additional performance regression was substantiated.
  17. Other invariants: No new data-correctness, visibility, delete-consistency, memory-ownership or exception-propagation defect was established. Native changes introduce no hub/PCH/template/unity or release ABI change.

User focus: no additional focus was supplied. Existing threads and replies were refreshed and deduplicated against this head.

Coverage limits: static inspection only; no builds, tests, benchmarks or runtime/KMS checks were executed, and author-reported validation was not independently reproduced. Unchanged direct COUNT/equality-discovery/nonstreaming SDK paths may still use SDK byte caching for otherwise plaintext tables carrying undeclared per-file key metadata. Those paths and their raw IO behavior exist at the merge base, with no new trigger established here; the earlier review also records this boundary. This review does not claim universal SDK cache cleanup, deterministic JVM key zeroization or encrypted SQL enablement. No unresolved in-scope candidate or changed-file coverage gap remains.

Review converged after 2 round(s).

Gabriel39 added a commit to Gabriel39/incubator-doris that referenced this pull request Nov 18, 2026
### Background

FE sends query fragments to BE using gRPC/BRPC. BE retrieves lazy external scan splits from FE over Thrift. OSS implementations expose TLS provider interfaces, while their private clients use plaintext and their servers reject TLS activation.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70675 (separate encrypted table/cache ownership hardening)
PR Type: Enhancement

Problem Summary:

OSS deployments need authenticated, encrypted internal RPC before transporting private file-key descriptors. Implement mutual TLS for fragment channels and blocking Thrift clients/listeners, using the existing TLS configuration and explicit protocol exclusions. Preserve the original certified hostname after DNS resolution, keep reconnects encrypted, and bound authentication IO independently of normal RPC read timeouts. Connection and server lifecycle tests also cover failed initialization and repeated cleanup.

### Details

- **Change map:** 930 changed production lines, 802 test/fixture lines, 97 documentation lines, and no generated files. Native TLS setup and bounded sockets live in `private_rpc_tls`; Java contexts and Thrift transports live in `tls`; OSS providers select them, and the shared Thrift server accepts a provider listener. Tests use ephemeral OpenSSL identities and real listeners.
- **Before and after:** Included private protocols now require a trusted peer certificate and encrypt their traffic. Authentication failures propagate to callers. Java and native Thrift reconnects retain TLS, and a peer that stalls before authentication cannot inherit an unlimited RPC idle timeout. Cleanup handles servers whose TLS validation failed before start, as well as a server already joined during explicit shutdown.
- **Configs and defaults:** `enable_tls=false` stays the default. Private TLS requires `verify_fail_if_no_peer_cert`, certificate/key/CA files, static refresh interval zero, and a positive Thrift connect timeout. Unsupported SAN allowlists and BE private-key passwords are rejected. See `docs/private-rpc-tls.md` for public-protocol exclusions, certificate rotation and dedicated-cluster-CA requirements. Native BRPC clients authenticate the configured CA trust domain; FE gRPC and Thrift clients additionally verify the target hostname/IP.
- **Impact on existing users:** Default plaintext deployments keep their transport behavior. Operators can opt into OSS private RPC mutual TLS with coordinated node configuration. Existing encrypted Iceberg SQL capability/admission checks remain in place.

### Testing

- Local repository `run-fe-ut.sh`: 11 tests passed, including real gRPC/Thrift authentication, hostname and CA rejection, plaintext control, reconnects in both transport modes, and stalled-handshake cleanup.
- Local repository `run-be-ut.sh`: 158 ASAN tests in 11 suites passed, including 11 TLS tests and native encrypted Parquet/data/delete/cancellation cases. New lifecycle tests reproduced null cleanup and repeated-join failures before the fixes; stalled-peer tests failed before bounded authentication was added.
- Full ASAN `build.sh --be --fe` passed with FE Checkstyle; clang-format 16, header hygiene and clang-tidy passed on the affected C++ files. The shipped BE ELF has no GLIBC requirement newer than 2.17.
- An isolated local FE/BE cluster completed authenticated heartbeats, a BE fragment query returning count 100 and sum 4950, an HMS data scan returning IDs 1–4, and a lazy V2 delete scan returning 1,3,4,6,8. The FE `fetchSplitBatch` RPC counter confirmed BE-to-FE split fetches.
- All four live private RPC endpoints accepted trusted identities and rejected missing/untrusted identities, wrong CA, wrong hostname and plaintext. Trusted connections succeeded again after rejection checks.
- Independent SDK 1.12.0 and Spark reference reads agreed on historical snapshots with real encrypted manifests, manifest lists and file keys. Default encrypted SQL still rejected admission with `READ_DISABLED`.

### Release note

OSS deployments can enable mutual TLS for internal gRPC/BRPC and blocking Thrift using the existing TLS settings. Private RPC mutual authentication, static certificate configuration and explicit exclusions for unsupported public protocols are required. The default remains disabled.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: Yes; operator and trust-boundary notes are included in `docs/private-rpc-tls.md`.
- Pre-submission status: Ready for transport review; encrypted SQL capability negotiation and broader encrypted-read acceptance are separate work.

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Implementation, tests, fixture script, documentation and this description.
- Human review: Pending maintainer review; agent self-review and local verification completed.
Gabriel39 added a commit to Gabriel39/incubator-doris that referenced this pull request Nov 18, 2026
### Background

Cached manifests expose query-local partition views after schema evolution.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70675
PR Type: Bugfix

Problem Summary:

Retention classification eagerly consumed lazy partition views before streaming scans could read their first file. Preserve the source manifest's retention decision when projecting partitions.

### Details

- **Frequency:** Warm scans whose partition types require adaptation.
- **Root cause:** The projected value constructor repeated key classification through transformed lists.
- **Why existing tests missed it:** Functional adaptation checks did not measure evaluation before consumption.
- **Fix:** Carry the unchanged key-retention classification into the query-local view.
- **Other paths and branches:** Cover data and delete files with and without key metadata. Disable automatic manifest merging in cancellation fixtures so their queue cardinality is independent of processor count.

### Testing

Four regression cases failed before the fix and passed afterward. Connector cache, SPI and Iceberg suites ran 2,342 tests with zero failures/errors and 11 existing skips. FE Checkstyle passed.

### Release note

Warm Iceberg scans preserve lazy partition adaptation after schema evolution.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Ready

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Code, tests and this description.
- Human review: Pending.
Gabriel39 added a commit to Gabriel39/incubator-doris that referenced this pull request Nov 18, 2026
### Background

FE sends query fragments to BE using gRPC/BRPC. BE retrieves lazy external scan splits from FE over Thrift. OSS implementations expose TLS provider interfaces, while their private clients use plaintext and their servers reject TLS activation.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70675 (separate encrypted table/cache ownership hardening)
PR Type: Enhancement

Problem Summary:

OSS deployments need authenticated, encrypted internal RPC before transporting private file-key descriptors. Implement mutual TLS for fragment channels and blocking Thrift clients/listeners, using the existing TLS configuration and explicit protocol exclusions. Preserve the original certified hostname after DNS resolution, keep reconnects encrypted, and bound authentication IO independently of normal RPC read timeouts. Connection and server lifecycle tests also cover failed initialization and repeated cleanup.

### Details

- **Change map:** 930 changed production lines, 802 test/fixture lines, 97 documentation lines, and no generated files. Native TLS setup and bounded sockets live in `private_rpc_tls`; Java contexts and Thrift transports live in `tls`; OSS providers select them, and the shared Thrift server accepts a provider listener. Tests use ephemeral OpenSSL identities and real listeners.
- **Before and after:** Included private protocols now require a trusted peer certificate and encrypt their traffic. Authentication failures propagate to callers. Java and native Thrift reconnects retain TLS, and a peer that stalls before authentication cannot inherit an unlimited RPC idle timeout. Cleanup handles servers whose TLS validation failed before start, as well as a server already joined during explicit shutdown.
- **Configs and defaults:** `enable_tls=false` stays the default. Private TLS requires `verify_fail_if_no_peer_cert`, certificate/key/CA files, static refresh interval zero, and a positive Thrift connect timeout. Unsupported SAN allowlists and BE private-key passwords are rejected. See `docs/private-rpc-tls.md` for public-protocol exclusions, certificate rotation and dedicated-cluster-CA requirements. Native BRPC clients authenticate the configured CA trust domain; FE gRPC and Thrift clients additionally verify the target hostname/IP.
- **Impact on existing users:** Default plaintext deployments keep their transport behavior. Operators can opt into OSS private RPC mutual TLS with coordinated node configuration. Existing encrypted Iceberg SQL capability/admission checks remain in place.

### Testing

- Local repository `run-fe-ut.sh`: 11 tests passed, including real gRPC/Thrift authentication, hostname and CA rejection, plaintext control, reconnects in both transport modes, and stalled-handshake cleanup.
- Local repository `run-be-ut.sh`: 158 ASAN tests in 11 suites passed, including 11 TLS tests and native encrypted Parquet/data/delete/cancellation cases. New lifecycle tests reproduced null cleanup and repeated-join failures before the fixes; stalled-peer tests failed before bounded authentication was added.
- Full ASAN `build.sh --be --fe` passed with FE Checkstyle; clang-format 16, header hygiene and clang-tidy passed on the affected C++ files. The shipped BE ELF has no GLIBC requirement newer than 2.17.
- An isolated local FE/BE cluster completed authenticated heartbeats, a BE fragment query returning count 100 and sum 4950, an HMS data scan returning IDs 1–4, and a lazy V2 delete scan returning 1,3,4,6,8. The FE `fetchSplitBatch` RPC counter confirmed BE-to-FE split fetches.
- All four live private RPC endpoints accepted trusted identities and rejected missing/untrusted identities, wrong CA, wrong hostname and plaintext. Trusted connections succeeded again after rejection checks.
- Independent SDK 1.12.0 and Spark reference reads agreed on historical snapshots with real encrypted manifests, manifest lists and file keys. Default encrypted SQL still rejected admission with `READ_DISABLED`.

### Release note

OSS deployments can enable mutual TLS for internal gRPC/BRPC and blocking Thrift using the existing TLS settings. Private RPC mutual authentication, static certificate configuration and explicit exclusions for unsupported public protocols are required. The default remains disabled.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: Yes; operator and trust-boundary notes are included in `docs/private-rpc-tls.md`.
- Pre-submission status: Ready for transport review; encrypted SQL capability negotiation and broader encrypted-read acceptance are separate work.

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Implementation, tests, fixture script, documentation and this description.
- Human review: Pending maintainer review; agent self-review and local verification completed.
Gabriel39 added a commit to Gabriel39/incubator-doris that referenced this pull request Nov 18, 2026
### Background

Cached manifests expose query-local partition views after schema evolution.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70675
PR Type: Bugfix

Problem Summary:

Retention classification eagerly consumed lazy partition views before streaming scans could read their first file. Preserve the source manifest's retention decision when projecting partitions.

### Details

- **Frequency:** Warm scans whose partition types require adaptation.
- **Root cause:** The projected value constructor repeated key classification through transformed lists.
- **Why existing tests missed it:** Functional adaptation checks did not measure evaluation before consumption.
- **Fix:** Carry the unchanged key-retention classification into the query-local view.
- **Other paths and branches:** Cover data and delete files with and without key metadata. Disable automatic manifest merging in cancellation fixtures so their queue cardinality is independent of processor count.

### Testing

Four regression cases failed before the fix and passed afterward. Connector cache, SPI and Iceberg suites ran 2,342 tests with zero failures/errors and 11 existing skips. FE Checkstyle passed.

### Release note

Warm Iceberg scans preserve lazy partition adaptation after schema evolution.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Ready

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Code, tests and this description.
- Human review: Pending.

@924060929 924060929 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.

Reviewed the FE changes at 93a9fdb. The statement-owned manifest reader addresses the earlier suggestion: it coalesces active reads within a statement, isolates different statements, and removes completed private registrations while preserving active I/O ownership through cancellation. No new blocking issue found.

Local validation: 378 focused cache and Iceberg tests passed with no failures or skips; relevant module Checkstyle passed. Native BE tests and end-to-end encrypted SQL were not run locally; encrypted SQL admission remains closed.

@Gabriel39
Gabriel39 merged commit 6d697e8 into apache:master Nov 19, 2026
41 of 42 checks passed
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: 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
freemandealer added a commit to freemandealer/doris that referenced this pull request Nov 19, 2026
### Background

The existing PR and master both stabilize the Iceberg SDK cancellation
fixtures by preventing automatic manifest merging.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70282 (existing PR), apache#70675 (upstream fixture update)
PR Type: Build/CI/Chore

Problem Summary:

The two equivalent fixture changes conflict when integrating master.
Merge master and retain its exact Iceberg test file, including the newer
test coverage and the assertions on queued readers and cancellation.

### Details

- **Affected:** FE test integration; both existing Git histories are retained.
- **Developer and release impact:** Restore mergeability without changing the PR's feature behavior.
- **License and third-party:** None.
- **Rollback:** Revert this merge with its first parent as the mainline.

### Testing

- Git merge-tree reproduced the single-file conflict before resolution.
- git diff --check passed for the resulting PR delta against master.
- Verified the resolved test blob equals master and retains its cancellation assertions.
- Verified every other resolved blob equals Git's automatic merge output.
- Local runtime tests were not run; CI must validate the new merge commit.

### Release note

None.

### Check List (For Author)

- Behavior changed: No
- Does this need documentation: No
- Pre-submission status: Partially verified: runtime CI is pending on the new merge commit.

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Merge resolution, structural checks and this commit description.
- Human review: Not stated.
freemandealer added a commit to freemandealer/doris that referenced this pull request Nov 19, 2026
### Background

The existing PR and master both stabilize the Iceberg SDK cancellation
fixtures by preventing automatic manifest merging.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70142 (existing PR), apache#70675 (upstream fixture update)
PR Type: Build/CI/Chore

Problem Summary:

The two equivalent fixture changes conflict when integrating master.
Merge master and retain its exact Iceberg test file, including the newer
test coverage and the assertions on queued readers and cancellation.

### Details

- **Affected:** FE test integration; both existing Git histories are retained.
- **Developer and release impact:** Restore mergeability without changing the PR's feature behavior.
- **License and third-party:** None.
- **Rollback:** Revert this merge with its first parent as the mainline.

### Testing

- Git merge-tree reproduced the single-file conflict before resolution.
- git diff --check passed for the resulting PR delta against master.
- Verified the resolved test blob equals master and retains its cancellation assertions.
- Verified every other resolved blob equals Git's automatic merge output.
- Local runtime tests were not run; CI must validate the new merge commit.

### Release note

None.

### Check List (For Author)

- Behavior changed: No
- Does this need documentation: No
- Pre-submission status: Partially verified: runtime CI is pending on the new merge commit.

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Merge resolution, structural checks and this commit description.
- Human review: Not stated.
924060929 added a commit to 924060929/incubator-doris that referenced this pull request Nov 20, 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 that referenced this pull request Nov 23, 2026
…70410)

### 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
Gabriel39 added a commit that referenced this pull request Nov 23, 2026
### Background

Private fragment gRPC/BRPC and split-fetch Thrift already expose
provider interfaces, but the OSS implementations use plaintext or reject
TLS activation. Internal RPC needs authenticated encryption before it
can safely carry unwrapped file-key descriptors.

### What problem does this PR solve?

Issue Number: close #70740
Related PR: #70675 (separate key/cache ownership work)
PR Type: Enhancement

Problem Summary:

Implement mutual TLS for the built-in private RPC providers using
existing settings. Preserve peer identities, bounded authentication and
failure handling, while separating internal connections from brokers,
functions and independent Doris clusters. Most of the diff exercises
transport integration and compatibility.

### Details

- **Change map:** 78 files: 1,750 changed production lines, 3,615
test/fixture/configuration lines, 27 expected-result lines, 142
documentation lines, 10 dependency lines and 5 build lines. [Design
document](#70740).
- **Before and after:** Included private protocols encrypt traffic and
require trusted peer certificates. DNS resolution/reopen retains the
original identity; authentication failures return existing
Status/null-client results without plaintext fallback. BE-JVM MaxCompute
block allocation inherits the local BE policy, including writer rotation
and FE master redirection. Worker execution and result fetching share
one RPC-layer target for prepare/start/cancel/fetch/eviction;
complete-graph admission remains before dispatch.
- **Configs and defaults:** Existing enable_tls=false stays unchanged.
Private TLS requires mutual verification, certificate/key/CA files,
static refresh and positive bounded Thrift connect timeouts. Unsupported
SAN allowlists and BE key passwords are rejected. Native BRPC
authenticates the configured CA trust domain; FE gRPC and Java/native
Thrift additionally verify hostname/IP. Node identity must not be shared
with unrelated services. [Operator
guide](https://github.com/Gabriel39/incubator-doris/blob/dev/oss-private-rpc-tls/docs/private-rpc-tls.md).
- **Impact on existing users:** Disabled TLS keeps plaintext behavior;
activation requires coordinated node configuration and deployment.
Mixed-version FE/BE rolling-upgrade compatibility is outside this PR's
supported scope. Brokers, RPC functions and remote Doris clients retain
isolated external policies, including reconnects and same-address
lookups. Remote reads use the existing default Arrow Flight mode under
OSS private BRPC/Thrift; incompatible remote-worker graphs are rejected
before dispatch. File-key descriptors cannot leave on external plaintext
fragment channels. Legacy provider contracts remain. Optional
TOlapTableSink.remote_endpoint field 26 defaults false and was checked
on master/4.2/4.1/4.0/3.1. The plugin adds the PKIX reader at the
existing BC version for native-compatible PKCS#1 PEM keys.

### Testing

- Heartbeat test adaptation: the official FE runner reproduces seven
failures across eight handler tests before the fix, then passes all
eight after updating mocks, verifications and real-pool cleanup to
retain the peer name. Three TLS heartbeat compatibility tests and one
legacy Thrift provider compatibility test also pass, with no skips; FE
Checkstyle reports zero violations.
- Full fresh FE, ASAN BE and Java-plugin builds pass. The official FE
runner passes 60 selected tests across nine classes; the native runner
passes 33 ASAN tests across three suites.
- MaxCompute coverage includes real authenticated block-allocation RPCs
from writer initialization/rotation, master redirection, plaintext
controls, untrusted clients, wrong hostnames, missing-key redaction,
bounded idle-peer authentication and PKCS#1 keys. The storage session is
mocked. An isolated class loader using only the deployed plugin
directory also authenticates with PKCS#1 and reuses its connection.
- The default p0/nonConcurrent rpc_p0 regression provisions one TLS
FE/two TLS BEs plus an independent plaintext FE/BE. Fresh-package replay
passes six ordered read/join result blocks, five direct-worker refusals
and zero skips. Nine embedded helper tests and trusted/missing/untrusted
authentication on seven private listeners pass. No enable flag or
supplied remote endpoint/account is needed; missing packages/setup fail.
Unsupported hosts return before helper processes; a simulated-macOS
admission test passes.
- Callback-policy, real TLS allocation/plaintext refusal, repeated-fetch
binding, unsupported-platform admission and PKCS#1 tests reproduce their
failures before the relevant fixes.
- FE Checkstyle, clang-format 16 on all 29 affected native files, header
hygiene and scoped clang-tidy pass.

Live MaxCompute storage integration and native macOS deployment were not
run. Full remote auto-partition SQL acceptance, native RELEASE/ABI
acceptance and fresh CI remain separate; unrelated remote
metadata/replica-ID failures reproduce with TLS disabled. Encrypted
Iceberg SQL admission stays gated pending its own reader/capability
acceptance.

### Release note

OSS deployments can enable mutual TLS for private gRPC/BRPC and blocking
Thrift with coordinated settings. Defaults stay disabled. Internal
MaxCompute FE callbacks follow the BE identity; remote Doris reads
retain Arrow Flight mode under private TLS.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: Yes; the operator guide is included and
apache/doris-website#4666 provides the bilingual guide.
- Pre-submission status: Partially verified: local builds and targeted
tests pass; fresh CI and broader encrypted-read acceptance remain
pending.

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Code, tests, fixtures, documentation and this description.
- Human review: not stated
Gabriel39 added a commit that referenced this pull request Nov 25, 2026
…70697)

### Background

Iceberg v3 can encrypt manifests and give each Parquet data/delete file
an independent key. Doris plans those files in FE and reads them in BE,
so metadata support and an encryption-enabled Arrow build alone cannot
establish a safe native execution path. The [read
contract](https://github.com/Gabriel39/incubator-doris/blob/dev/iceberg-pme-native-read-integration/fe/fe-connector/docs/iceberg-encryption-read.md)
describes the supported combinations.

### What problem does this PR solve?

Issue Number: close #70715
Related PR: #70675 (merged statement/cache prerequisite), #70693 (merged
private RPC prerequisite)
PR Type: Feature

Problem Summary:

Operators need a supported execution path for standard encrypted HMS v3
tables, including independently encrypted delete files. Verify native
reader availability and authenticated private RPC, preserve binary
keys/AAD, and recheck recipients before keys leave FE. The prerequisites
are now merged; this diff contains the integration, independent
write/cache admission guards, and their tests and fixtures. Encrypted
reads remain disabled by default, and enabling them grants neither
encrypted writes nor encrypted SQL result caching.

### Details

- **Change map:** 71 files: 810 changed production lines, 2,113
test/fixture lines, 183 expected-result lines, 436 documentation lines
and 4 build lines. Production connects reader availability, protected
fragment/split dispatch and per-file native formats; independent
write/cache fences preserve authorization boundaries. Admission shares
the selected external-scan candidate membership, and send-time
validation binds capability to the registered RPC recipient. Merged
prerequisite implementations and per-split version negotiation are
excluded.
- **Scope:** HMS v3, the SDK standard encryption manager and native
Parquet AES_GCM_V1 data/position-delete/equality-delete reads. REST
native encrypted execution, encrypted JNI metadata tables, encrypted
ORC/Puffin deletion vectors, encrypted writes and encrypted V3 lazy SQL
execution remain unsupported.
- **Design:** A boolean `supports_native_file_encryption` heartbeat
reports native PME reader and protected private RPC availability.
Admission and default external scans share one selected candidate
membership per statement planning attempt and compute group, using the
existing planning-only statement scope. The untagged root/admin group
uses a stable selection domain because it has no addressable ID. A
shared policy alone cannot stabilize randomized candidate subsets. Check
targets before serialization; before sending fragment keys, re-resolve
the bound BE ID, match its registered BRPC address to the bound RPC
target, and verify current capability. Marker checks follow executed
file nodes; actual shared keys are always validated and protected. Lazy
sources retain their original BRPC address and require the same current
backend registration before returning split keys; dropping, replacing or
moving a recipient stops the source. Existing load, serial and delete
restrictions govern PME coalescing and row-group refinement. V3 selects
synchronous planning before any batch-estimation metadata COUNT probe. A
fresh runtime timestamp bounds the heartbeat proof, and missing
capability remains a planning refusal without blacklisting healthy
backends. #70715 records the proposal and acceptance criteria; a
completed design discussion is not claimed.
- **Usage:** Configure authenticated private RPC on every participating
FE/BE, set the following in every FE's Iceberg plugin `iceberg.conf`,
then restart the FEs. Use an HMS catalog configured with the supported
standard encryption manager and KMS. See the [private RPC
configuration](https://github.com/Gabriel39/incubator-doris/blob/dev/iceberg-pme-native-read-integration/docs/private-rpc-tls.md),
read contract and [reference
fixture](https://github.com/Gabriel39/incubator-doris/blob/dev/iceberg-pme-native-read-integration/docker/thirdparties/docker-compose/iceberg/encryption/README.md)
for the complete deployment setup.

  ```properties
  enable_encryption_read=true
  ```

- **Default behavior:** `enable_encryption_read=false`; this is
deployment configuration requiring an FE restart, not a session variable
or catalog property. Plaintext reads retain existing paths. Encrypted
writes are independently refused, and encrypted tables reject SQL-cache
admission/replay because stable metadata cannot attest current KMS
authorization.
- **Compatibility:** Connector SPI 37.0 adds
`supportsNativeFileEncryption(): boolean` over master's 36.0 while
retaining its file-format SPI; matching FE, BE and plugins are deployed
together with consistent private TLS. The new optional heartbeat boolean
uses field 12, checked against master and branches 4.2/4.1/4.0/3.1. The
split request retains its original fields. Runtime reader and
authenticated-transport checks still apply; custom providers default to
unavailable. Rolling upgrades and downgrade support are outside scope.
The version inside each file-key descriptor remains a data-format
discriminator.
- **Behavior change:** Verified, explicitly enabled HMS deployments can
execute supported encrypted reads. Unsupported readers/transports fail
with classified errors; concurrent adoption of encryption cannot admit
plaintext native writes. Default external scans in one statement/group
now share candidate membership, including partial compute/mixed subsets,
while each scan retains its own split-assignment strategy and weights.
Preferred-location and explicitly supplied policies remain independent.
- **Persistence and failure handling:** File keys remain query-scoped
and are excluded from durable caches and diagnostics. Reader leases
survive cancellation until actual I/O exits. Existing transaction CAS
and pinned metadata/schema checks remain in place. Failed/missing
heartbeat proofs revoke capability without shortening the configured
backend liveness grace.
- **Security and privileges:** Existing catalog CREATE/ALTER and table
SELECT checks apply; no privilege is added. User-configured KMS/S3
endpoints remain outbound SSRF surfaces subject to existing policy. Both
fragment gRPC and split Thrift must establish authenticated encryption
before key serialization. Fixtures use synthetic data and credentials.
Deterministic memory zeroization and protected crash dumps are not
promised.

### Testing

- Rebased all 12 commits onto master `02913a2235`. Both sides had
independently allocated SPI 36.0; the combined surface now uses 37.0.
Fresh module selection passed 502 tests across 48 suites, zero
failures/errors/skips: all 37 SPI test classes and related Iceberg
encryption, write, sorting, worker and metadata-delete suites. Official
FE selection passed 238 tests in 16 suites, zero failures/errors/skips,
including host loading, file-format TVFs, heartbeat, RPC/TLS, selection
and split lifecycle.
- Existing real-default-group and live-recipient regressions remain
included. Their baseline failures reproduce the External selection
exception and encrypted split delivery after backend drop, replacement
or address changes.
- Earlier guard/coalescing and encrypted-v3 COUNT evidence remains
historical on unchanged relevant code. Fresh scoped clang-tidy passes
all eight PR C++ files using the existing UT compilation database; BE UT
remains blocked by missing `libgoogle_cloud_cpp_oauth2.a`.
- Earlier native/SQL results are recorded in the [validation
record](https://github.com/Gabriel39/incubator-doris/blob/dev/iceberg-pme-native-read-integration/fe/fe-connector/docs/iceberg-encryption-validation.md).
A fresh External rerun is required after this update. Full FE packaging,
native PME/TLS SQL, live KMS, cloud runtime and performance/security
acceptance remain unverified. Enabled encrypted SQL suites require
`enableIcebergTest=true`, `enableIcebergEncryptionNativeRead=true` and a
prepared deployment.

### Notes for Reviewers

Only membership is memoized; capabilities remain live. The planning
scope coalesces selection and releases the list at planning
completion/reset. Admission creates no hash ring. This also shares
membership across plaintext default scans; no runtime distribution
benchmark is claimed.

Fresh FE Checkstyle, clang-format 16.0.6, header hygiene and scoped
clang-tidy pass. All eight PR C++ files are byte-identical to the
pre-rebase head. A full native build and enabled encrypted SQL were not
rerun.

### Release note

Adds opt-in native reads for supported standard-encrypted HMS Iceberg v3
Parquet tables, requiring verified backend capabilities and
authenticated private RPC. Encrypted writes remain unsupported.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: Yes;
implementation/configuration/fixture guides are included. A user-facing
website guide is planned after the support boundary is accepted.
- Pre-submission status: Partially verified: native build/tests remain
blocked by an incomplete local dependency bundle. Full FE packaging,
enabled encrypted SQL, live KMS and performance/security acceptance were
not rerun.

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: code, tests, fixtures, documentation and this description;
this follow-up rebases the reviewed changes onto current master and
preserves both SPI surfaces with API 37.0.
- Human review: not stated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants