Repository navigation
Do not fail server startup when a Backup database refers to unavailable storage - #83188
Conversation
|
Workflow [PR], commit [b91e6cf] Summary: ✅
AI ReviewSummaryThis PR makes Missing context / blind spots
Final VerdictStatus: ✅ Approve No minimum required actions. |
|
The code was added by @kitaisreal, let's invite him to fix. |
rienath
left a comment
There was a problem hiding this comment.
Let's keep this a draft until a fix lands
…le storage When a database was created with `ENGINE = Backup(...)` and the backup later became unavailable (its files were deleted, or the underlying storage such as S3 became inaccessible), the server failed to start entirely: opening the backup in `DatabaseBackup::beforeLoadingMetadata` threw, and the exception aborted the whole startup. Now, on server startup (`FORCE_ATTACH`/`FORCE_RESTORE` mode), a failure to open the backup is logged and the `Backup` database is loaded without any tables, following the same pattern as `DatabaseReplicated` tolerating an unavailable ZooKeeper on startup. Interactive `CREATE`/`ATTACH DATABASE` still surfaces the error as before. Closes: ClickHouse#83187 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Cover all backup destinations (File, local disk, s3_plain, object storage), and after restarting with the backup deleted, assert that the `Backup` database is still attached but loaded without tables, and that the original database is unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
The fix has landed. In addition to @orloffv's reproducer, this PR now fixes the underlying bug from #83187:
Verified locally: the whole |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 19/19 (100.00%) | Lost baseline coverage: none · Uncovered code |
|
Marked ready for review — the draft condition ( |
Do not fail server startup when a Backup database refers to unavailable storage
When a database (or table) was created with
ENGINE = Backup(...)and the backup later became unavailable (its files were deleted, or the underlying storage such as S3 became inaccessible), the server failed to start entirely. Opening the backup inDatabaseBackup::beforeLoadingMetadatathrew, and the exception aborted the whole startup, making recovery hard even if only one database depended on the missing backup.Now, on server startup (
FORCE_ATTACH/FORCE_RESTOREmode), a failure to open the backup is logged and theBackupdatabase is loaded without any tables, following the same pattern thatDatabaseReplicatedalready uses to tolerate an unavailable ZooKeeper on startup. The server starts normally; once the backup becomes available again, restart the server to access its tables. InteractiveCREATE/ATTACH DATABASEstill surfaces the error as before.The test added by this PR (a reproducer originally contributed by @orloffv) now passes for all backup destinations (
File, localDisk,s3_plain, andobject_storagewithlocal_blob_storage).Closes: #83187
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed the server failing to start when a
Backupdatabase engine refers to a backup that has become unavailable (for example, when its files were deleted or the underlying storage is inaccessible). The database is now loaded without tables instead of preventing the whole server from starting.