From 74363c906065a559beef4c3c93e8f73a7ecff437 Mon Sep 17 00:00:00 2001 From: marvin-j97 Date: Wed, 4 Sep 2024 18:45:17 +0200 Subject: perf(kv): dont retrieve values for write ops see https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/851 --- src/db/lmdb_adapter.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/db/lmdb_adapter.rs') diff --git a/src/db/lmdb_adapter.rs b/src/db/lmdb_adapter.rs index d5066664..436a67fa 100644 --- a/src/db/lmdb_adapter.rs +++ b/src/db/lmdb_adapter.rs @@ -132,22 +132,20 @@ impl IDb for LmdbDb { Ok(tree.len(&tx)?.try_into().unwrap()) } - fn insert(&self, tree: usize, key: &[u8], value: &[u8]) -> Result> { + fn insert(&self, tree: usize, key: &[u8], value: &[u8]) -> Result<()> { let tree = self.get_tree(tree)?; let mut tx = self.db.write_txn()?; - let old_val = tree.get(&tx, key)?.map(Vec::from); tree.put(&mut tx, key, value)?; tx.commit()?; - Ok(old_val) + Ok(()) } - fn remove(&self, tree: usize, key: &[u8]) -> Result> { + fn remove(&self, tree: usize, key: &[u8]) -> Result<()> { let tree = self.get_tree(tree)?; let mut tx = self.db.write_txn()?; - let old_val = tree.get(&tx, key)?.map(Vec::from); tree.delete(&mut tx, key)?; tx.commit()?; - Ok(old_val) + Ok(()) } fn clear(&self, tree: usize) -> Result<()> { -- cgit v1.2.3