Fix Snapshot restoration failure on Windows (#9491)
* Close Blooms DB files before DB restoration * PR Grumbles I * PR Grumble * Grumble
This commit is contained in:
committed by
Andronik Ordian
parent
f3aed42dd6
commit
baf5be09dc
@@ -35,6 +35,7 @@ use encoded;
|
||||
use engines::epoch::{Transition as EpochTransition, PendingTransition as PendingEpochTransition};
|
||||
use engines::ForkChoice;
|
||||
use ethereum_types::{H256, Bloom, BloomRef, U256};
|
||||
use error::Error as EthcoreError;
|
||||
use header::*;
|
||||
use heapsize::HeapSizeOf;
|
||||
use itertools::Itertools;
|
||||
@@ -60,6 +61,21 @@ pub trait BlockChainDB: Send + Sync {
|
||||
|
||||
/// Trace blooms database.
|
||||
fn trace_blooms(&self) -> &blooms_db::Database;
|
||||
|
||||
/// Restore the DB from the given path
|
||||
fn restore(&self, new_db: &str) -> Result<(), EthcoreError> {
|
||||
// First, close the Blooms databases
|
||||
self.blooms().close()?;
|
||||
self.trace_blooms().close()?;
|
||||
|
||||
// Restore the key_value DB
|
||||
self.key_value().restore(new_db)?;
|
||||
|
||||
// Re-open the Blooms databases
|
||||
self.blooms().reopen()?;
|
||||
self.trace_blooms().reopen()?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Generic database handler. This trait contains one function `open`. When called, it opens database with a
|
||||
|
||||
Reference in New Issue
Block a user