Cherry pick #107480 to 26.3: DeltaLake: replace cached snapshot on update() so kernel sees fresh creds by robot-clickhouse · Pull Request #108110 · ClickHouse/ClickHouse · GitHub
Skip to content

Cherry pick #107480 to 26.3: DeltaLake: replace cached snapshot on update() so kernel sees fresh creds#108110

Merged
robot-ch-test-poll merged 18 commits into
backport/26.3/107480from
cherrypick/26.3/107480
Jun 25, 2026
Merged

Cherry pick #107480 to 26.3: DeltaLake: replace cached snapshot on update() so kernel sees fresh creds#108110
robot-ch-test-poll merged 18 commits into
backport/26.3/107480from
cherrypick/26.3/107480

Conversation

@robot-clickhouse

Copy link
Copy Markdown
Member

Original pull-request #107480

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

ahmadov and others added 17 commits June 15, 2026 07:36
…reds

The fresh snapshot rebuilt inside `update()` already captures the
C++ S3 client's current creds via `createBuilder` keep it instead of
discarding it when the version matches, so the next kernel op runs on
a freshly-credentialed engine and doesn't outlive the STS TTL.
Compare a SipHash128 of the C++ S3 client's current credentials against the
one captured when kernel_snapshot_state was built, and rebuild only the kernel
engine + snapshot + scan when they differ. Schema, stats, and the snapshot
LRU cache are preserved across rebuilds.
The previous wording change broke
test_database_delta::test_complex_table_schema's contains_in_log
assertion. Split the init and rebuild branches so the init path emits
the original message verbatim.
Vended catalog credentials (Glue / Unity / REST) are static in the C++
S3 client until `credentials_refresh_callback` fires, but delta-kernel's
Rust object_store bypasses the ClickHouse error handlers that normally
invoke it. So an expired vended session surfaces as `DELTA_KERNEL_ERROR`
with `ExpiredToken` and never recovers.

Plumb the callback through `IObjectStorage::tryRefreshCredentialsViaCallback`
to `IKernelHelper::refreshCredentials`, and add a one-shot retry on
stale-token errors at both kernel touchpoints:
  - `TableSnapshot::initOrUpdateSnapshot` (engine build)
  - `Iterator::scanDataFunc` (per-batch listing, guarded by
    `total_data_files == 0` so we don't replay already-emitted paths)
…ider

SetNeedRefresh() was a no-op for STS-assumed-role; align with WebIdentity/SSO behavior in the same file.
On failure leave m_needsRefresh and cached credentials in place so the next GetAWSCredentials retries STS instead of handing back the S3-rejected session.
Two failpoints to exercise the retry path without a real catalog:
  - `delta_kernel_force_stale_token_error` (ONCE) throws DELTA_KERNEL_ERROR
    with `ExpiredToken` in the message from `KernelSnapshotState`.
  - `object_storage_force_refresh_callback_success` short-circuits
    `S3ObjectStorage::tryRefreshCredentialsViaCallback` to succeed without
    needing a Glue / Unity / REST catalog wired in.

Combined with `delta_kernel_force_credentials_fingerprint_drift` to force
the rebuild branch in `initOrUpdateSnapshot`, the test asserts the
"refreshed via catalog callback and retrying" log line fires and the
query still returns the correct row count.
Forwards to the same shape as `getS3StorageClient` / `tryGetS3StorageClient`.
…date

DeltaLake: replace cached snapshot on update() so kernel sees fresh creds
@robot-clickhouse robot-clickhouse added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Jun 22, 2026
@kssenii kssenii removed their assignment Jun 22, 2026
@robot-ch-test-poll

Copy link
Copy Markdown
Contributor

@robot-ch-test-poll robot-ch-test-poll merged commit 478fabb into backport/26.3/107480 Jun 25, 2026
1 check passed
@robot-ch-test-poll robot-ch-test-poll deleted the cherrypick/26.3/107480 branch June 25, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants