forked from TrueCloudLab/restic
prune: no longer disable automatic index updates
this allows prune to resume an interrupted prune run.
This commit is contained in:
parent
9aa0c90fb2
commit
68fa0e0305
3 changed files with 0 additions and 18 deletions
|
@ -162,9 +162,6 @@ func runPrune(ctx context.Context, opts PruneOptions, gopts GlobalOptions, term
|
||||||
}
|
}
|
||||||
|
|
||||||
func runPruneWithRepo(ctx context.Context, opts PruneOptions, gopts GlobalOptions, repo *repository.Repository, ignoreSnapshots restic.IDSet, term *termstatus.Terminal) error {
|
func runPruneWithRepo(ctx context.Context, opts PruneOptions, gopts GlobalOptions, repo *repository.Repository, ignoreSnapshots restic.IDSet, term *termstatus.Terminal) error {
|
||||||
// we do not need index updates while pruning!
|
|
||||||
repo.DisableAutoIndexUpdate()
|
|
||||||
|
|
||||||
if repo.Cache == nil {
|
if repo.Cache == nil {
|
||||||
Print("warning: running prune without a cache, this may be very slow!\n")
|
Print("warning: running prune without a cache, this may be very slow!\n")
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,8 +200,5 @@ func (r *Repository) savePacker(ctx context.Context, t restic.BlobType, p *packe
|
||||||
r.idx.StorePack(id, p.Packer.Blobs())
|
r.idx.StorePack(id, p.Packer.Blobs())
|
||||||
|
|
||||||
// Save index if full
|
// Save index if full
|
||||||
if r.noAutoIndexUpdate {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return r.idx.SaveFullIndex(ctx, r)
|
return r.idx.SaveFullIndex(ctx, r)
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,6 @@ type Repository struct {
|
||||||
|
|
||||||
opts Options
|
opts Options
|
||||||
|
|
||||||
noAutoIndexUpdate bool
|
|
||||||
|
|
||||||
packerWg *errgroup.Group
|
packerWg *errgroup.Group
|
||||||
uploader *packerUploader
|
uploader *packerUploader
|
||||||
treePM *packerManager
|
treePM *packerManager
|
||||||
|
@ -130,12 +128,6 @@ func New(be backend.Backend, opts Options) (*Repository, error) {
|
||||||
return repo, nil
|
return repo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableAutoIndexUpdate deactives the automatic finalization and upload of new
|
|
||||||
// indexes once these are full
|
|
||||||
func (r *Repository) DisableAutoIndexUpdate() {
|
|
||||||
r.noAutoIndexUpdate = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// setConfig assigns the given config and updates the repository parameters accordingly
|
// setConfig assigns the given config and updates the repository parameters accordingly
|
||||||
func (r *Repository) setConfig(cfg restic.Config) {
|
func (r *Repository) setConfig(cfg restic.Config) {
|
||||||
r.cfg = cfg
|
r.cfg = cfg
|
||||||
|
@ -526,10 +518,6 @@ func (r *Repository) Flush(ctx context.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save index after flushing only if noAutoIndexUpdate is not set
|
|
||||||
if r.noAutoIndexUpdate {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return r.idx.SaveIndex(ctx, r)
|
return r.idx.SaveIndex(ctx, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue