nspcc-dev / nspcc-dev/neofs-node
Local object store behavior for Put of already existing objects
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 38
- Forks
- 51
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 38
Description
Is your feature request related to a problem? Please describe.
common.Storage interface exposes a Put() function that's supposed to be pushing objects into the store. One can Put an object and then Put it again. What happens next? Currently:
Putsucceeds, returningnil- data is overwritten (FSTree/Peapod/bbcz)
In general we suppose that objects are immutable and we have the same data for the same object. Which means that the first point is likely correct. If that's the case then the second one doesn't matter. However if you're to change the logic of FSTree to preserve an already existing file TestRefillMetabaseCorrupted suddenly starts to fail because it relies on this overwriting semantics.
Describe the solution you'd like
We need to specify what the proper behavior is for all stores.
Describe alternatives you've considered
And it's not that easy, because:
- we can have concurrent writers pushing the same data, these prefer to see
niland don't care about overwriting, that's the most common case - old data is supposed to be good, so overwriting is not necessary
- we can also have errors leading to different data being pushed for the same address, in this case keeping old data is also more safe
- but in this case returning
nillooks bad since writer would think that he has successfully pushed something into the store, but anyGetwould reveal that it's not exactly true (the data is different) - if we're to overwrite then
nilmakes total sense - old data can be corrupted as well, so we may want to do a forced write (although it can be done with Delete/Put)
- checking data consistency and returning different status based on that sounds nice, but can lead to substantial overhead that is not justified for the most common case
- always returning EEXIST is an option (let the upper layer handle), but can be daunting for callers
So, what do we really want from our stores?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the common.Storage Put contract and compare the existing behavior of FSTree, Peapod, and bbcz for repeated writes. Read TestRefillMetabaseCorrupted to understand its reliance on overwriting. Done means the repeated-Put behavior is agreed for all stores and the relevant tests reflect that decision.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100