From b96385a3557a1a929812a789a639f9da17f4dd5d Mon Sep 17 00:00:00 2001 From: Pierre Massat Date: Thu, 22 Aug 2024 15:18:46 -0700 Subject: [PATCH] fix(operations): Set alter_async=0 when dropping an index asynchronously (#6237) --- snuba/migrations/operations.py | 2 +- tests/migrations/test_operations.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/snuba/migrations/operations.py b/snuba/migrations/operations.py index 6158105e20..acad806a44 100644 --- a/snuba/migrations/operations.py +++ b/snuba/migrations/operations.py @@ -527,7 +527,7 @@ def __init__( def format_sql(self) -> str: settings = "" if self.__run_async: - settings = " SETTINGS mutations_sync=0" + settings = " SETTINGS mutations_sync=0, alter_sync=0" return f"ALTER TABLE {self.__table_name} DROP INDEX IF EXISTS {self.__index_name}{settings};" def _block_on_mutations( diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py index d492be3d2c..8dc60b131a 100644 --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -176,7 +176,7 @@ def test_drop_index_async() -> None: DropIndex( StorageSetKey.EVENTS, "test_table", "index_1", run_async=True ).format_sql() - == "ALTER TABLE test_table DROP INDEX IF EXISTS index_1 SETTINGS mutations_sync=0;" + == "ALTER TABLE test_table DROP INDEX IF EXISTS index_1 SETTINGS mutations_sync=0, alter_sync=0;" )