From 51ced6036602826ff653c6fc283cbf11fc7b4865 Mon Sep 17 00:00:00 2001 From: Julien Kritter Date: Thu, 12 Sep 2024 10:26:28 +0200 Subject: Don't fetch old values in cross-partition transactional inserts --- 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 436a67fa..de4c3910 100644 --- a/src/db/lmdb_adapter.rs +++ b/src/db/lmdb_adapter.rs @@ -252,17 +252,15 @@ impl<'a> ITx for LmdbTx<'a> { Ok(tree.len(&self.tx)? as usize) } - fn insert(&mut self, tree: usize, key: &[u8], value: &[u8]) -> TxOpResult> { + fn insert(&mut self, tree: usize, key: &[u8], value: &[u8]) -> TxOpResult<()> { let tree = *self.get_tree(tree)?; - let old_val = tree.get(&self.tx, key)?.map(Vec::from); tree.put(&mut self.tx, key, value)?; - Ok(old_val) + Ok(()) } - fn remove(&mut self, tree: usize, key: &[u8]) -> TxOpResult> { + fn remove(&mut self, tree: usize, key: &[u8]) -> TxOpResult<()> { let tree = *self.get_tree(tree)?; - let old_val = tree.get(&self.tx, key)?.map(Vec::from); tree.delete(&mut self.tx, key)?; - Ok(old_val) + Ok(()) } fn clear(&mut self, tree: usize) -> TxOpResult<()> { let tree = *self.get_tree(tree)?; -- cgit v1.2.3