diff --git a/docs/en/antalya/cas/roadmap.md b/docs/en/antalya/cas/roadmap.md index 14578bd420585..e35247dc63063 100644 --- a/docs/en/antalya/cas/roadmap.md +++ b/docs/en/antalya/cas/roadmap.md @@ -80,9 +80,8 @@ positioning. - **Other S3-compatible object stores qualify only if they pass the capability probe** — a store that silently ignores conditional writes is refused at mount time rather than trusted. Bucket versioning must be off; it is not required to be on. -- **An `encrypted` disk wrapping a `CAS` disk is not supported yet** — `CREATE TABLE` on such a - disk succeeds, but the first `INSERT` fails (`Autocommit writes are not supported for content part - files on a content-addressed disk`). Layering a `cache` disk in front of `CAS` is the supported +- **An `encrypted` disk wrapping a `CAS` disk is not supported yet** — the disk is rejected when it + is created (`Encrypted disk cannot wrap a content-addressed disk`). Layering a `cache` disk in front of `CAS` is the supported wrapper shape (see [configuration](/antalya/cas/configuration)); encryption at rest currently has to come from the object store side. - **The format and settings surface can still change.** CAS is pre-release: there is no persisted diff --git a/src/Disks/DiskEncrypted.cpp b/src/Disks/DiskEncrypted.cpp index 6d8bf098c3637..31aed10d79ed5 100644 --- a/src/Disks/DiskEncrypted.cpp +++ b/src/Disks/DiskEncrypted.cpp @@ -190,16 +190,22 @@ namespace void getDiskAndPathFromConfig(const Poco::Util::AbstractConfiguration & config, const String & config_prefix, const DisksMap & map, DiskPtr & out_disk, String & out_path) { - String disk_name = config.getString(config_prefix + ".disk", ""); + const auto disk_name = config.getString(config_prefix + ".disk", ""); if (disk_name.empty()) throw Exception( ErrorCodes::BAD_ARGUMENTS, "Name of the wrapped disk must not be empty. Encrypted disk is a wrapper over another disk"); - auto disk_it = map.find(disk_name); + const auto disk_it = map.find(disk_name); if (disk_it == map.end()) throw Exception( ErrorCodes::BAD_ARGUMENTS, "The wrapped disk must have been announced earlier. No disk with name {}", disk_name); + if (disk_it->second->isContentAddressed()) + throw Exception( + ErrorCodes::NOT_IMPLEMENTED, + "Encrypted disk cannot wrap a content-addressed disk ({}). Use server-side encryption of the object storage instead", + disk_name); + out_disk = disk_it->second; out_path = config.getString(config_prefix + ".path", ""); diff --git a/tests/integration/test_cas_encrypted_disk/configs/storage.xml b/tests/integration/test_cas_encrypted_disk/configs/storage.xml index 33a8d6cd78dfe..179d2eb26cfa6 100644 --- a/tests/integration/test_cas_encrypted_disk/configs/storage.xml +++ b/tests/integration/test_cas_encrypted_disk/configs/storage.xml @@ -10,12 +10,6 @@ clickhouse clickhouse - - encrypted - disk_cas - encrypted/ - 1234567812345678 - s3 http://rustfs1:11121/test/plain_s3_encrypted_disk/ @@ -37,13 +31,6 @@ - - -
- disk_cas_encrypted -
-
-
diff --git a/tests/integration/test_cas_encrypted_disk/test.py b/tests/integration/test_cas_encrypted_disk/test.py index 528533a62ccd2..ef8971b19d92d 100644 --- a/tests/integration/test_cas_encrypted_disk/test.py +++ b/tests/integration/test_cas_encrypted_disk/test.py @@ -46,21 +46,38 @@ def create_table(policy): ) -def test_insert_into_encrypted_cas_is_rejected(): - create_table("cas_encrypted") - - error = node.query_and_get_error(INSERT) +def test_create_table_on_inline_encrypted_cas_disk_is_rejected(): + error = node.query_and_get_error( + f""" + CREATE TABLE {TABLE} (id UInt64, data String) + ENGINE = MergeTree + ORDER BY id + SETTINGS disk = disk( + type = encrypted, + disk = disk( + type = object_storage, + object_storage_type = s3, + metadata_type = cas, + cas_server_root_id = 'itest-cas-encrypted-inline', + endpoint = 'http://rustfs1:11121/test/cas_encrypted_inline/', + access_key_id = 'clickhouse', + secret_access_key = 'clickhouse' + ), + key = '1234567812345678', + path = 'encrypted/' + ) + """ + ) assert "NOT_IMPLEMENTED" in error, error + assert "Encrypted disk cannot wrap a content-addressed disk" in error, error assert ( - "Writing content part files through an encrypted content-addressed disk is not supported" - in error - ), error - assert node.query(f"SELECT count() FROM {TABLE}") == "0\n" - assert node.query( - f"SELECT count() FROM system.parts " - f"WHERE database = currentDatabase() AND table = '{TABLE}' AND active" - ) == "0\n" + node.query( + f"SELECT count() FROM system.tables " + f"WHERE database = currentDatabase() AND name = '{TABLE}'" + ) + == "0\n" + ) @pytest.mark.parametrize("policy", ["cas", "s3_encrypted"])