-
Notifications
You must be signed in to change notification settings - Fork 8.3k
BACKUP doesn't work with SQL-defined named collections #94604
Copy link
Copy link
Closed
Labels
unexpected behaviourResult is unexpected, but not entirely wrong at the same time.Result is unexpected, but not entirely wrong at the same time.unfinished code
Description
Company or project name
ClickHouse
Describe the unexpected behaviour
When using BACKUP or RESTORE with named collections created via CREATE NAMED COLLECTION (SQL-defined), the operation fails with "There is no named collection" error. Only XML-config defined named collections work.
How to reproduce
It happens with s3:
-- Create a named collection via SQL
CREATE NAMED COLLECTION my_s3_backup AS
url = 'http://minio1:9001/root/data/backup1',
access_key_id = 'minio',
secret_access_key = 'minio123';
-- This fails with: "There is no named collection `my_s3_backup`"
BACKUP TABLE test_table TO S3(my_s3_backup);And also with Azure:
CREATE NAMED COLLECTION my_azure_backup AS
storage_account_url = 'http://azurite1:10000/devstoreaccount1',
container = 'cont',
account_name = 'devstoreaccount1',
account_key = '...';
-- This fails with: "There is no named collection `my_azure_backup`"
BACKUP TABLE test_table TO AzureBlobStorage(my_azure_backup);Expected behavior
Both XML-config and SQL-defined named collections should work with BACKUP and RESTORE commands.
Error message and/or stacktrace
| E Code: 36. DB::Exception: Received from 172.16.2.9:9000. DB::Exception: There is no collection named `sql_named_collection_s3_backup_override` in config. Stack trace:
| E
| E 0. ./ci/tmp/build/./src/Common/Exception.cpp:138: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x00000000166dfb2a
| E 1. ./src/Common/Exception.h:172: DB::Exception::Exception(String&&, int, String, bool) @ 0x000000000e09dd4e
| E 2. ./src/Common/Exception.h:58: DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000e09d689
| E 3. ./src/Common/Exception.h:190: DB::Exception::Exception<String const&>(int, FormatStringHelperImpl<std::type_identity<String const&>::type>, String const&) @ 0x000000000e0b1ff6
| E 4. ./ci/tmp/build/./src/Backups/registerBackupEngineS3.cpp:78: std::shared_ptr<DB::IBackup> std::__function::__policy_func<std::shared_ptr<DB::IBackup> (DB::BackupFactory::CreateParams const&)>::__call_func[abi:ne210105]<DB::registerBackupEngineS3(DB::BackupFactory&)::$_0>(std::__function::__policy_storage const*, DB::BackupFactory::CreateParams const&) (.llvm.12872568513663685257) @ 0x000000001a23ed2a
| E 5. ./contrib/llvm-project/libcxx/include/__functional/function.h:508: ? @ 0x000000001a1669fb
| E 6. ./ci/tmp/build/./src/Backups/BackupsWorker.cpp:561: void std::__function::__policy_func<void ()>::__call_func[abi:ne210105]<DB::BackupsWorker::startMakingBackup(std::shared_ptr<DB::IAST> const&, std::shared_ptr<DB::Context const> const&)::$_0>(std::__function::__policy_storage const*) @ 0x000000001a164ecc
| E 7. ./contrib/llvm-project/libcxx/include/__functional/function.h:508: ? @ 0x0000000018311275
| E 8. ./contrib/llvm-project/libcxx/include/future:1601: std::packaged_task<void ()>::operator()() @ 0x000000001831142c
| E 9. ./contrib/llvm-project/libcxx/include/__functional/function.h:508: ? @ 0x000000001683baeb
| E 10. ./contrib/llvm-project/libcxx/include/__type_traits/invoke.h:0: void std::__function::__policy_func<void ()>::__call_func[abi:ne210105]<ThreadFromGlobalPoolImpl<false, true>::ThreadFromGlobalPoolImpl<void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::*)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool*>(void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::*&&)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool*&&)::'lambda'()>(std::__function::__policy_storage const*) @ 0x0000000016842926
| E 11. ./contrib/llvm-project/libcxx/include/__functional/function.h:508: ? @ 0x0000000016838e0f
| E 12. ./contrib/llvm-project/libcxx/include/__type_traits/invoke.h:0: void* std::__thread_proxy[abi:ne210105]<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*>>(void*) @ 0x00000000168401da
| E 13. ? @ 0x0000000000094ac3
| E 14. ? @ 0x00000000001268c0
| E . (BAD_ARGUMENTS)
| E (query: BACKUP TABLE data TO S3(sql_named_collection_s3_backup_override, url='http://minio1:9001/root/data/backups/backup52') )
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
unexpected behaviourResult is unexpected, but not entirely wrong at the same time.Result is unexpected, but not entirely wrong at the same time.unfinished code