assertnode1.query("SELECT COUNT() FROM sometable")=="100\n"
assertnode2.query("SELECT COUNT() FROM sometable")=="100\n"
withPartitionManager()aspm:
pm.drop_instance_zk_connections(node1)
# this query should be executed by leader, but leader partitioned from zookeeper
withpytest.raises(Exception):
node2.query("ALTER TABLE sometable ON CLUSTER 'test_cluster' MODIFY COLUMN value UInt64 SETTINGS distributed_ddl_task_timeout=5")
for_inrange(100):
if'UInt64'innode1.query("SELECT type FROM system.columns WHERE name='value' and table = 'sometable'"):
break
time.sleep(0.1)
for_inrange(100):
if'UInt64'innode2.query("SELECT type FROM system.columns WHERE name='value' and table = 'sometable'"):
break
time.sleep(0.1)
assert'UInt64'innode1.query("SELECT type FROM system.columns WHERE name='value' and table = 'sometable'")
assert'UInt64'innode2.query("SELECT type FROM system.columns WHERE name='value' and table = 'sometable'")
# Checking that DDLWorker doesn't hung and still able to execute DDL queries
node1.query("CREATE TABLE new_table_with_ddl ON CLUSTER 'test_cluster' (key UInt32) ENGINE=MergeTree() ORDER BY tuple()",settings={"distributed_ddl_task_timeout":"10"})