Closed bleidens closed 3 months ago
When deleting a backup, if the next is rsync it will contain outdated disk usage and deduplication information. With the implemented changes, whenever a backup is deleted from the catalog, if there is a next rsync backup in the server, its disk information will be updated using the new method _set_backup_sizes. This method updates backup information and can optionally also fsync to disk, so backup_fsync_and_set_sizes was also updated to reuse it.
The PR description needs a few teaks:
This new PR description could be relayed to the commit message too, as the commit message is not saying much and would require one to open the code to get a grasp on the changes.
The implementation itself seems to be working fine. I took 2 rsync backups and played with deletions.
$ barman show-backup rsync rsync_1 | grep "Base" -A2
Base backup information:
Disk usage : 22.2 MiB (38.2 MiB with WALs)
Incremental size : 22.2 MiB (-0.00%)
$ barman show-backup rsync rsync_2 | grep "Base" -A2
Base backup information:
Disk usage : 195.2 MiB (211.2 MiB with WALs)
Incremental size : 174.3 MiB (-10.70%)
rsync_1
:$ barman show-backup rsync rsync_2 | grep "Base" -A2
Base backup information:
Disk usage : 195.2 MiB (211.2 MiB with WALs)
Incremental size : 195.2 MiB (-0.00%)
When deleting a backup, if the next backup is rsync it might contain outdated disk usage and deduplication information, which should therefore be re-calculated after the deletion. This occurs because rsync backups have deduplication at the filesystem level when using the "reuse_backup = link" option, and since the deduplication size is calculated at the time the backup is taken, deleting an rsync backup might cause the deduplication information of the subsequent backup to become inaccurate.
With the implemented changes, whenever a backup is deleted from the catalog, if there is a next rsync backup in the server, its disk information will be updated using the new method
_set_backup_sizes
. This method updates backup information and can optionally also fsync to disk, sobackup_fsync_and_set_sizes
was also updated to reuse it.References: BAR-217