This repository was archived by the owner on Jun 19, 2023. It is now read-only.
This repository was archived by the owner on Jun 19, 2023. It is now read-only.
Delete race in ARC cache #64
Closed
Description
Steps:
- Call Put & Delete on the same block at the same time.
- After finishing step 1, call Put on the block.
After step 1, the block may or may not be in the blockstore depending on how the operations serialize. However, after step 2, the block must be in the datastore.
Unfortunately, there's a race:
- Put 1: put the block.
- Delete 1: Delete the block.
- Delete 1: Cache that we don't have the block.
- Put 1: Cache that we have the block.
- Put 2: Check the cache, see that we should have the block, and walk away.
There's also a similar race between get & delete and get & put.
Fix: add striped (by CID) locking.
Impact:
- Put & Delete: data loss (in go-ipfs, requires GC)
- Get & Delete: data loss (in go-ipfs, requires GC)
- Get & Put: Inability to retrieve a block from the datastore (until restarting).