Skip to content

Commit

Permalink
clickhouse: sync parts after system restore replica
Browse files Browse the repository at this point in the history
This prevents a race condition in the tests (but also in prod) where
Astacus exits claiming a restore has happened but instead there are
still parts being synced.
[DDB-922]
  • Loading branch information
joelynch committed Apr 9, 2024
1 parent a505a5b commit 7db38ab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
11 changes: 6 additions & 5 deletions astacus/coordinator/plugins/clickhouse/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Copyright (c) 2021 Aiven Ltd
See LICENSE for details
"""

from .config import (
ClickHouseConfiguration,
DiskConfiguration,
Expand Down Expand Up @@ -187,11 +188,6 @@ def get_restore_steps(self, *, context: OperationContext, req: RestoreRequest) -
attach_timeout=self.attach_timeout,
max_concurrent_attach_per_node=self.max_concurrent_attach_per_node,
),
SyncTableReplicasStep(
clients=clients,
sync_timeout=self.sync_tables_timeout,
max_concurrent_sync_per_node=self.max_concurrent_sync_per_node,
),
RestoreReplicaStep(
zookeeper_client=zookeeper_client,
clients=clients,
Expand All @@ -201,6 +197,11 @@ def get_restore_steps(self, *, context: OperationContext, req: RestoreRequest) -
restore_timeout=self.restore_replica_timeout,
max_concurrent_restore_per_node=self.max_concurrent_restore_replica_per_node,
),
SyncTableReplicasStep(
clients=clients,
sync_timeout=self.sync_tables_timeout,
max_concurrent_sync_per_node=self.max_concurrent_sync_per_node,
),
# Keeping this step last avoids access from non-admin users while we are still restoring
RestoreAccessEntitiesStep(
zookeeper_client=zookeeper_client, access_entities_path=self.replicated_access_zookeeper_path
Expand Down
3 changes: 1 addition & 2 deletions astacus/coordinator/plugins/clickhouse/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Copyright (c) 2021 Aiven Ltd
See LICENSE for details
"""

from __future__ import annotations

from .client import ClickHouseClient, ClickHouseClientQueryError, escape_sql_identifier, escape_sql_string
Expand Down Expand Up @@ -758,8 +759,6 @@ class SyncTableReplicasStep(Step[None]):

async def run_step(self, cluster: Cluster, context: StepsContext) -> None:
manifest = context.get_result(ClickHouseManifestStep)
if manifest.version != ClickHouseBackupVersion.V1:
return

def _sync_replicas(client: ClickHouseClient) -> Iterator[Awaitable[None]]:
yield from (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@
import pytest
import tempfile

pytest.skip(
"These are flakey see tickets"
"https://aiven.atlassian.net/jira/software/c/projects/DDB/boards/210?selectedIssue=DDB-922"
"and https://aiven.atlassian.net/jira/software/c/projects/DDB/boards/210?selectedIssue=DDB-932",
allow_module_level=True,
)


pytestmark = [
pytest.mark.clickhouse,
pytest.mark.order("last"),
Expand Down

0 comments on commit 7db38ab

Please sign in to comment.