New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove GC timeout, fix GC tests #3494

Merged
merged 2 commits into from Dec 16, 2016
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+2 −17
Diff settings

Always

Just for now

Copy path View file
@@ -190,26 +190,11 @@ func (gc *GC) maybeGC(ctx context.Context, offset uint64) error {
// Do GC here
log.Info("Watermark exceeded. Starting repo GC...")
defer log.EventBegin(ctx, "repoGC").Done()
// 1 minute is sufficient for ~1GB unlink() blocks each of 100kb in SSD
_ctx, cancel := context.WithTimeout(ctx, time.Duration(gc.SlackGB)*time.Minute)
defer cancel()

if err := GarbageCollect(gc.Node, _ctx); err != nil {
if err := GarbageCollect(gc.Node, ctx); err != nil {
return err
}
newStorage, err := gc.Repo.GetStorageUsage()
if err != nil {
return err
}
log.Infof("Repo GC done. Released %s\n", humanize.Bytes(uint64(storage-newStorage)))
if newStorage > gc.StorageGC {
log.Warningf("post-GC: Watermark still exceeded")
if newStorage > gc.StorageMax {
err := ErrMaxStorageExceeded
log.Error(err)
return err
}
}
log.Infof("Repo GC done. See `ipfs repo stat` to see how much space got freed.\n")
}
return nil
}
ProTip! Use n and p to navigate between commits in a pull request.