diff options
author | Alex <alex@adnab.me> | 2024-09-14 15:57:27 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2024-09-14 15:57:27 +0000 |
commit | 6da135354135d8d8a5d2476bfbcd4aab91abfc3c (patch) | |
tree | 5028687340c272ba522de8084167034e8f2eaad0 /src/db/lmdb_adapter.rs | |
parent | 586957b4b7261b43e7820d7193516153201b4954 (diff) | |
parent | bd71728874e7f03c547246cb0076804f62db102f (diff) | |
download | garage-6da135354135d8d8a5d2476bfbcd4aab91abfc3c.tar.gz garage-6da135354135d8d8a5d2476bfbcd4aab91abfc3c.zip |
Merge pull request 'Don't fetch old values in cross-partition transactional inserts' (#877) from withings/garage:perf/kv/insert-no-return-cross-partition into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/877
Diffstat (limited to 'src/db/lmdb_adapter.rs')
-rw-r--r-- | src/db/lmdb_adapter.rs | 10 |
1 files changed, 4 insertions, 6 deletions
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<Option<Value>> { + 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<Option<Value>> { + 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)?; |