diff options
author | Alex <alex@adnab.me> | 2023-09-21 14:03:35 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2023-09-21 14:03:35 +0000 |
commit | 1d986bd889a5f5fe1bdc75e7d4b34acc2cfbe09f (patch) | |
tree | 5b5f8d66637c4a10866b00e07a45081c93cf75cf /src/model | |
parent | fd7d8fec59c617b40e480ff855894cf35fdcfb40 (diff) | |
parent | 0635250b2bdcce4156704128de154f9052d34e9e (diff) | |
download | garage-1d986bd889a5f5fe1bdc75e7d4b34acc2cfbe09f.tar.gz garage-1d986bd889a5f5fe1bdc75e7d4b34acc2cfbe09f.zip |
Merge pull request 'Refactor db transactions and add on_commit for table.queue_insert' (#637) from k2v-indices-lmdb into next
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/637
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/index_counter.rs | 4 | ||||
-rw-r--r-- | src/model/s3/lifecycle_worker.rs | 8 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/model/index_counter.rs b/src/model/index_counter.rs index 35d6596d..a46c165f 100644 --- a/src/model/index_counter.rs +++ b/src/model/index_counter.rs @@ -294,7 +294,7 @@ impl<T: CountedItem> IndexCounter<T> { let counter_entry = local_counter.into_counter_entry(self.this_node); self.local_counter .db() - .transaction(|mut tx| self.table.queue_insert(&mut tx, &counter_entry))?; + .transaction(|tx| self.table.queue_insert(tx, &counter_entry))?; next_start = Some(local_counter_k); } @@ -360,7 +360,7 @@ impl<T: CountedItem> IndexCounter<T> { let counter_entry = local_counter.into_counter_entry(self.this_node); self.local_counter .db() - .transaction(|mut tx| self.table.queue_insert(&mut tx, &counter_entry))?; + .transaction(|tx| self.table.queue_insert(tx, &counter_entry))?; next_start = Some(counted_entry_k); } diff --git a/src/model/s3/lifecycle_worker.rs b/src/model/s3/lifecycle_worker.rs index 42e661eb..50d4283f 100644 --- a/src/model/s3/lifecycle_worker.rs +++ b/src/model/s3/lifecycle_worker.rs @@ -330,9 +330,7 @@ async fn process_object( "Lifecycle: expiring 1 object in bucket {:?}", object.bucket_id ); - db.transaction(|mut tx| { - garage.object_table.queue_insert(&mut tx, &deleted_object) - })?; + db.transaction(|tx| garage.object_table.queue_insert(tx, &deleted_object))?; *objects_expired += 1; } } @@ -365,9 +363,7 @@ async fn process_object( ); let aborted_object = Object::new(object.bucket_id, object.key.clone(), aborted_versions); - db.transaction(|mut tx| { - garage.object_table.queue_insert(&mut tx, &aborted_object) - })?; + db.transaction(|tx| garage.object_table.queue_insert(tx, &aborted_object))?; *mpu_aborted += n_aborted; } } |