Skip to content
Snippets Groups Projects
Commit ff2a6044 authored by Éloïs's avatar Éloïs
Browse files

perf(dex):migrate: remove dbs instead of clear their content

parent ea26c6eb
No related branches found
No related tags found
No related merge requests found
...@@ -26,13 +26,15 @@ const CHUNK_SIZE: usize = 250; ...@@ -26,13 +26,15 @@ const CHUNK_SIZE: usize = 250;
pub(crate) fn migrate(profile_path: PathBuf) -> anyhow::Result<()> { pub(crate) fn migrate(profile_path: PathBuf) -> anyhow::Result<()> {
let start_time = Instant::now(); let start_time = Instant::now();
// Remove bc_db and gva_db
std::fs::remove_dir_all(profile_path.join("data/bc_v2_sled"))?;
std::fs::remove_dir_all(profile_path.join("data/gva_v1_sled"))?;
// Open bc_db and gva_db
let (bc_db, shared_dbs) = duniter_core::dbs::open_dbs(Some(profile_path.as_path()))?; let (bc_db, shared_dbs) = duniter_core::dbs::open_dbs(Some(profile_path.as_path()))?;
let gva_db = duniter_gva_indexer::get_gva_db_rw(Some(profile_path.as_path())); let gva_db = duniter_gva_indexer::get_gva_db_rw(Some(profile_path.as_path()));
// Clear bc_db and gva_db
bc_db.clear()?;
gva_db.clear()?;
if let Err(e) = migrate_inner(&bc_db, gva_db, profile_path, shared_dbs, start_time) { if let Err(e) = migrate_inner(&bc_db, gva_db, profile_path, shared_dbs, start_time) {
// Clear bc_db and gva_db // Clear bc_db and gva_db
bc_db.clear()?; bc_db.clear()?;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment