Skip to content

Commit 5528dd7

Browse files
committed
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 <[email protected]>
1 parent a7d227b commit 5528dd7

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎hack/clickhouse-system-bucket-shared-state.bats‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ restore() {
9292
jq -e '.data.Corefile == ".:53 {\n errors\n}\n"' "$STUB/replaced.json" >/dev/null
9393
}
9494

95-
# The Altinity driver names the Backup after the BackupJob and adopts one that
96-
# already exists under that name, so a Backup left behind would stand in for
97-
# the next run's backup. It is reclaimed by name, whether or not the BackupJob
95+
# The Altinity driver names the Backup after the BackupJob, and a Backup left
96+
# behind under that name records an earlier run's archive, which fails the next
97+
# run's BackupJob. It is reclaimed by name, whether or not the BackupJob
9898
# recorded it in status.backupRef.
9999
@test "the round-trip reclaims its Backup by name before and after the run" {
100100
suite=hack/e2e-chainsaw/clickhouse/chainsaw-test.yaml

‎hack/e2e-chainsaw/clickhouse/chainsaw-test.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,8 @@ spec:
452452
fi
453453
# Fixed names in a persistent namespace: a leftover Succeeded job
454454
# would satisfy the waits in the run step without a new attempt, and
455-
# the driver adopts a leftover Backup of the BackupJob's name.
455+
# a leftover Backup of the BackupJob's name, recording an earlier
456+
# run's archive, fails the new BackupJob.
456457
kubectl -n "$NAMESPACE" delete restorejob sysbucket-restore --ignore-not-found --wait=true --timeout=30s
457458
kubectl -n "$NAMESPACE" delete backupjob sysbucket-backup --ignore-not-found --wait=true --timeout=30s
458459
kubectl -n "$NAMESPACE" delete backup sysbucket-backup --ignore-not-found --wait=true --timeout=60s

‎hack/e2e-chainsaw/clickhouse/system-bucket-roundtrip.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ sidecar_before=$(sidecar_identity)
120120
[[ "$sidecar_before" =~ ^[0-9a-f-]+\ [0-9]+$ ]] \
121121
|| { log_error "could not read the ClickHouse Pod uid and clickhouse-backup restart count (got '${sidecar_before}')"; exit 1; }
122122

123-
# Restore picks the newest remote backup of the release, so only a row no
124-
# earlier run wrote shows that the archive restored is this run's.
123+
# Restore takes the archive this run's Backup recorded; a row no earlier run
124+
# wrote is what shows the data restored is that archive's.
125125
sentinel="before-backup-$(date -u +%Y%m%dT%H%M%SZ)-${RANDOM}"
126126
log_step "Writing the sentinel row ${sentinel}"
127127
clickhouse_query "$CLICKHOUSE_NAME" "CREATE TABLE IF NOT EXISTS default.sentinel (id UInt32, name String) ENGINE = MergeTree ORDER BY id"

0 commit comments

Comments
 (0)