diff --git a/core/mvcc/database/mod.rs b/core/mvcc/database/mod.rs index 0726504bb..7f1dd573a 100644 --- a/core/mvcc/database/mod.rs +++ b/core/mvcc/database/mod.rs @@ -2016,7 +2016,7 @@ impl MvStore { } StreamingResult::Eof => { // Set offset to the end so that next writes go to the end of the file - self.storage.logical_log.write().unwrap().offset = reader.offset as u64; + self.storage.logical_log.write().offset = reader.offset as u64; break; } } diff --git a/core/mvcc/persistent_storage/mod.rs b/core/mvcc/persistent_storage/mod.rs index ede456bc3..0c5514f6c 100644 --- a/core/mvcc/persistent_storage/mod.rs +++ b/core/mvcc/persistent_storage/mod.rs @@ -1,5 +1,6 @@ +use parking_lot::RwLock; use std::fmt::Debug; -use std::sync::{Arc, RwLock}; +use std::sync::Arc; pub mod logical_log; use crate::mvcc::database::LogRecord; @@ -20,7 +21,7 @@ impl Storage { impl Storage { pub fn log_tx(&self, m: &LogRecord) -> Result { - self.logical_log.write().unwrap().log_tx(m) + self.logical_log.write().log_tx(m) } pub fn read_tx_log(&self) -> Result> { @@ -28,30 +29,27 @@ impl Storage { } pub fn sync(&self) -> Result { - self.logical_log.write().unwrap().sync() + self.logical_log.write().sync() } pub fn truncate(&self) -> Result { - self.logical_log.write().unwrap().truncate() + self.logical_log.write().truncate() } pub fn get_logical_log_file(&self) -> Arc { - self.logical_log.write().unwrap().file.clone() + self.logical_log.write().file.clone() } pub fn should_checkpoint(&self) -> bool { - self.logical_log.read().unwrap().should_checkpoint() + self.logical_log.read().should_checkpoint() } pub fn set_checkpoint_threshold(&self, threshold: u64) { - self.logical_log - .write() - .unwrap() - .set_checkpoint_threshold(threshold) + self.logical_log.write().set_checkpoint_threshold(threshold) } pub fn checkpoint_threshold(&self) -> u64 { - self.logical_log.read().unwrap().checkpoint_threshold() + self.logical_log.read().checkpoint_threshold() } }