2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-02 09:00:50 +00:00

disable index uploads for prune command

+ modifications of changelog
This commit is contained in:
Alexander Weiss 2020-06-12 09:24:38 +02:00
parent 91906911b0
commit 70347e95d5
4 changed files with 13 additions and 4 deletions

View File

@ -1,8 +1,6 @@
Enhancement: Optimize repository implementation Enhancement: Optimize handling of new index entries
We've optimized the implementation of handling index entries in the repository.
Restic now uses less memory for backups which add a lot of data, e.g. large initial backups. Restic now uses less memory for backups which add a lot of data, e.g. large initial backups.
Also it is more stable in some edge situations and allows easier future enhancments. In addition, we've improved the stability in some edge cases.
https://github.com/restic/restic/pull/2773 https://github.com/restic/restic/pull/2773

View File

@ -87,6 +87,9 @@ func runPrune(gopts GlobalOptions) error {
return err return err
} }
// we do not need index updates while pruning!
repo.DisableAutoIndexUpdate()
return pruneRepository(gopts, repo) return pruneRepository(gopts, repo)
} }

View File

@ -140,6 +140,9 @@ 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.SaveFullIndex(ctx) return r.SaveFullIndex(ctx)
} }

View File

@ -28,6 +28,7 @@ type Repository struct {
keyName string keyName string
idx *MasterIndex idx *MasterIndex
restic.Cache restic.Cache
noAutoIndexUpdate bool
treePM *packerManager treePM *packerManager
dataPM *packerManager dataPM *packerManager
@ -45,6 +46,10 @@ func New(be restic.Backend) *Repository {
return repo return repo
} }
func (r *Repository) DisableAutoIndexUpdate() {
r.noAutoIndexUpdate = true
}
// Config returns the repository configuration. // Config returns the repository configuration.
func (r *Repository) Config() restic.Config { func (r *Repository) Config() restic.Config {
return r.cfg return r.cfg