forked from TrueCloudLab/frostfs-node
[#1412] shard: Resolve container is indexed on metabase resync
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
4572fa4874
commit
3da168f8cf
4 changed files with 49 additions and 2 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"sync"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
|
@ -275,6 +276,21 @@ func (s *Shard) refillObject(ctx context.Context, data []byte, addr oid.Address,
|
|||
return nil
|
||||
}
|
||||
|
||||
hasIndexedAttribute := slices.IndexFunc(obj.Attributes(), func(attr objectSDK.Attribute) bool { return meta.IsAtrributeIndexed(attr.Key()) }) > 0
|
||||
|
||||
var isIndexedContainer bool
|
||||
if hasIndexedAttribute {
|
||||
info, err := s.containerInfo.Info(addr.Container())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if info.Removed {
|
||||
s.log.Debug(logs.ShardSkipObjectFromResyncContainerDeleted, zap.Stringer("address", addr))
|
||||
return nil
|
||||
}
|
||||
isIndexedContainer = info.Indexed
|
||||
}
|
||||
|
||||
var err error
|
||||
switch obj.Type() {
|
||||
case objectSDK.TypeTombstone:
|
||||
|
@ -290,6 +306,7 @@ func (s *Shard) refillObject(ctx context.Context, data []byte, addr oid.Address,
|
|||
var mPrm meta.PutPrm
|
||||
mPrm.SetObject(obj)
|
||||
mPrm.SetStorageID(descriptor)
|
||||
mPrm.SetIndexAttributes(hasIndexedAttribute && isIndexedContainer)
|
||||
|
||||
_, err = s.metaBase.Put(ctx, mPrm)
|
||||
if err != nil && !client.IsErrObjectAlreadyRemoved(err) && !errors.Is(err, meta.ErrObjectIsExpired) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue