Fix style & review

This commit is contained in:
Nikolay Degterinsky 2023-12-08 19:40:09 +00:00
parent 995b51ef73
commit 10bfd054d8
2 changed files with 12 additions and 16 deletions

View File

@ -226,10 +226,10 @@ bool DDLTask::findCurrentHostID(ContextPtr global_context, Poco::Logger * log, c
{ {
if (config_host_name) if (config_host_name)
{ {
if (host.host_name != *config_host_name) if (config_host_name != host.host_name)
continue; continue;
if (!(maybe_secure_port && maybe_secure_port == host.port) && !(global_context->getTCPPort() == host.port)) if (maybe_secure_port != host.port && global_context->getTCPPort() != host.port)
continue; continue;
host_in_hostlist = true; host_in_hostlist = true;

View File

@ -40,11 +40,11 @@ def test_ddl_queue_delete_add_replica(started_cluster):
value = ( value = (
node1.query( node1.query(
"select value from system.zookeeper where path='/clickhouse/task_queue/ddl' and name='{}' format TSVRaw".format( f"select value from system.zookeeper where path='/clickhouse/task_queue/ddl' and name='{query_znode}' format TSVRaw"
query_znode
)
)[:-1] )[:-1]
.replace("hosts: ['node1:9000']", "hosts: ['finished_node:9000','deleted_node:9000']") .replace(
"hosts: ['node1:9000']", "hosts: ['finished_node:9000','deleted_node:9000']"
)
.replace("initiator: node1:9000", "initiator: finished_node:9000") .replace("initiator: node1:9000", "initiator: finished_node:9000")
.replace("\\'", "#") .replace("\\'", "#")
.replace("'", "\\'") .replace("'", "\\'")
@ -53,24 +53,20 @@ def test_ddl_queue_delete_add_replica(started_cluster):
) )
finished_znode = node1.query( finished_znode = node1.query(
"select name from system.zookeeper where path='/clickhouse/task_queue/ddl/{}/finished' and name like '%node1%'".format( f"select name from system.zookeeper where path='/clickhouse/task_queue/ddl/{query_znode}/finished' and name like '%node1%'"
query_znode
)
)[:-1] )[:-1]
node1.query( node1.query(
"insert into system.zookeeper (name, path, value) values ('{}', '/clickhouse/task_queue/ddl', '{}')".format( f"insert into system.zookeeper (name, path, value) values ('{query_znode}', '/clickhouse/task_queue/ddl', '{value}')"
query_znode, value
)
) )
started_cluster.get_kazoo_client("zoo1").delete( started_cluster.get_kazoo_client("zoo1").delete(
"/clickhouse/task_queue/ddl/{}/finished/{}".format(query_znode, finished_znode) f"/clickhouse/task_queue/ddl/{query_znode}/finished/{finished_znode}"
) )
finished_znode = finished_znode.replace("node1", "finished_node")
node1.query( node1.query(
"insert into system.zookeeper (name, path, value) values ('{}', '/clickhouse/task_queue/ddl/{}/finished', '0\\n')".format( f"insert into system.zookeeper (name, path, value) values ('{finished_znode}', '/clickhouse/task_queue/ddl/{query_znode}/finished', '0\\n')"
finished_znode.replace("node1", "finished_node"), query_znode
)
) )
node1.restart_clickhouse(kill=True) node1.restart_clickhouse(kill=True)