Enable WAL and disable DB repair (#1696)

* Enable WAL

* Disable rewind
This commit is contained in:
Arkadiy Paronyan 2016-07-23 17:05:34 +02:00 committed by Gav Wood
parent aafb014d01
commit 9a8fdeead9
3 changed files with 13 additions and 4 deletions

View File

@ -297,6 +297,10 @@ impl BlockChain {
let best_block_hash = match bc.extras_db.get(b"best").unwrap() {
Some(best) => {
let mut new_best = H256::from_slice(&best);
if !bc.blocks_db.get(&new_best).unwrap().is_some() {
warn!("Best block {} not found", new_best.hex());
}
/* TODO: enable this once the best block issue is resolved
while !bc.blocks_db.get(&new_best).unwrap().is_some() {
match bc.rewind() {
Some(h) => {
@ -308,7 +312,7 @@ impl BlockChain {
}
}
info!("Restored mismatched best block. Was: {}, new: {}", H256::from_slice(&best).hex(), new_best.hex());
}
}*/
new_best
}
None => {

View File

@ -198,10 +198,15 @@ impl Client {
state_db.commit(0, &spec.genesis_header().hash(), None).expect("Error commiting genesis state to state DB");
}
if !chain.block_header(&chain.best_block_hash()).map_or(true, |h| state_db.contains(h.state_root())) {
warn!("State root not found for block #{} ({})", chain.best_block_number(), chain.best_block_hash().hex());
}
/* TODO: enable this once the best block issue is resolved
while !chain.block_header(&chain.best_block_hash()).map_or(true, |h| state_db.contains(h.state_root())) {
warn!("State root not found for block #{} ({}), recovering...", chain.best_block_number(), chain.best_block_hash().hex());
chain.rewind();
}
}*/
let engine = Arc::new(spec.engine);

View File

@ -168,8 +168,8 @@ impl Database {
opts.set_block_based_table_factory(&block_opts);
}
let mut write_opts = WriteOptions::new();
write_opts.disable_wal(true);
let write_opts = WriteOptions::new();
//write_opts.disable_wal(true); // TODO: make sure this is safe
let db = match DB::open(&opts, path) {
Ok(db) => db,