Skip to content

backups: use cloned storage client with overridden retry policy settings for native copy - #87660

Merged
jkartseva merged 18 commits into
ClickHouse:masterfrom
jkartseva:clone-storage-client-backups
Oct 10, 2025
Merged

jkartseva merged 18 commits into
ClickHouse:masterfrom
jkartseva:clone-storage-client-backups

Conversation

@jkartseva

@jkartseva jkartseva commented Sep 26, 2025 •

Copy link
Copy Markdown
Member

Backups use S3 client settings that differ from the settings of the disk client, for example, an increased number of retries and longer delays.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Use S3 storage client with backup-specific settings (for example, backup_slow_all_threads_after_retryable_s3_error) for server-side (native) copy to a backup destination. Make s3_slow_all_threads_after_retryable_error obsolete.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@jkartseva jkartseva added the can be tested Allows running workflows for external contributors label Sep 26, 2025
@jkartseva
jkartseva marked this pull request as draft September 26, 2025 00:03
@clickhouse-gh

clickhouse-gh Bot commented Sep 26, 2025 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b36cd89]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Sep 26, 2025
@jkartseva jkartseva changed the title [test] Replace storage client with backup client for native copy backups: use cloned storage client with overridden retry policy settings for native copy Sep 26, 2025
@jkartseva
jkartseva force-pushed the clone-storage-client-backups branch from b5ecb5d to 283b6e6 Compare October 3, 2025 03:51
@clickhouse-gh clickhouse-gh Bot added pr-improvement Pull request with some product improvements and removed pr-not-for-changelog This PR should not be mentioned in the changelog labels Oct 3, 2025
@jkartseva
jkartseva marked this pull request as ready for review October 3, 2025 05:26
Comment thread src/Backups/BackupIO_S3.cpp Outdated
else
{
auto locked = it->second.disk_reported_client.lock();
if (locked != disk_client)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Create a new client if the underlying pointer of disk->getS3StorageClient() has changed, e.g., as a result of disk->applyNewSettings.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is set initially when inserted is true. Then, if the stored client pointer (locked) equals the current client pointer in the object storage, no update is required, and the stored client will be reused.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry maybe i am missing something, why do we need disk_reported_client here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

To be able to update the client if it was reset externally, for example, as a result of a settings update here: https://github.com/ClickHouse/ClickHouse/blob/master/src/Disks/ObjectStorages/S3/S3ObjectStorage.cpp#L509

disk_reported_client serves as a reference (hence, weak_ptr)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks, @SmitaRKulkarni. I'll add clarifying comments, as this place seems to be confusing.

@SmitaRKulkarni SmitaRKulkarni self-assigned this Oct 3, 2025

@SmitaRKulkarni SmitaRKulkarni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rest all LGTM

@jkartseva
jkartseva enabled auto-merge October 9, 2025 01:03
@jkartseva
jkartseva force-pushed the clone-storage-client-backups branch from 47d6cc3 to 4706d7b Compare October 9, 2025 08:05
@jkartseva
jkartseva force-pushed the clone-storage-client-backups branch from f987588 to a34f46a Compare October 9, 2025 21:57
@jkartseva
jkartseva force-pushed the clone-storage-client-backups branch from 2a67f55 to 55eec65 Compare October 10, 2025 03:08
@jkartseva
jkartseva force-pushed the clone-storage-client-backups branch from 4858a60 to b36cd89 Compare October 10, 2025 08:45
@jkartseva
jkartseva added this pull request to the merge queue Oct 10, 2025
Merged via the queue into ClickHouse:master with commit 22aa997 Oct 10, 2025
@jkartseva
jkartseva deleted the clone-storage-client-backups branch October 10, 2025 20:38
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 10, 2025
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added pr-backports-created-cloud deprecated label, NOOP pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR labels Oct 13, 2025
robot-clickhouse added a commit that referenced this pull request Oct 13, 2025
…ridden retry policy settings for native copy
jkartseva added a commit that referenced this pull request Oct 14, 2025
Backport #87660 to 25.9: backups: use cloned storage client with overridden retry policy settings for native copy
robot-clickhouse added a commit that referenced this pull request Oct 14, 2025
…ridden retry policy settings for native copy
@robot-ch-test-poll robot-ch-test-poll added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Oct 14, 2025
jkartseva added a commit that referenced this pull request Oct 15, 2025
Backport #87660 to 25.8: backups: use cloned storage client with overridden retry policy settings for native copy
jkartseva added a commit that referenced this pull request Nov 11, 2025
…ith overridden retry policy settings for native copy"
jkartseva added a commit that referenced this pull request Oct 24, 2026
…ans to

`cloneWithConfigurationOverride` passed the configuration of the client being cloned straight on, keeping its
`retryStrategy`, the object the SDK retries with: `ClientFactory::create` is the only place that builds one, from
`retry_strategy`, so overriding that field alone changed nothing. The clone now builds it, with the same cap on
`backup_slow_all_threads_after_retryable_s3_error` as the factory. This is what makes the retries of a backup or
a restore reach the client of a disk at all, so it also completes the override of #87660.

`DataSourceDescription::sameKind` compares the endpoint, so a backup on another one sent the restore through the
buffers of `BackupReaderDefault` instead of the native branch the fallback lives in. The tests put the backup on
the endpoint of the disk, where the client of the destination is the one that uploads.

The injected answer carries `SlowDown` as its code and `Slow Down.` as its message, and the message is what
surfaces, as `test_checking_s3_blobs_paranoid` already records. The assertion matches that.

The new disk is added to the expectation of `check_system_tables`, which asserts the exact number of disks.

Co-Authored-By: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-backports-created-cloud deprecated label, NOOP pr-improvement Pull request with some product improvements pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants