mirror of
https://github.com/octoleo/restic.git
synced 2024-12-24 11:55:28 +00:00
Remove RepackSmall
This commit is contained in:
parent
1dd9fdce74
commit
095155d9ce
@ -43,7 +43,6 @@ type PruneOptions struct {
|
|||||||
MaxUnusedBytes uint64
|
MaxUnusedBytes uint64
|
||||||
MaxRepackSize string
|
MaxRepackSize string
|
||||||
MaxRepackBytes uint64
|
MaxRepackBytes uint64
|
||||||
// RepackSmall bool <- This option may be added later
|
|
||||||
RepackCachableOnly bool
|
RepackCachableOnly bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +60,6 @@ func addPruneOptions(c *cobra.Command) {
|
|||||||
f.StringVar(&pruneOptions.MaxUnused, "max-unused", "5%", "tolerate given `limit` of unused space (allowed suffixes: k/K, m/M, g/G, t/T or value in %)")
|
f.StringVar(&pruneOptions.MaxUnused, "max-unused", "5%", "tolerate given `limit` of unused space (allowed suffixes: k/K, m/M, g/G, t/T or value in %)")
|
||||||
f.StringVar(&pruneOptions.MaxRepackSize, "max-repack-size", "", "maximum `size` to repack (allowed suffixes: k/K, m/M, g/G, t/T)")
|
f.StringVar(&pruneOptions.MaxRepackSize, "max-repack-size", "", "maximum `size` to repack (allowed suffixes: k/K, m/M, g/G, t/T)")
|
||||||
f.BoolVar(&pruneOptions.RepackCachableOnly, "repack-cacheable-only", false, "only repack packs which are cacheable")
|
f.BoolVar(&pruneOptions.RepackCachableOnly, "repack-cacheable-only", false, "only repack packs which are cacheable")
|
||||||
// f.BoolVar(&pruneOptions.RepackSmall, "repack-small", false, "also repack small packs")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyPruneOptions(opts *PruneOptions) error {
|
func verifyPruneOptions(opts *PruneOptions) error {
|
||||||
@ -314,7 +312,7 @@ func prune(opts PruneOptions, gopts GlobalOptions, repo restic.Repository, usedB
|
|||||||
|
|
||||||
case opts.RepackCachableOnly && p.tpe == restic.DataBlob,
|
case opts.RepackCachableOnly && p.tpe == restic.DataBlob,
|
||||||
// if this is a data pack and --repack-cacheable-only is set => keep pack!
|
// if this is a data pack and --repack-cacheable-only is set => keep pack!
|
||||||
p.unusedBlobs == 0 && p.duplicateBlobs == 0 && p.tpe != restic.InvalidBlob: // && (!opts.RepackSmall || packSize >= repository.MinPackSize)
|
p.unusedBlobs == 0 && p.duplicateBlobs == 0 && p.tpe != restic.InvalidBlob:
|
||||||
// All blobs in pack are used and not duplicates/mixed => keep pack!
|
// All blobs in pack are used and not duplicates/mixed => keep pack!
|
||||||
stats.packs.keep++
|
stats.packs.keep++
|
||||||
|
|
||||||
@ -364,10 +362,6 @@ func prune(opts PruneOptions, gopts GlobalOptions, repo restic.Repository, usedB
|
|||||||
return true
|
return true
|
||||||
case pj.tpe == restic.InvalidBlob && pi.tpe != restic.InvalidBlob:
|
case pj.tpe == restic.InvalidBlob && pi.tpe != restic.InvalidBlob:
|
||||||
return false
|
return false
|
||||||
//case opts.RepackSmall && pi.unusedSize+pi.usedSize < repository.MinPackSize && pj.unusedSize+pj.usedSize >= repository.MinPackSize:
|
|
||||||
// return true
|
|
||||||
//case opts.RepackSmall && pj.unusedSize+pj.usedSize < repository.MinPackSize && pi.unusedSize+pi.usedSize >= repository.MinPackSize:
|
|
||||||
// return false
|
|
||||||
}
|
}
|
||||||
return pi.unusedSize*pj.usedSize > pj.unusedSize*pi.usedSize
|
return pi.unusedSize*pj.usedSize > pj.unusedSize*pi.usedSize
|
||||||
})
|
})
|
||||||
|
@ -1409,15 +1409,6 @@ func TestPrune(t *testing.T) {
|
|||||||
checkOpts := CheckOptions{ReadData: true}
|
checkOpts := CheckOptions{ReadData: true}
|
||||||
testPrune(t, opts, checkOpts)
|
testPrune(t, opts, checkOpts)
|
||||||
})
|
})
|
||||||
|
|
||||||
/* repack-small option will come in future
|
|
||||||
t.Run("Small", func(t *testing.T) {
|
|
||||||
opts = PruneOptions{MaxUnusedPercent: 100.0, RepackSmall: true}
|
|
||||||
// The test case only produces small files; hence no unused blobs should remain.
|
|
||||||
checkOpts = CheckOptions{ReadData: true, CheckUnused: true}
|
|
||||||
testPrune(t, opts, checkOpts)
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testPrune(t *testing.T, pruneOpts PruneOptions, checkOpts CheckOptions) {
|
func testPrune(t *testing.T, pruneOpts PruneOptions, checkOpts CheckOptions) {
|
||||||
|
Loading…
Reference in New Issue
Block a user