Skip to content
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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 2 additions & 17 deletions core/corerepo/gc.go
Expand Up @@ -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
}