Skip to content

Commit

Permalink
Merge pull request #262 from Aiven-Open/aris-sync-lightweight
Browse files Browse the repository at this point in the history
Only run lightweight sync between replicas during restore [DDB-1415]
  • Loading branch information
joelynch authored Nov 28, 2024
2 parents 9b4c6fc + 5645e6c commit 973a590
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
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

0 comments on commit 973a590

Please sign in to comment.