Restore backup command #843

Open
opened 2025-05-26 22:04:52 +00:00 by diogotcorreia · 0 comments

We already have backup functionality (

.create_new_backup_flush(&self.db, flush)

), it would be nice to add a similar command (or CLI flag, since we probably don't want to do it at runtime) that would perform a restore from a backup generated by continuwuity without the need for the workarounds described in the docs at the moment:

Lines 89 to 102 in 01594a6
To restore a backup from an online RocksDB backup:
- shutdown Continuwuity
- create a new directory for merging together the data
- in the online backup created, copy all `.sst` files in
`$DATABASE_BACKUP_PATH/shared_checksum` to your new directory
- trim all the strings so instead of `######_sxxxxxxxxx.sst`, it reads
`######.sst`. A way of doing this with sed and bash is `for file in *.sst; do mv
"$file" "$(echo "$file" | sed 's/_s.*/.sst/')"; done`
- copy all the files in `$DATABASE_BACKUP_PATH/1` (or the latest backup number
if you have multiple) to your new directory
- set your `database_path` config option to your new directory, or replace your
old one with the new one you crafted
- start up Continuwuity again and it should open as normal

The rocksdb crate already provides a function that does this: https://docs.rs/rocksdb/latest/rocksdb/backup/struct.BackupEngine.html#method.restore_from_latest_backup

We already have backup functionality (https://forgejo.ellis.link/continuwuation/continuwuity/src/commit/e71138ab6ffbea621120c41bafb1c65c7b1a3e39/src/database/engine/backup.rs#L17), it would be nice to add a similar command (or CLI flag, since we probably don't want to do it at runtime) that would perform a restore from a backup generated by continuwuity without the need for the workarounds described in the docs at the moment: https://forgejo.ellis.link/continuwuation/continuwuity/src/commit/01594a62439176aee1c1544c5be0cce0ddedcdf0/docs/maintenance.md?display=source#L89-L102 The rocksdb crate already provides a function that does this: https://docs.rs/rocksdb/latest/rocksdb/backup/struct.BackupEngine.html#method.restore_from_latest_backup
nex added the
Database
Enhancement
Matrix/Administration
labels 2025-05-27 02:46:47 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: continuwuation/continuwuity#843
No description provided.