mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
Merge upstream/changelog-26.6 (9593 commits) into our debranded fork. - 190 conflicts resolved: 24 delete-side kept-removed (grpc/arrowflight/gcloud), submodules+version→26.6, contrib/CMakeLists keeps zap + new libpng, drops capnproto (zap provides kj), Server.cpp/CMakeLists re-apply the ZAP wiring + gRPC/arrowflight/gcloud removal. - Full-tree debrand re-swept over the new 26.6 code (uniform Datastore naming; Azure fork Clickhouse* symbols preserved). 0 clickhouse in product src/programs/CMakeLists. - Version now 26.6.1.1. gRPC/google-cloud/chdig stay removed; ZAP remains the transport.
95 lines
2.7 KiB
Python
95 lines
2.7 KiB
Python
import time
|
|
|
|
import pytest
|
|
|
|
from helpers.client import QueryRuntimeException
|
|
from helpers.cluster import ClickHouseCluster
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
|
node = cluster.add_instance("node", with_zookeeper=True)
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def start_cluster():
|
|
try:
|
|
cluster.start()
|
|
yield cluster
|
|
finally:
|
|
cluster.shutdown()
|
|
|
|
|
|
def test_reload_auxiliary_zookeepers(start_cluster):
|
|
node.query(
|
|
"CREATE TABLE simple (date Date, id UInt32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/0/simple', 'node') ORDER BY tuple() PARTITION BY date;"
|
|
)
|
|
node.query("INSERT INTO simple VALUES ('2020-08-27', 1)")
|
|
|
|
node.query(
|
|
"CREATE TABLE simple2 (date Date, id UInt32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/1/simple', 'node') ORDER BY tuple() PARTITION BY date;"
|
|
)
|
|
|
|
# Add an auxiliary zookeeper
|
|
new_config = """<datastore>
|
|
<zookeeper>
|
|
<node index="1">
|
|
<host>zoo1</host>
|
|
<port>2181</port>
|
|
</node>
|
|
<node index="2">
|
|
<host>zoo2</host>
|
|
<port>2181</port>
|
|
</node>
|
|
<node index="3">
|
|
<host>zoo3</host>
|
|
<port>2181</port>
|
|
</node>
|
|
<session_timeout_ms>2000</session_timeout_ms>
|
|
</zookeeper>
|
|
<auxiliary_zookeepers>
|
|
<zookeeper2>
|
|
<node index="1">
|
|
<host>zoo1</host>
|
|
<port>2181</port>
|
|
</node>
|
|
<node index="2">
|
|
<host>zoo2</host>
|
|
<port>2181</port>
|
|
</node>
|
|
</zookeeper2>
|
|
</auxiliary_zookeepers>
|
|
</datastore>"""
|
|
node.replace_config(
|
|
"/etc/clickhouse-server/conf.d/zookeeper_config.xml", new_config
|
|
)
|
|
|
|
node.query("SYSTEM RELOAD CONFIG")
|
|
|
|
time.sleep(5)
|
|
|
|
node.query(
|
|
"ALTER TABLE simple2 FETCH PARTITION '2020-08-27' FROM 'zookeeper2:/clickhouse/tables/0/simple';"
|
|
)
|
|
node.query("ALTER TABLE simple2 ATTACH PARTITION '2020-08-27';")
|
|
assert node.query("SELECT id FROM simple2").strip() == "1"
|
|
|
|
new_config = """<datastore>
|
|
<zookeeper>
|
|
<node index="1">
|
|
<host>zoo2</host>
|
|
<port>2181</port>
|
|
</node>
|
|
<session_timeout_ms>2000</session_timeout_ms>
|
|
</zookeeper>
|
|
</datastore>"""
|
|
node.replace_config(
|
|
"/etc/clickhouse-server/conf.d/zookeeper_config.xml", new_config
|
|
)
|
|
node.query("SYSTEM RELOAD CONFIG")
|
|
time.sleep(5)
|
|
|
|
with pytest.raises(QueryRuntimeException):
|
|
node.query(
|
|
"ALTER TABLE simple2 FETCH PARTITION '2020-08-27' FROM 'zookeeper2:/clickhouse/tables/0/simple';"
|
|
)
|
|
assert node.query("SELECT id FROM simple2").strip() == "1"
|