mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
Merge pull request #68821 from joelynch/joelynch/disk-encrypted-missing-method
Fix zero copy bug with encrypted disk and UNFREEZE
This commit is contained in:
commit
3f663f8e09
@ -350,6 +350,12 @@ public:
|
||||
return delegate;
|
||||
}
|
||||
|
||||
UInt32 getRefCount(const String & path) const override
|
||||
{
|
||||
auto wrapped_path = wrappedPath(path);
|
||||
return delegate->getRefCount(wrapped_path);
|
||||
}
|
||||
|
||||
#if USE_AWS_S3
|
||||
std::shared_ptr<const S3::Client> getS3StorageClient() const override
|
||||
{
|
||||
|
@ -0,0 +1,42 @@
|
||||
<clickhouse>
|
||||
<logger>
|
||||
<level>test</level>
|
||||
</logger>
|
||||
|
||||
<storage_configuration>
|
||||
<disks>
|
||||
<s3>
|
||||
<type>s3</type>
|
||||
<endpoint>http://minio1:9001/root/data/</endpoint>
|
||||
<access_key_id>minio</access_key_id>
|
||||
<secret_access_key>minio123</secret_access_key>
|
||||
</s3>
|
||||
<encrypted>
|
||||
<type>encrypted</type>
|
||||
<disk>s3</disk>
|
||||
<key_hex>9bb21f41535d8e89098f3f23a62c661e</key_hex>
|
||||
</encrypted>
|
||||
</disks>
|
||||
<policies>
|
||||
<encrypted>
|
||||
<volumes>
|
||||
<main>
|
||||
<disk>s3</disk>
|
||||
</main>
|
||||
</volumes>
|
||||
</encrypted>
|
||||
<s3>
|
||||
<volumes>
|
||||
<main>
|
||||
<disk>s3</disk>
|
||||
</main>
|
||||
</volumes>
|
||||
</s3>
|
||||
</policies>
|
||||
</storage_configuration>
|
||||
<merge_tree>
|
||||
<allow_remote_fs_zero_copy_replication>true</allow_remote_fs_zero_copy_replication>
|
||||
<disable_freeze_partition_for_zero_copy_replication>false</disable_freeze_partition_for_zero_copy_replication>
|
||||
</merge_tree>
|
||||
<enable_system_unfreeze>true</enable_system_unfreeze>
|
||||
</clickhouse>
|
58
tests/integration/test_zero_copy_unfreeze/test.py
Normal file
58
tests/integration/test_zero_copy_unfreeze/test.py
Normal file
@ -0,0 +1,58 @@
|
||||
from collections.abc import Iterable
|
||||
import pytest
|
||||
|
||||
from helpers.cluster import ClickHouseCluster, ClickHouseInstance
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def started_cluster() -> Iterable[ClickHouseCluster]:
|
||||
try:
|
||||
cluster.add_instance(
|
||||
"node1",
|
||||
main_configs=["configs/storage_conf.xml"],
|
||||
with_minio=True,
|
||||
with_zookeeper=True,
|
||||
)
|
||||
cluster.start()
|
||||
|
||||
yield cluster
|
||||
finally:
|
||||
cluster.shutdown()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("storage_policy", ["s3", "encrypted"])
|
||||
def test_unfreeze(storage_policy: str, started_cluster: ClickHouseCluster) -> None:
|
||||
node1: ClickHouseInstance = started_cluster.instances["node1"]
|
||||
node1.query(
|
||||
f"""\
|
||||
CREATE TABLE test1 (a Int)
|
||||
ENGINE = ReplicatedMergeTree('/clickhouse-tables/test1', 'r1')
|
||||
ORDER BY a
|
||||
SETTINGS storage_policy = '{storage_policy}'
|
||||
"""
|
||||
)
|
||||
|
||||
node1.query(
|
||||
"""\
|
||||
INSERT INTO test1
|
||||
SELECT *
|
||||
FROM system.numbers
|
||||
LIMIT 20
|
||||
"""
|
||||
)
|
||||
|
||||
node1.query("ALTER TABLE test1 FREEZE WITH NAME 'test'")
|
||||
node1.query("SYSTEM UNFREEZE WITH NAME 'test'")
|
||||
uuid = node1.query("SELECT uuid FROM system.tables WHERE name = 'test1'").strip()
|
||||
# ensure that zero copy lock parent still exists
|
||||
kazoo = started_cluster.get_kazoo_client("zoo1")
|
||||
part_path = f"/clickhouse/zero_copy/zero_copy_s3/{uuid}/all_0_0_0/"
|
||||
children: list[str] = kazoo.get_children(part_path)
|
||||
assert len(children) == 1
|
||||
part_name = children[0]
|
||||
assert len(kazoo.get_children(part_path + part_name)) == 1
|
||||
assert node1.query("SELECT count() FROM test1").strip() == "20"
|
||||
node1.query("DROP TABLE test1")
|
||||
node1.query("SYSTEM DROP REPLICA 'r1' FROM ZKPATH '/clickhouse-tables/test1'")
|
Loading…
Reference in New Issue
Block a user