Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only run lightweight sync between replicas during restore [DDB-1415] #262

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion astacus/coordinator/plugins/clickhouse/engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ class TableEngine(enum.Enum):
PostgreSQL = "PostgreSQL"
S3 = "S3"
KeeperMap = "KeeperMap"
AzureBlobStorage = "AzureBlobStorage"
2 changes: 1 addition & 1 deletion astacus/coordinator/plugins/clickhouse/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ async def run_step(self, cluster: Cluster, context: StepsContext) -> None:
def _sync_replicas(client: ClickHouseClient) -> Iterator[Awaitable[None]]:
yield from (
execute_with_timeout(
client, self.sync_timeout, f"SYSTEM SYNC REPLICA {table.escaped_sql_identifier}".encode()
client, self.sync_timeout, f"SYSTEM SYNC REPLICA {table.escaped_sql_identifier} LIGHTWEIGHT".encode()
)
for table in manifest.tables
if table.is_replicated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,6 @@ async def setup_cluster_content(clients: Sequence[HttpClickHouseClient], clickho
)
if await is_engine_available(clients[0], TableEngine.S3):
await clients[0].execute(b"CREATE TABLE default.s3 (a Int) ENGINE = S3('http://bucket.s3.amazonaws.com/key.json')")

if await is_engine_available(clients[0], TableEngine.AzureBlobStorage):
await clients[0].execute(
b"CREATE TABLE default.azureblobstorage (a Int) ENGINE = AzureBlobStorage('DefaultEndpointsProtocol=', 'test_container', 'test_table', 'CSV')"
)

# add a function table
await clients[0].execute(b"CREATE TABLE default.from_function_table AS numbers(3)")
# add a table with data in object storage
Expand Down Expand Up @@ -584,7 +578,6 @@ async def test_cleanup_does_not_break_object_storage_disk_files(
("default.postgresql", TableEngine.PostgreSQL),
("default.mysql", TableEngine.MySQL),
("default.s3", TableEngine.S3),
("default.azureblobstorage", TableEngine.AzureBlobStorage),
],
)
async def test_restores_integration_tables(
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/coordinator/plugins/clickhouse/test_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,9 +1413,9 @@ async def test_sync_replicas_for_replicated_mergetree_tables() -> None:
for client_index, client in enumerate(clients):
assert client.mock_calls == [
mock.call.execute(b"SET receive_timeout=180", session_id=mock.ANY),
mock.call.execute(b"SYSTEM SYNC REPLICA `db-one`.`table-uno`", session_id=mock.ANY, timeout=180),
mock.call.execute(b"SYSTEM SYNC REPLICA `db-one`.`table-uno` LIGHTWEIGHT", session_id=mock.ANY, timeout=180),
mock.call.execute(b"SET receive_timeout=180", session_id=mock.ANY),
mock.call.execute(b"SYSTEM SYNC REPLICA `db-two`.`table-eins`", session_id=mock.ANY, timeout=180),
mock.call.execute(b"SYSTEM SYNC REPLICA `db-two`.`table-eins` LIGHTWEIGHT", session_id=mock.ANY, timeout=180),
], f"Wrong list of queries for client {client_index} of {len(clients)}"
check_each_pair_of_calls_has_the_same_session_id(client.mock_calls)

Expand Down