@@ -55,7 +55,8 @@ pub struct BaseRocksStoreFs {
55
55
name : & ' static str ,
56
56
minimum_snapshots_count : u64 ,
57
57
snapshots_lifetime : u64 ,
58
- remote_files_cleanup_batch_size : u64 ,
58
+ // A copy of the upload-concurrency config -- we multiply this for our deletes.
59
+ deletion_batch_size : u64 ,
59
60
}
60
61
61
62
impl BaseRocksStoreFs {
@@ -65,13 +66,13 @@ impl BaseRocksStoreFs {
65
66
) -> Arc < Self > {
66
67
let minimum_snapshots_count = config. minimum_metastore_snapshots_count ( ) ;
67
68
let snapshots_lifetime = config. metastore_snapshots_lifetime ( ) ;
68
- let remote_files_cleanup_batch_size = config. remote_files_cleanup_batch_size ( ) ;
69
+ let deletion_batch_size = Self :: deletion_batch_size ( config. as_ref ( ) ) ;
69
70
Arc :: new ( Self {
70
71
remote_fs,
71
72
name : "metastore" ,
72
73
minimum_snapshots_count,
73
74
snapshots_lifetime,
74
- remote_files_cleanup_batch_size ,
75
+ deletion_batch_size ,
75
76
} )
76
77
}
77
78
pub fn new_for_cachestore (
@@ -80,16 +81,23 @@ impl BaseRocksStoreFs {
80
81
) -> Arc < Self > {
81
82
let minimum_snapshots_count = config. minimum_cachestore_snapshots_count ( ) ;
82
83
let snapshots_lifetime = config. cachestore_snapshots_lifetime ( ) ;
83
- let remote_files_cleanup_batch_size = config. remote_files_cleanup_batch_size ( ) ;
84
+ let deletion_batch_size = Self :: deletion_batch_size ( config. as_ref ( ) ) ;
84
85
Arc :: new ( Self {
85
86
remote_fs,
86
87
name : "cachestore" ,
87
88
minimum_snapshots_count,
88
89
snapshots_lifetime,
89
- remote_files_cleanup_batch_size ,
90
+ deletion_batch_size ,
90
91
} )
91
92
}
92
93
94
+ fn deletion_batch_size ( config : & dyn ConfigObj ) -> u64 {
95
+ // Pick a large enough batch size that batching is not a significant slowdown, given the
96
+ // upload_concurrency parameter.
97
+ const MULTIPLIER : u64 = 25 ;
98
+ config. upload_concurrency ( ) . saturating_mul ( MULTIPLIER )
99
+ }
100
+
93
101
pub fn get_name ( & self ) -> & ' static str {
94
102
& self . name
95
103
}
@@ -214,11 +222,7 @@ impl BaseRocksStoreFs {
214
222
) ;
215
223
}
216
224
217
- for batch in to_delete. chunks (
218
- self . remote_files_cleanup_batch_size
219
- . try_into ( )
220
- . unwrap_or ( usize:: MAX ) ,
221
- ) {
225
+ for batch in to_delete. chunks ( self . deletion_batch_size . try_into ( ) . unwrap_or ( usize:: MAX ) ) {
222
226
for v in join_all (
223
227
batch
224
228
. iter ( )
0 commit comments