Repository navigation
Add setting max_backup_bandwidth to backup/restore query - #72665
Conversation
|
This is an automated comment for commit a8a4e0e with description of existing statuses. It's updated for the latest CI running ✅ Click here to open a full report in a separate page Successful checks
|
|
|
||
| query_id=$(random_str 10) | ||
| $CLICKHOUSE_CLIENT --query_id "$query_id" -q "backup table data to Disk('backups', '$CLICKHOUSE_DATABASE/data/backup1')" --max_backup_bandwidth=1M > /dev/null | ||
| $CLICKHOUSE_CLIENT --query_id "$query_id" -q "backup table data to Disk('backups', '$CLICKHOUSE_DATABASE/data/backup1') SETTINGS max_backup_bandwidth=1e6" > /dev/null |
There was a problem hiding this comment.
Worth to add a separate test case (just a below in this file) for newly added setting instead of replacing existing.
| std::optional<UUID> backup_uuid; | ||
|
|
||
| /// The maximum read speed in bytes per second for a backup. Zero means unlimited. | ||
| std::optional<UInt64> max_backup_bandwidth; |
There was a problem hiding this comment.
It's not the first time when we need to pass a global setting to BACKUP or RESTORE command, so I believe it will be useful to support not only max_backup_bandwidth but any global settings after BACKUP ... SETTINGS and after RESTORE ... SETTINGS.
In order to do that just replace this field here in BackupSettings with
SettingsChanges other_settings;
and also replace throwing an exception in BackupSettings::fromBackupQuery() with
other_settings.emplace_back(setting);
and add call backup_context->applySettingsChanges(backup_settings.other_settings) after making backup_context in BackupStarter::BackupStarter.
|
I think I'll merge this PR and then I'll do some refactoring to allow other global settings after |
Ok, sure. It was on my list of things to do, but hard to find the time. Happy for you to do it, thanks! |
At the moment,
max_backup_bandwidthcannot be set directly in theBACKUP/RESTOREquery, it has to be set for the session, e.g., viaSET max_backup_bandwidth=N,clickhouse-client --max_backup_bandwidth=Nor URL parameter.This PR allows specifying it with
BACKUP|RESTORE ... SETTINGS max_backup_bandwidth=making it more straightforward to use.There is a bit of a quirk where
max_backup_bandwidthalso applies toRESTORE. It might be more logical to have a settingmax_restore_bandwidth. But since the setting applies to bothBACKUPandRESTOREcommands today when set for the session I've also added it as a query setting for both.I thought of adding a brand new test but it felt like overkill given it would just be copying an existing test and specifying the setting differently. So I modified an existing test, hope that's ok.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Adds setting
max_backup_bandwidthto the list of settings that can be specified as part ofBACKUP/RESTOREqueries.