Merge pull request #571 from ethcore/journaldb
Improved journaldb logging
This commit is contained in:
commit
c4333461bb
@ -121,6 +121,7 @@ impl JournalDB {
|
|||||||
// and the key is safe to delete.
|
// and the key is safe to delete.
|
||||||
|
|
||||||
// record new commit's details.
|
// record new commit's details.
|
||||||
|
debug!("commit: #{} ({}), end era: {:?}", now, id, end);
|
||||||
let batch = DBTransaction::new();
|
let batch = DBTransaction::new();
|
||||||
let mut counters = self.counters.write().unwrap();
|
let mut counters = self.counters.write().unwrap();
|
||||||
{
|
{
|
||||||
@ -167,15 +168,18 @@ impl JournalDB {
|
|||||||
&last
|
&last
|
||||||
})) {
|
})) {
|
||||||
let rlp = Rlp::new(&rlp_data);
|
let rlp = Rlp::new(&rlp_data);
|
||||||
let inserts: Vec<H256> = rlp.val_at(1);
|
let mut inserts: Vec<H256> = rlp.val_at(1);
|
||||||
JournalDB::decrease_counters(&inserts, &mut counters);
|
JournalDB::decrease_counters(&inserts, &mut counters);
|
||||||
// Collect keys to be removed. These are removed keys for canonical block, inserted for non-canonical
|
// Collect keys to be removed. These are removed keys for canonical block, inserted for non-canonical
|
||||||
if canon_id == rlp.val_at(0) {
|
if canon_id == rlp.val_at(0) {
|
||||||
to_remove.extend(rlp.at(2).iter().map(|r| r.as_val::<H256>()));
|
let mut canon_deletes: Vec<H256> = rlp.val_at(2);
|
||||||
|
trace!("Purging nodes deleted from canon: {:?}", canon_deletes);
|
||||||
|
to_remove.append(&mut canon_deletes);
|
||||||
canon_inserts = inserts;
|
canon_inserts = inserts;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
to_remove.extend(inserts);
|
trace!("Purging nodes inserted in non-canon: {:?}", inserts);
|
||||||
|
to_remove.append(&mut inserts);
|
||||||
}
|
}
|
||||||
try!(batch.delete(&last));
|
try!(batch.delete(&last));
|
||||||
index += 1;
|
index += 1;
|
||||||
@ -188,7 +192,7 @@ impl JournalDB {
|
|||||||
try!(batch.delete(&h));
|
try!(batch.delete(&h));
|
||||||
deletes += 1;
|
deletes += 1;
|
||||||
}
|
}
|
||||||
trace!("JournalDB: delete journal for time #{}.{}, (canon was {}): {} entries", end_era, index, canon_id, deletes);
|
debug!("commit: Delete journal for time #{}.{}, (canon was {}): {} entries", end_era, index, canon_id, deletes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit overlay insertions
|
// Commit overlay insertions
|
||||||
@ -209,7 +213,7 @@ impl JournalDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try!(self.backing.write(batch));
|
try!(self.backing.write(batch));
|
||||||
trace!("JournalDB::commit() deleted {} nodes", deletes);
|
debug!("commit: Deleted {} nodes", deletes);
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +262,7 @@ impl JournalDB {
|
|||||||
era -= 1;
|
era -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trace!("Recovered {} counters", res.len());
|
debug!("Recovered {} counters", res.len());
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user