Add more logs to `purge_old_snapshot_archives` (#23531)
This commit is contained in:
parent
3eca66a1f8
commit
ccff006948
|
@ -1248,7 +1248,7 @@ pub fn purge_old_snapshot_archives<P>(
|
||||||
P: AsRef<Path>,
|
P: AsRef<Path>,
|
||||||
{
|
{
|
||||||
info!(
|
info!(
|
||||||
"Purging old snapshot archives in {}, retaining {} full snapshots and {} incremental snapshots",
|
"Purging old snapshot archives in {}, retaining up to {} full snapshots and up to {} incremental snapshots",
|
||||||
snapshot_archives_dir.as_ref().display(),
|
snapshot_archives_dir.as_ref().display(),
|
||||||
maximum_full_snapshot_archives_to_retain,
|
maximum_full_snapshot_archives_to_retain,
|
||||||
maximum_incremental_snapshot_archives_to_retain
|
maximum_incremental_snapshot_archives_to_retain
|
||||||
|
@ -1257,6 +1257,12 @@ pub fn purge_old_snapshot_archives<P>(
|
||||||
snapshot_archives.sort_unstable();
|
snapshot_archives.sort_unstable();
|
||||||
snapshot_archives.reverse();
|
snapshot_archives.reverse();
|
||||||
let max_snaps = max(1, maximum_full_snapshot_archives_to_retain); // Always keep at least one snapshot
|
let max_snaps = max(1, maximum_full_snapshot_archives_to_retain); // Always keep at least one snapshot
|
||||||
|
trace!(
|
||||||
|
"There are {} full snapshot archives, purging {} of them",
|
||||||
|
snapshot_archives.len(),
|
||||||
|
snapshot_archives.len().saturating_sub(max_snaps)
|
||||||
|
);
|
||||||
|
|
||||||
for old_archive in snapshot_archives.into_iter().skip(max_snaps) {
|
for old_archive in snapshot_archives.into_iter().skip(max_snaps) {
|
||||||
trace!(
|
trace!(
|
||||||
"Purging old full snapshot archive: {}",
|
"Purging old full snapshot archive: {}",
|
||||||
|
@ -1296,8 +1302,20 @@ pub fn purge_old_snapshot_archives<P>(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
incremental_snapshot_archives_with_same_base_slot.sort_unstable();
|
if !incremental_snapshot_archives_with_different_base_slot.is_empty() {
|
||||||
|
trace!(
|
||||||
|
"Purging {} incremental snapshot archives with a different base slot than the highest full snapshot slot",
|
||||||
|
incremental_snapshot_archives_with_different_base_slot.len()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
trace!(
|
||||||
|
"There are {} incremental snapshots with same base slot as the highest full snapshot slot, purging {} of them",
|
||||||
|
incremental_snapshot_archives_with_same_base_slot.len(),
|
||||||
|
incremental_snapshot_archives_with_same_base_slot.len()
|
||||||
|
.saturating_sub(maximum_incremental_snapshot_archives_to_retain)
|
||||||
|
);
|
||||||
|
|
||||||
|
incremental_snapshot_archives_with_same_base_slot.sort_unstable();
|
||||||
incremental_snapshot_archives_with_different_base_slot
|
incremental_snapshot_archives_with_different_base_slot
|
||||||
.iter()
|
.iter()
|
||||||
.chain(
|
.chain(
|
||||||
|
|
Loading…
Reference in New Issue