-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix maybeGC trigger condition #2010
Conversation
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
I'm still not sure about the StorageMax check. It's good that it tries to prevent effectless GC runs, but the calculation seems off to me. // GetStorageUsage computes the storage space taken by the repo in bytes
func (r *FSRepo) GetStorageUsage() (uint64, error) { storage, err := gc.Repo.GetStorageUsage()
// ...
if storage+offset > gc.StorageMax {
err := ErrMaxStorageExceeded
log.Error(err)
return err
} The check seems to assume that this is the space taken by all pinned objects, and that it can't possibly remove enough blocks to get back below watermark. Although it doesn't actually know how much space it can free, since GetStorageUsage() includes both pinned (not collectable) and non-pinned (collectable) blocks. The check would have to subtract the size of all pinned blocks, wdyt? |
I think it would also be okay to just leave the check out for now, and get smarter about GC later, incrementally. |
Yes currently it is agnostic to the pin-state of the hashes. I chose not to isolate the pinned blocks because (Also, I did propose for constraining the number of objects stored (unitless) instead of the space they occupy--faster to compute, but I'm not sure if it is harder to put the constraint) |
so it looks to me like if the GC fails once, the periodic routine exits. This seems wrong to me. core/corerepo/gc.go:157 |
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
Fixed. |
@rht still not sure we're understanding each other ;) pasting a few lines from another chat:
... so in my case (GetStorageUsage() = 27G, StorageMax = 20G) it refuses to run GC thinking it can't collect anything, while it can actually collect a lot. I think the check should either be deactivated/removed, or calculate the storage usage of pinned blocks as the base |
The point of this PR is to make GC run even when storage exceeds StorageMax. |
The check is cheaper than running the gc itself, and should stay. But sure I will implement the isolating the pin from the gc check, this removes false positive errs. |
Hehe you're right, sorry -- yesterday this patch didn't make a lot of sense to me, somehow, but at least it does now, lol. I'll give it a test on venus.i.ipfs.io right now. |
It works fine, thank you 👍 |
While you're at it I wonder if #1924 is still an issue? Though the mem fix is only in dev0.4.0. |
This LGTM. |
log.Warningf("post-GC: Watermark still exceeded") | ||
if newStorage > gc.StorageMax { | ||
err := ErrMaxStorageExceeded | ||
log.Error(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will already get logged in https://github.com/ipfs/go-ipfs/pull/2010/files#diff-1bdfa2c57df84e2debf3831f2bcecca5R157, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(yes should have been removed)
this LGTM -- solid work @rht @lgierth @whyrusleeping I'll merge now to keep this moving, can remove the log in another PR |
Caveat: if pin size > watermark or storagemax, the gc will trigger but won't clean the pinned files.
cc: @lgierth