From ded0c1583bd37c64eb13714a514d63f6d44368c2 Mon Sep 17 00:00:00 2001 From: Aris Tritas Date: Thu, 7 Nov 2024 19:13:27 +0100 Subject: [PATCH] Only execute access rights change queries on a single node For the read-only step, we're filtering by replicated users, whose grant information is stored in ZooKeeper. This means that executing the query on multiple nodes is counterproductive. Instead of achieving faster information propagation, we're getting transaction errors from ZooKeeper. Any one of these can in turn fail the step. --- astacus/coordinator/plugins/clickhouse/steps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astacus/coordinator/plugins/clickhouse/steps.py b/astacus/coordinator/plugins/clickhouse/steps.py index 40c8de2c..a789505a 100644 --- a/astacus/coordinator/plugins/clickhouse/steps.py +++ b/astacus/coordinator/plugins/clickhouse/steps.py @@ -190,14 +190,14 @@ async def revoke_write_on_table(self, table: Table, user_name: bytes) -> None: revoke_statement = ( f"REVOKE INSERT, ALTER UPDATE, ALTER DELETE ON {table.escaped_sql_identifier} FROM {escaped_user_name}" ) - await asyncio.gather(*(client.execute(revoke_statement.encode()) for client in self.clients)) + await self.clients[0].execute(revoke_statement.encode()) async def grant_write_on_table(self, table: Table, user_name: bytes) -> None: escaped_user_name = escape_sql_identifier(user_name) grant_statement = ( f"GRANT INSERT, ALTER UPDATE, ALTER DELETE ON {table.escaped_sql_identifier} TO {escaped_user_name}" ) - await asyncio.gather(*(client.execute(grant_statement.encode()) for client in self.clients)) + await self.clients[0].execute(grant_statement.encode()) async def run_step(self, cluster: Cluster, context: StepsContext) -> None: _, tables = context.get_result(RetrieveDatabasesAndTablesStep)