From 6280d06d010e8c1c829cad13aec74e8630f1cf48 Mon Sep 17 00:00:00 2001 From: Alexey Artamonov Date: Fri, 6 Nov 2026 17:47:51 +0300 Subject: [PATCH] test(clickhouse): describe the round-trip's guards by the archive-recording restore Restores now take the archive the Backup recorded rather than the newest one, and a leftover Backup of the BackupJob's name that records another archive fails the new BackupJob instead of being adopted. The comments justifying the sentinel row and the Backup cleanup, in the round-trip and in its unit test, still gave the earlier reasons, which would send the next reader after behaviour the driver no longer has. Assisted-by: LLM Signed-off-by: Alexey Artamonov --- hack/clickhouse-system-bucket-shared-state.bats | 6 +++--- hack/e2e-chainsaw/clickhouse/chainsaw-test.yaml | 3 ++- hack/e2e-chainsaw/clickhouse/system-bucket-roundtrip.sh | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hack/clickhouse-system-bucket-shared-state.bats b/hack/clickhouse-system-bucket-shared-state.bats index e76cc0a1d..ec4900cca 100644 --- a/hack/clickhouse-system-bucket-shared-state.bats +++ b/hack/clickhouse-system-bucket-shared-state.bats @@ -92,9 +92,9 @@ restore() { jq -e '.data.Corefile == ".:53 {\n errors\n}\n"' "$STUB/replaced.json" >/dev/null } -# The Altinity driver names the Backup after the BackupJob and adopts one that -# already exists under that name, so a Backup left behind would stand in for -# the next run's backup. It is reclaimed by name, whether or not the BackupJob +# The Altinity driver names the Backup after the BackupJob, and a Backup left +# behind under that name records an earlier run's archive, which fails the next +# run's BackupJob. It is reclaimed by name, whether or not the BackupJob # recorded it in status.backupRef. @test "the round-trip reclaims its Backup by name before and after the run" { suite=hack/e2e-chainsaw/clickhouse/chainsaw-test.yaml diff --git a/hack/e2e-chainsaw/clickhouse/chainsaw-test.yaml b/hack/e2e-chainsaw/clickhouse/chainsaw-test.yaml index c48e32f24..a4c4aef40 100644 --- a/hack/e2e-chainsaw/clickhouse/chainsaw-test.yaml +++ b/hack/e2e-chainsaw/clickhouse/chainsaw-test.yaml @@ -452,7 +452,8 @@ spec: fi # Fixed names in a persistent namespace: a leftover Succeeded job # would satisfy the waits in the run step without a new attempt, and - # the driver adopts a leftover Backup of the BackupJob's name. + # a leftover Backup of the BackupJob's name, recording an earlier + # run's archive, fails the new BackupJob. kubectl -n "$NAMESPACE" delete restorejob sysbucket-restore --ignore-not-found --wait=true --timeout=30s kubectl -n "$NAMESPACE" delete backupjob sysbucket-backup --ignore-not-found --wait=true --timeout=30s kubectl -n "$NAMESPACE" delete backup sysbucket-backup --ignore-not-found --wait=true --timeout=60s diff --git a/hack/e2e-chainsaw/clickhouse/system-bucket-roundtrip.sh b/hack/e2e-chainsaw/clickhouse/system-bucket-roundtrip.sh index 73d2f0e63..c1c216389 100755 --- a/hack/e2e-chainsaw/clickhouse/system-bucket-roundtrip.sh +++ b/hack/e2e-chainsaw/clickhouse/system-bucket-roundtrip.sh @@ -120,8 +120,8 @@ sidecar_before=$(sidecar_identity) [[ "$sidecar_before" =~ ^[0-9a-f-]+\ [0-9]+$ ]] \ || { log_error "could not read the ClickHouse Pod uid and clickhouse-backup restart count (got '${sidecar_before}')"; exit 1; } -# Restore picks the newest remote backup of the release, so only a row no -# earlier run wrote shows that the archive restored is this run's. +# Restore takes the archive this run's Backup recorded; a row no earlier run +# wrote is what shows the data restored is that archive's. sentinel="before-backup-$(date -u +%Y%m%dT%H%M%SZ)-${RANDOM}" log_step "Writing the sentinel row ${sentinel}" clickhouse_query "$CLICKHOUSE_NAME" "CREATE TABLE IF NOT EXISTS default.sentinel (id UInt32, name String) ENGINE = MergeTree ORDER BY id"