Skip to content

Preserve the existing database during ClickHouse restore - #1

Open
marktopper wants to merge 1 commit into
ritechoice23:feature/clickhouse-database-supportfrom
marktopper:fix/clickhouse-restore-rollback
Open

marktopper wants to merge 1 commit into
ritechoice23:feature/clickhouse-database-supportfrom
marktopper:fix/clickhouse-restore-rollback

Conversation

@marktopper

Copy link
Copy Markdown

Summary

Follow-up to vitodeploy#1247. Restore the backup into a staging database, rename the current database to a unique recovery name, and only remove that previous copy after the staged database has been promoted successfully. If promotion fails, the exit trap restores the original database name before removing staging. Archive cleanup now runs after database recovery and is best-effort.

The restore regression test now checks the recovery rename flow and ensures the target database is never dropped before promotion.

Verification

  • vendor/bin/pest tests/Unit/Services/Database/ClickhouseTest.php (15 tests, 122 assertions)
  • vendor/bin/pint --test tests/Unit/Services/Database/ClickhouseTest.php
  • git diff --check
  • Rendered script passes bash -n.
  • Simulated successful promotion and promotion failure; failure restored the original DB and removed staging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant