Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/en/antalya/cas/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions src/Disks/DiskEncrypted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "");
Expand Down
13 changes: 0 additions & 13 deletions tests/integration/test_cas_encrypted_disk/configs/storage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
<access_key_id>clickhouse</access_key_id>
<secret_access_key>clickhouse</secret_access_key>
</disk_cas>
<disk_cas_encrypted>
<type>encrypted</type>
<disk>disk_cas</disk>
<path>encrypted/</path>
<key>1234567812345678</key>
</disk_cas_encrypted>
<disk_s3>
<type>s3</type>
<endpoint>http://rustfs1:11121/test/plain_s3_encrypted_disk/</endpoint>
Expand All @@ -37,13 +31,6 @@
</main>
</volumes>
</cas>
<cas_encrypted>
<volumes>
<main>
<disk>disk_cas_encrypted</disk>
</main>
</volumes>
</cas_encrypted>
<s3_encrypted>
<volumes>
<main>
Expand Down
41 changes: 29 additions & 12 deletions tests/integration/test_cas_encrypted_disk/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
Loading