Skip to content

git prune - prune more aggresively - issue 5293#5359

Draft
wplapper wants to merge 4 commits intorestic:masterfrom
wplapper:prune
Draft

git prune - prune more aggresively - issue 5293#5359
wplapper wants to merge 4 commits intorestic:masterfrom
wplapper:prune

Conversation

@wplapper
Copy link
Copy Markdown
Contributor

@wplapper wplapper commented Apr 15, 2025

Changes: cmd_prune.go: removed option --repack-small and marked it deprecated.

Add changelog note.

Added code to filter out the processing of all packfiles early in the prune process, so that map can be reused for calculating a targetPackSize value based on the chosen percentile of the sorted packfiles list.

Added test to validate modified prune behaviour.

What does this PR change? What problem does it solve?

This PR addresses the issue #5293.

Was the change previously discussed in an issue or on the forum?

#5293

closes #5293

Checklist

  • I have added tests for all code changes.
    - [ ] I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I'm done! This pull request is ready for review.

@wplapper
Copy link
Copy Markdown
Contributor Author

I have decided to revert this PR to closed status to ease the pressure on the
maintainers of restic. Once the number of PRs has dropped considerably, I might
moved this PR back to the queue to be reviewed. In case you consider this PR
important, please contact me via the usual channels. Thank you!

@wplapper wplapper closed this May 30, 2025
Changes: cmd_prune.go: removed option `--repack-small` and marked it
deprecated.

Add changelog note.
@wplapper wplapper reopened this Aug 7, 2025
Additions: prune.go: created mapping of ``packsFromPackfiles`` so that
the information on all packfiles can be re-used.

Added function ``smallSizeEvaluation``which sorts the packfiles sizes and
then picks a percentile value from the the sorted list. A scale factor
will be apllied. If ``targetPackSize`` is smaller than the value returned
from this function, it will be replaced.

Added a test ``TestPrunePercentile`` in prune_test.go

git prune - the linter caught me

restic prune - prune.go - remove comments

removed commented code which is not longer used
added some quiet boundary checks and comments used variables
`percentIndex`, `rightmost` and `scaleFactor`.

Updated PR number
cmd/restic/cmd_prune.go:
introduced options `--percentile`and `--threshold` for easier change of
defaults. MAde sure that boundaries are sound before handling over
to repository.PlanPrune().

internal/repository/prune.go:
integrated new options `--percentile`and `--threshold`.
Set a minimum 'targetPackSize@ of 1 Mib to collect all smal packfiles.
@wplapper
Copy link
Copy Markdown
Contributor Author

This PR is getting out of sync with modern restic. Revert to Draft status.

@wplapper wplapper marked this pull request as draft November 21, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prune: improve automatic handling of small pack files

1 participant