forked from TrueCloudLab/frostfs-node
[#1818] writecache: Update storage ID during flush
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
5cf75404dc
commit
bffb0f894c
2 changed files with 16 additions and 6 deletions
|
@ -180,7 +180,7 @@ func (c *cache) flushFSTree(ignoreErrors bool) error {
|
||||||
prm.Object = &obj
|
prm.Object = &obj
|
||||||
prm.RawData = data
|
prm.RawData = data
|
||||||
|
|
||||||
_, err = c.blobstor.Put(prm)
|
res, err := c.blobstor.Put(prm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if ignoreErrors {
|
if ignoreErrors {
|
||||||
c.log.Error("cant flush object to blobstor", zap.Error(err))
|
c.log.Error("cant flush object to blobstor", zap.Error(err))
|
||||||
|
@ -189,6 +189,16 @@ func (c *cache) flushFSTree(ignoreErrors bool) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var updPrm meta.UpdateStorageIDPrm
|
||||||
|
updPrm.SetAddress(addr)
|
||||||
|
updPrm.SetStorageID(res.StorageID)
|
||||||
|
|
||||||
|
_, err = c.metabase.UpdateStorageID(updPrm)
|
||||||
|
if err != nil {
|
||||||
|
c.log.Error("failed to update storage ID in metabase", zap.Error(err))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// mark object as flushed
|
// mark object as flushed
|
||||||
c.flushed.Add(sAddr, false)
|
c.flushed.Add(sAddr, false)
|
||||||
|
|
||||||
|
@ -231,11 +241,11 @@ func (c *cache) flushObject(obj *object.Object) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pPrm meta.PutPrm
|
var updPrm meta.UpdateStorageIDPrm
|
||||||
pPrm.SetObject(obj)
|
updPrm.SetAddress(objectCore.AddressOf(obj))
|
||||||
pPrm.SetStorageID(res.StorageID)
|
updPrm.SetStorageID(res.StorageID)
|
||||||
|
|
||||||
_, err = c.metabase.Put(pPrm)
|
_, err = c.metabase.UpdateStorageID(updPrm)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ type Option func(*options)
|
||||||
|
|
||||||
// meta is an interface for a metabase.
|
// meta is an interface for a metabase.
|
||||||
type metabase interface {
|
type metabase interface {
|
||||||
Put(meta.PutPrm) (meta.PutRes, error)
|
|
||||||
Exists(meta.ExistsPrm) (meta.ExistsRes, error)
|
Exists(meta.ExistsPrm) (meta.ExistsRes, error)
|
||||||
|
UpdateStorageID(meta.UpdateStorageIDPrm) (meta.UpdateStorageIDRes, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// blob is an interface for the blobstor.
|
// blob is an interface for the blobstor.
|
||||||
|
|
Loading…
Reference in a new issue