nspcc-dev / neofs-node

NeoFS is a decentralized distributed object storage integrated with the Neo blockchain
https://fs.neo.org
GNU General Public License v3.0
32 stars 38 forks source link

Ensure `StorageID` in metabase is used correctly #2888

Open carpawell opened 4 months ago

carpawell commented 4 months ago

Is your feature request related to a problem? Please describe.

I'm always frustrated when we use "dynamic" code. In the storage engine currently, we can accept any (non-empty) storage ID and think that it corresponds to the peapod (or blobovniczas tree earlier). In fact, we now store 1/2 IDs that are left by blobovnizcas (it was a migration mistake or some garbage) and nobody knows it.

Describe the solution you'd like

If a storage ID is unknown, do WARN or ERROR logs. All the storages can be checked additionally. Such a situation is completely erroneous, a metabase must be in sync with a blobstor, no unexpected IDs should be found.

https://github.com/nspcc-dev/neofs-node/blob/e6eeda121646193d248894a9ef25d48dc8b073ad/pkg/local_object_storage/blobstor/get.go#L29-L32

Describe alternatives you've considered

(:

Additional context

I have found blobovnicza tree's IDs in mainnet when looked at https://github.com/nspcc-dev/neofs-node/issues/2844.

carpawell commented 4 months ago

BTW, storage indexes hardcoding is also awful to me ([0] is for FSTree, and [1] is for peapod and just believe me).

cthulhu-rider commented 4 months ago

@carpawell SDK is not the best place for this issue :thinking:

carpawell commented 4 months ago

Woops

roman-khimov commented 4 months ago

Do we need storage ID at all?

carpawell commented 3 months ago

Do we need storage ID at all?

This is how we understand what storage to check (a "small" one (peapod currently) or a "big" one).