mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-04-28 16:58:16 +00:00
garbage collection: set phase1 LRU cache capacity by tuning option
Allow to control the capacity of the cache used to track recently touched chunks via the configured value in the datastore tuning options. Log the configured value to the task log, if an explicit value is set, allowing the user to confirm the setting and debug. Signed-off-by: Christian Ebner <c.ebner@proxmox.com> Link: https://lore.proxmox.com/pbs-devel/20250404130713.376630-2-c.ebner@proxmox.com
This commit is contained in:
parent
3f1e103904
commit
f1a711c830
@ -1115,6 +1115,7 @@ impl DataStore {
|
||||
&self,
|
||||
status: &mut GarbageCollectionStatus,
|
||||
worker: &dyn WorkerTaskContext,
|
||||
cache_capacity: usize,
|
||||
) -> Result<(), Error> {
|
||||
// Iterate twice over the datastore to fetch index files, even if this comes with an
|
||||
// additional runtime cost:
|
||||
@ -1130,7 +1131,7 @@ impl DataStore {
|
||||
let mut unprocessed_index_list = self.list_index_files()?;
|
||||
let index_count = unprocessed_index_list.len();
|
||||
|
||||
let mut chunk_lru_cache = LruCache::new(1024 * 1024);
|
||||
let mut chunk_lru_cache = LruCache::new(cache_capacity);
|
||||
let mut processed_index_files = 0;
|
||||
let mut last_percentage: usize = 0;
|
||||
|
||||
@ -1274,9 +1275,20 @@ impl DataStore {
|
||||
);
|
||||
}
|
||||
|
||||
let tuning: DatastoreTuning = serde_json::from_value(
|
||||
DatastoreTuning::API_SCHEMA
|
||||
.parse_property_string(gc_store_config.tuning.as_deref().unwrap_or(""))?,
|
||||
)?;
|
||||
let gc_cache_capacity = if let Some(capacity) = tuning.gc_cache_capacity {
|
||||
info!("Using chunk digest cache capacity of {capacity}.");
|
||||
capacity
|
||||
} else {
|
||||
1024 * 1024
|
||||
};
|
||||
|
||||
info!("Start GC phase1 (mark used chunks)");
|
||||
|
||||
self.mark_used_chunks(&mut gc_status, worker)
|
||||
self.mark_used_chunks(&mut gc_status, worker, gc_cache_capacity)
|
||||
.context("marking used chunks failed")?;
|
||||
|
||||
info!("Start GC phase2 (sweep unused chunks)");
|
||||
|
Loading…
Reference in New Issue
Block a user