Snapshot fixes and optimizations (#2863)

This commit is contained in:
Arkadiy Paronyan
2016-10-25 18:40:01 +02:00
committed by GitHub
parent 2d2e9c4d6e
commit 135d5d0e4c
8 changed files with 84 additions and 52 deletions

View File

@@ -348,13 +348,13 @@ impl JournalDB for OverlayRecentDB {
match rc {
0 => {}
1 => {
if try!(self.backing.get(self.column, &key)).is_some() {
if cfg!(debug_assertions) && try!(self.backing.get(self.column, &key)).is_some() {
return Err(BaseDataError::AlreadyExists(key).into());
}
batch.put(self.column, &key, &value)
}
-1 => {
if try!(self.backing.get(self.column, &key)).is_none() {
if cfg!(debug_assertions) && try!(self.backing.get(self.column, &key)).is_none() {
return Err(BaseDataError::NegativelyReferencedHash(key).into());
}
batch.delete(self.column, &key)