metabase: Set storageID even if there is no object in metabase #1008
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#1008
Loading…
Reference in a new issue
No description provided.
Delete branch "dstepanov-yadro/frostfs-node:fix/flush_upgrade_storage_id"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There may be a race condition between put an object and flushing the writecache:
To reproduce set
time.Sleep(10 * time.Second)
here:res, err := s.metaBase.Put(ctx, pPrm)
In logs:
222fbbe100
to0eff54cdbb
0eff54cdbb
tod5f2ab2ea5
d5f2ab2ea5
toe926f061ec
WIP: metabase: Do not update storageID on putto metabase: Set storageID even if there is no object in metabase@ -242,3 +239,1 @@
val: id,
})
if err != nil {
if err = setStorageID(tx, objectCore.AddressOf(obj), id, true); err != nil {
Correct me if I am wrong:
Now we will overwrite this ID, so if flush happened before PUT, the stored id will be invalid and won't change because the object will be removed from the writecache?
No. Flush doesnt set storageID if there is no object in metabase (exist = false).
Then I don't understand, what is the problem now (on master)?
If PUT happened before the
UpdateStorageID()
everything is ok.If PUT happened after the
UpdateStorageID()
everything is ok too, as you described in the comment.No.
I described so:
This means that after
Shard.Put
metabase hasstorageID = writecache
, but there is already no object in writecache (already flushed). Correct storageID is blobovnicza path, not writecache.@ -494,2 +489,2 @@
return bkt.Put(objectKey(addr.Object(), key), id)
key = objectKey(addr.Object(), key)
if !insertOnly || (bkt.Get(key) == nil && insertOnly) {
&& insertOnly
is not needed, as it is always true in this branchdone
e926f061ec
toa91ad86e35
@ -495,1 +489,3 @@
return bkt.Put(objectKey(addr.Object(), key), id)
key = objectKey(addr.Object(), key)
if !insertOnly || bkt.Get(key) == nil {
return bkt.Put(key, id)
Just for curiosity: if it happens that a shard inserts storageID for an object and, at the same time, updated Blobstor causes updating storageID for the object, may we expect some error like
g2 cannot Put because g1 is Getting
?Only one concurrent write tx is allowed. So it can be only
put->update
orupdate->put
.You can see the mechanics of it inside bbolt
Batch
function -- we amortize only fsyncs, the transactions themselves are executed sequentially.a91ad86e35
to6c3f9ec8a2
6c3f9ec8a2
to918613546f