-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
change pinning to happen in a callback #1274
Conversation
89d7625
to
8dae027
Compare
if err != nil { | ||
res.SetError(err, cmds.ErrNormal) | ||
return | ||
} | ||
|
||
mp := n.Pinning.GetManual() | ||
mp.RemovePinWithMode(rnk, pin.Indirect) |
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.
why is this being removed?
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.
because it is added below (for all files found) and then re-added here?
why not just not pin anything until the end? i.e. remove the call to pin below and only pin recursively here after adding?
is the worry that something will GC in-between, while adding? (if so, ok makes sense).
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.
why not just not pin anything until the end?
thats what this PR is trying to avoid doing. in order to pin after the fact, you have to pull every single block in the dag back off the disk, and write the pin for it. This is really expensive when we get into the 50+GB range of add operations. (or in the 10MB+ range on my pi)
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.
is the worry that something will GC in-between, while adding? (if so, ok makes sense).
This too, a poorly timed gc could end really badly for us. (although its still not perfectly safe)
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.
maybe mark and sweep is TRTTD
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.
On Wed, May 27, 2015 at 11:42:36AM -0700, Jeromy Johnson wrote:
is the worry that something will GC in-between, while adding? (if
so, ok makes sense).This too, a poorly timed gc could end really badly for us. (although
its still not perfectly safe)
I think the right approach here is to have transactional changes to
the pin tree (see also the commit sessions discussed in #1187).
Coupling that with something like Git's gc.pruneexpire to avoid
garbage-collecting recently-created objects (say, in the last week?)
would give us better safety here. It would also protect folks from
accidentally GC'ing recent objects they'd forgotten to tag.
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.
Coupling that with something like Git's gc.pruneexpire
that's a great solution. of course it comes from git.
i'm really concerned about safety here--
@whyrusleeping @tv42 -- what's the plan long term?
+1 to the general idea.
|
On Wed, May 27, 2015 at 11:37:19AM -0700, Juan Batiz-Benet wrote: See also my callback suggestions in #1291. The post-chunk/layout |
yeah, i guess i used a key because i already had them in both places i was calling the callback. a node makes sense. |
d563763
to
38479ff
Compare
On Thu, May 28, 2015 at 03:08:23PM -0700, Jeromy Johnson wrote:
I'd still drop ‘root’ from your NodeCB signature, and I'd like to drop |
@@ -5,6 +5,13 @@ import ( | |||
"github.com/ipfs/go-ipfs/pin" | |||
) | |||
|
|||
// NodeCB is callback function for dag generation | |||
// the `root` flag signifies whether or not this is | |||
// the root of a dag. |
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.
i mean this is weird, right, because every node is the root of a dag.
maybe
the `last` flag signifies whether or not this is the last
(top-most root) node being added. useful for things like
only pinning the first node recursively.
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.
SGTM
I wold like that too, but i think this needs to switch to mark and sweet.
Well indirect pins need to be permanent. (or you mean only indirect pinning the root?) i think indirect pins can be dropped entirely if we go with mark-and-sweep as @tv42 suggested a while back. |
On Fri, May 29, 2015 at 12:27:34PM -0700, Juan Batiz-Benet wrote:
Yeah, or tri-color marking 1 or whatever. Explicitly using |
Let's continue the gc discussion here: ipfs/notes#11 |
change pinning to happen in a callback
change pinning to happen in a callback
this does the pinning for the add command inline (as it was intended to be) instead of after the fact. This has a significant perf improvement over the current speed of add, and that improvement increases the larger the file being added is.