Simplify obtaining query shard in test_distributed_load_balancing

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2023-05-16 15:59:22 +02:00
parent e37e8f83bb
commit dc353faf44

View File

@ -109,9 +109,7 @@ def get_node(query_node, table="dist", *args, **kwargs):
rows = query_node.query(
"""
SELECT c.host_name
FROM (
SELECT _shard_num
SELECT hostName()
FROM cluster(shards_cluster, system.query_log)
WHERE
initial_query_id = '{query_id}' AND
@ -119,9 +117,6 @@ def get_node(query_node, table="dist", *args, **kwargs):
type = 'QueryFinish'
ORDER BY event_date DESC, event_time DESC
LIMIT 1
) a
JOIN system.clusters c
ON a._shard_num = c.shard_num WHERE cluster = 'shards_cluster'
""".format(
query_id=query_id
)