Panic if DB exists before running bulk load benchmark

This commit is contained in:
Roman Zeyde 2018-07-11 21:25:27 +03:00
parent b32e503db2
commit 7b5679db70
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB

View File

@ -5,7 +5,7 @@ extern crate log;
extern crate error_chain;
use std::path::{Path, PathBuf};
use std::path::PathBuf;
use std::sync::{
mpsc::{Receiver, SyncSender}, Arc, Mutex,
};
@ -55,16 +55,21 @@ fn start_indexer(
}
fn run(config: Config) -> Result<()> {
if config.db_path.exists() {
panic!(
"DB {:?} must not exist when running this benchmark!",
config.db_path
);
}
let metrics = Metrics::new(config.monitoring_addr);
metrics.start();
let daemon = Daemon::new(
&config.daemon_dir,
&config.cookie,
config.network_type,
&metrics,
)?;
let store = DBStore::open(Path::new("./test-db"), StoreOptions { bulk_import: true });
let store = DBStore::open(&config.db_path, StoreOptions { bulk_import: true });
let blk_files = daemon.list_blk_files()?;
let parser = Arc::new(Parser::new(&daemon, &metrics)?);
let (blobs, reader) = start_reader(blk_files, parser.clone());