Open ambertch opened 6 years ago
cc @franckc
Regarding condition 2, it's also possible avoid adding more decentralized state by having the pinner store (via SQLite or some simple local k/v data store) a little local state. Here's how this could work:
Condition / design 2 (with storing elapsed time since upload) also has some cool properties during failure states:
@ambertch @cuongdo I really like this idea of having the pinner storing hashes + timestamp in a local store. Especially because the logic would be simple and that approach should not cause too much operational overhead.
+1 for going in that direction
(this issue does not contain an immediate action, but serves to document an architectural discussion)
Context:
Currently, creating a listing is a transaction in the sense that separate operations take place:
It's most important to not lose data during these operations: it would be preferable to roll back a transaction and have the client retry, than to create a listing and lose the listing data stored in IPFS, for example.
Conditions upon which there could be data loss in IPFS:
One way to prevent this from occurring would be to disable automatic GC. A combination of profiling and monitoring would inform us when GC should occur, at which time all nodes would be put in maintenance mode to prevent new uploads, and after 1.5-3 minutes (6-12 confirmations, guaranteeing that all Origin content hashes would be in the blockchain events) GC invoked (via
ipfs repo gc
), then all nodes taken out of maintenance mode. This is a reasonable near-term solution since there will be a manageable volume of transactions, meaning that windows for GC maintenance could be anticipated and scheduled for a time during which transaction volume is low.One way to prevent this from occurring would be to keep a mapping of content hashes to upload time, in order to implement a grace period during which content cannot be unpinned. Upload times of specific content hashes are not stored in the IPFS DAG, so these would have to be manually recorded.