feat: add experimental on-demand pinning - #11252
Conversation
48a25c8 to
8802724
Compare
|
Please focus the review on: 1. Core logic —
|
|
@guillaumemichel Please re-run the checks. I addressed the failing ones for overfull lines , typos, and changelog. |
|
Triage note: we run out of time to review this in 0.41 iteration, but we've added it to 0.42. Thank you for your contribution and patience. 🙏 |
|
Triage: need careful review and testing. |
|
Triage: short on review bandwidth for v0.42, so we'd like to land this in v0.43 instead. I've rebased on latest master and moved the changelog entry to |
|
Hi @lidel , just checking in on this. Please let me know if there’s any additional documentation, context, or testing steps I can provide to help ease the review. |
lidel
left a comment
There was a problem hiding this comment.
Thanks for waiting @ihlec. This deserved a real review a lot sooner than it got one.
Being straight with you: maintainer time on Kubo is a small shared budget this quarter, and this is a lot of code. A new package, new config, new commands, and a loop that pins and unpins on its own. That is not something I can skim, and a feature that deletes pins by itself really shouldn't be skimmed. I kept not finding the hours, and the release ran out first.
So I'm moving it to draft and off v0.43. That is not a rejection. I believe the idea is good and could be added to future Kubo, but pin ownership, the pin and unpin loop, and the name all need a decision before more code goes in. The inline comments say where I would take each one to be less brittle and respect user config. Feel free to push back on any of it, this is a first-pass set of comments, possible I misunderstood something.
Add a background checker that automatically pins content when DHT provider counts fall below a configurable replication target and unpins once enough providers exist again after a grace period.
Gated behind Experimental.OnDemandPinningEnabled.
New CLI commands: ipfs pin ondemand {add,rm,ls}
Safety measures:
- storage budget check (respects StorageMax/GCWatermark)
- idle timeout on recursive DAG fetches (2 min without progress)
- pin partitioning via pin name to distinguish on-demand pins from persitent pins.
…adding v0.42 changelog entry
On-demand pinning is not landing in v0.43. Review is open and the design needs changes first, so park the highlight in vFUTURE.md and restore v0.43.md to the upstream skeleton.
…nown replica number
…ilures (also parallel now)
checkAll looked up CIDs one by one and blocked the sweep on Pin, so a slow fetch delayed every other CID. Successful checks also cleared NextCheckAt, so stable CIDs were DHT-queried again every CheckInterval. Run due checks concurrently, set NextCheckAt from the outcome so deadband/grace CIDs wait longer, and stop FindProviders once the decision is known. Enqueue no longer drops when busy. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hi @lidel, I pushed the CI fixes. |
Resolves fakeClock error in unit test (format mismatch)
Summary
Automatically pin content when DHT provider counts fall below a configurable replication target, and unpin once
replication has been above target for a grace period.
Helps keeping critical data around, without wasting storage on overly replicated CIDs.
The feature is described in this draft: ipfs/specs#532
The feature is gated behind
Experimental.OnDemandPinningEnabled.CLI commands for
ipfs pin ondemand:add-- register CIDs for on-demand pinningrm-- deregister and unpinls-- list registered CIDsDesign
pins to avoid accidental deletion. This implementation uses boxo's pin name
field (
"on-demand") for that.StorageMax * StorageGCWatermark.without receiving new blocks (allows large downloads while skipping dead records).
susceptible to Sybil manipulation. Documented as a known limitation.
Configuration Parameters (TBD)
OnDemandPinning.ReplicationTarget5OnDemandPinning.CheckInterval"10m"OnDemandPinning.UnpinGracePeriod"24h"Tests
Unit tests for the checker and store in
ondemandpin/.Visualization of Feature
(out of scope for this CLI PR, but helpful to get the idea)
