Restic Prune "stats" not Reproducible

Hi all,

I am running restic 0.14.0 with a migrated repository which is currently pruning (prune --compression max --pack-size 64 --repack-uncompressed --repack-small --no-cache).

However, I am slightly confused by two consecutive runs of restic prune (the first one a dry-run) leading to e.g. a different blob count for repacking. See:

First restic prune run (dry-run):

to repack:      15759546 blobs / 3.151 TiB  
this removes:    1146545 blobs / 93.147 GiB
to delete:       3723161 blobs / 1.768 TiB
total prune:     4869706 blobs / 1.859 TiB                                                                                                                                                                                                                                    
remaining:      14613001 blobs / 3.060 TiB                                                                                                                                                                                                                                    
unused size after prune: 16777215.991 TiB (100.00% of remaining size) 

Second restic prune run (wet-run):

to repack:      15828929 blobs / 3.154 TiB
this removes:    1215928 blobs / 97.818 GiB
to delete:       3653778 blobs / 1.765 TiB         
total prune:     4869706 blobs / 1.861 TiB
remaining:      14613001 blobs / 3.058 TiB
unused size after prune: 16777215.989 TiB (100.00% of remaining size)

As far as I can tell, the difference lays between “to repack” and “to delete”. The 69383 packs which are additionally repacked in wet-run, are the exact 69383 packs which are not deleted then. So they moved from “to delete” to “to repack”. The numbers sound pretty deterministic, but is that shift explainable?

The resulting remaining packs however, are the same. Albeit the size calculation is a bit off (might be file system specific? I am using the local backend on a zfs disk with compression enabled).

Both runs processed the same number of snapshots and had the same number of “collecting packs for deletion and repacking”.

Thank you for your awesome software!

That line alone is proof that something went wrong during the stats calculation…
Could you open an issue on github?

Here you go: `prune`stats inconsistent / inaccurate · Issue #3918 · restic/restic · GitHub

Thank you for having a look!