-
-
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
Add 'ipfs pin update' command #3754
Comments
cc @ianopolous for further usecase discussion |
This sounds fairly easy and self-contained. @whyrusleeping is this what you had in mind for the syntax?
|
@kevina Yeap! That is indeed |
Okay I will work on implementing it this week. |
Let me give some more details around our use case:
This allows us to guarantee to not be in an inconsistent state if the process aborts at any stage, including relative to arbitrary concurrent GCs. If the process aborts after 1, the IPNS is still pointing to the old root which is still pinned. If it aborts after 2, then we have committed the write, but just have an extra pin which is fine, and can be corrected later. For us to be able to use this in step 1 it can't unpin the old root, that would still need to be step 3. That could be an option though, whether or not to unpin the old root. Thoughts? @whyrusleeping |
Yeah, we can definitely have a |
Based on my understand how
and the new pin uses Let me know if you still think it is worth it. Another option I consider is to rework the pinning code to support batch operations. I am not sure how much we can save here for this use case, but in the case when a full traversal of all recursive pins is required the savings can be significant. |
Our use case involves a btree. If our btree is depth n it has O(16^n) nodes. During a write, we only have to modify O(n) elements, from the new/modified element down to the root. So if you lazily traverse the old graph to discover already pinned sub-trees as you pin the new one, you will get reduction from O(16^n) to O(n) for the pin add component. |
@kevina This is the optimization, lets say we have a pin on node
And lets say 'a' is a directory that we patch a new file into:
Now, with The savings here get much high the larger the graphs are, this is a very common thing, and it will actually make |
The relevant PR is #3846 |
Removing my assignment. @whyrusleeping decided to do the p.r. |
PR is up, will likely merge in 0.4.10 |
closing as #3846 has been merged |
Usecase: I have a large graph pinned. I make a change to this graph, and now i want to pin the new root, and unpin the old root.
You can accomplish this today by just
ipfs pin add <NEW>
andipfs pin rm <OLD>
but this has a couple drawbacks. First, it has to rescan the entire new graph. If we had the context of the old pin around, we could skip traversing subtrees that are in the old graph since theyre already pinned (and guaranteed as far as this process is concerned to be there). This would make the pin update process much faster. The second concern, which is relatively minor in comparison is that doing add and rm is two operations on the pinset, where an update could be coalesced into just one. Pinset modifications currently get expensive with a very large number of pins, and this might be noticeable.The text was updated successfully, but these errors were encountered: