snapshot: sqlite: use a subdirectory for consistency with LMDB #932

Merged
lx merged 1 commit from baptiste/garage:snapshot_consistency_sqlite into main 2025-01-27 18:50:11 +00:00

View file

@ -144,9 +144,12 @@ impl IDb for SqliteDb {
let percent = (p.pagecount - p.remaining) * 100 / p.pagecount; let percent = (p.pagecount - p.remaining) * 100 / p.pagecount;
info!("Sqlite snapshot progress: {}%", percent); info!("Sqlite snapshot progress: {}%", percent);
} }
std::fs::create_dir_all(to)?;
let mut path = to.clone();
path.push("db.sqlite");
baptiste marked this conversation as resolved Outdated
Outdated
Review

I think we should call this file db.sqlite, which is the same name as the sqlite database file in the metadata directory. This makes it clear which file to replace when trying to restore a snapshot.

I think we should call this file `db.sqlite`, which is the same name as the sqlite database file in the metadata directory. This makes it clear which file to replace when trying to restore a snapshot.

Good catch, thanks, updated!

Good catch, thanks, updated!
self.db self.db
.get()? .get()?
.backup(rusqlite::DatabaseName::Main, to, Some(progress))?; .backup(rusqlite::DatabaseName::Main, path, Some(progress))?;
Ok(()) Ok(())
} }