[pbs-devel] [PATCH proxmox-backup 3/3] GC: S3: phase2: delete last partial batch of objects at the very end

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Nov 21 10:06:01 CET 2025


instead of after every processing every batch of 1000 listed objects. this
reduces the number of delete calls made to the backend, making regular garbage
collections that do not delete most objects cheaper, but means holding the
flocks for garbage chunks/objects longer.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 pbs-datastore/src/datastore.rs | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index f89fd28b0..f26de672a 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -1745,12 +1745,6 @@ impl DataStore {
                         s3_delete_batch(&mut delete_list, s3_client)?;
                     }
                 }
-
-                // delete the last batch of objects, if there are any remaining
-                if !delete_list.is_empty() {
-                    s3_delete_batch(&mut delete_list, s3_client)?;
-                }
-
                 // Process next batch of chunks if there is more
                 if list_bucket_result.is_truncated {
                     list_bucket_result =
@@ -1763,6 +1757,12 @@ impl DataStore {
 
                 break;
             }
+
+            // delete the last batch of objects, if there are any remaining
+            if !delete_list.is_empty() {
+                s3_delete_batch(&mut delete_list, s3_client)?;
+            }
+
             info!("processed {chunk_count} total chunks");
 
             // Phase 2 GC of Filesystem backed storage is phase 3 for S3 backed GC
-- 
2.47.3





More information about the pbs-devel mailing list