This repository was archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Add locks for pinning #2103
Copy link
Copy link
Closed
Labels
P1High: Likely tackled by core team if no one steps upHigh: Likely tackled by core team if no one steps upexp/wizardExtensive knowledge (implications, ramifications) requiredExtensive knowledge (implications, ramifications) requiredkind/bugA bug in existing code (including security flaws)A bug in existing code (including security flaws)kind/resolved-in-heliastatus/readyReady to be workedReady to be worked
Description
Currently there is no locking mechanism when modifying pins.
We should take a lock when performing any kind of pin operation, in order to prevent simultaneous pin operations from interfering with each other.
For example when adding a pin, we
- resolve the path
- get the object
- flush the pins
- store direct pins (1)
- store recursive pins (2)
- store a reference to the direct/recursive nodes (1 & 2)
- save the resulting CID to the datastore
Without locking, any of these asynchronous operations may occur concurrently and cause out-of-date or incomplete pin sets to to be stored.
The pin operations are currently managed in
I believe changes will only need to be made in pin.js, however the Garbage Collection PR includes some refactoring such that this structure will change somewhat, so I would suggest implementing a fix for this issue after the GC PR has landed.
We can refer to the go implementation of pinning for inspiration.
alanshaw
Metadata
Metadata
Assignees
Labels
P1High: Likely tackled by core team if no one steps upHigh: Likely tackled by core team if no one steps upexp/wizardExtensive knowledge (implications, ramifications) requiredExtensive knowledge (implications, ramifications) requiredkind/bugA bug in existing code (including security flaws)A bug in existing code (including security flaws)kind/resolved-in-heliastatus/readyReady to be workedReady to be worked