Skip to content

Commit d2c83d2

Browse files
Backport #95470 to 25.8: Fix check for encrypted disks over plain_rewritable
1 parent 43e59e7 commit d2c83d2

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cache_on_write_operations=0
2+
cache_on_write_operations=1
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env bash
2+
# Tags: no-fasttest
3+
4+
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
5+
# shellcheck source=../shell_config.sh
6+
. "$CUR_DIR"/../shell_config.sh
7+
8+
settings=(
9+
# Not compatible with DC
10+
--write_through_distributed_cache=0
11+
--read_through_distributed_cache=0
12+
)
13+
14+
echo "cache_on_write_operations=0"
15+
endpoint="http://localhost:11111/test/s3_plain_rewritable_${CLICKHOUSE_DATABASE}_cache_on_write_operations_0"
16+
cache_path="${CLICKHOUSE_DATABASE}_cache_disk_cache_on_write_operations_0"
17+
$CLICKHOUSE_CLIENT "${settings[@]}" -nm -q "
18+
drop table if exists mt1;
19+
drop table if exists mt1;
20+
drop table if exists mt3;
21+
drop table if exists mt4;
22+
23+
create table mt1 (key Int) engine=MergeTree order by () settings disk=disk(cache_on_write_operations=0, type='s3_plain_rewritable', endpoint='$endpoint', access_key_id=clickhouse, secret_access_key=clickhouse);
24+
-- cache disk on top of s3_plain_rewritable is allowed
25+
create table mt2 (key Int) engine=MergeTree order by () settings disk=disk(cache_on_write_operations=0, type='cache', path='$cache_path', max_size=100000, disk=disk(cache_on_write_operations=0, type='s3_plain_rewritable', endpoint='$endpoint', access_key_id=clickhouse, secret_access_key=clickhouse));
26+
-- encrypted disk with the same path as original s3_plain_rewritable disk is allowed
27+
create table mt3 (key Int) engine=MergeTree order by () settings disk=disk(cache_on_write_operations=0, type='encrypted', key='1234567812345678', disk=disk(cache_on_write_operations=0, type='s3_plain_rewritable', endpoint='$endpoint', access_key_id=clickhouse, secret_access_key=clickhouse));
28+
-- encrypted disk over cache is allowed
29+
create table mt4 (key Int) engine=MergeTree order by () settings disk=disk(cache_on_write_operations=0, type='encrypted', key='1234567812345678', disk=disk(cache_on_write_operations=0, type='cache', path='$cache_path', max_size=100000, disk=disk(cache_on_write_operations=0, type='s3_plain_rewritable', endpoint='$endpoint', access_key_id=clickhouse, secret_access_key=clickhouse)));
30+
31+
drop table mt1;
32+
drop table mt2;
33+
drop table mt3;
34+
drop table mt4;
35+
"
36+
37+
echo "cache_on_write_operations=1"
38+
endpoint="http://localhost:11111/test/s3_plain_rewritable_${CLICKHOUSE_DATABASE}_cache_on_write_operations_1"
39+
cache_path="${CLICKHOUSE_DATABASE}_cache_disk_cache_on_write_operations_1"
40+
$CLICKHOUSE_CLIENT "${settings[@]}" -nm -q "
41+
drop table if exists mt1;
42+
drop table if exists mt1;
43+
drop table if exists mt3;
44+
drop table if exists mt4;
45+
46+
create table mt1 (key Int) engine=MergeTree order by () settings disk=disk(cache_on_write_operations=1, type='s3_plain_rewritable', endpoint='$endpoint', access_key_id=clickhouse, secret_access_key=clickhouse);
47+
-- cache disk on top of s3_plain_rewritable is allowed
48+
create table mt2 (key Int) engine=MergeTree order by () settings disk=disk(cache_on_write_operations=1, type='cache', path='$cache_path', max_size=100000, disk=disk(cache_on_write_operations=1, type='s3_plain_rewritable', endpoint='$endpoint', access_key_id=clickhouse, secret_access_key=clickhouse));
49+
-- encrypted disk with the same path as original s3_plain_rewritable disk is allowed
50+
create table mt3 (key Int) engine=MergeTree order by () settings disk=disk(cache_on_write_operations=1, type='encrypted', key='1234567812345678', disk=disk(cache_on_write_operations=1, type='s3_plain_rewritable', endpoint='$endpoint', access_key_id=clickhouse, secret_access_key=clickhouse));
51+
-- encrypted disk over cache is allowed
52+
create table mt4 (key Int) engine=MergeTree order by () settings disk=disk(cache_on_write_operations=1, type='encrypted', key='1234567812345678', disk=disk(cache_on_write_operations=1, type='cache', path='$cache_path', max_size=100000, disk=disk(cache_on_write_operations=1, type='s3_plain_rewritable', endpoint='$endpoint', access_key_id=clickhouse, secret_access_key=clickhouse)));
53+
54+
drop table mt1;
55+
drop table mt2;
56+
drop table mt3;
57+
drop table mt4;
58+
"

0 commit comments

Comments
 (0)