[#1461] engine, policer: Force remove objects w/o container

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-06-14 20:48:33 +03:00 committed by fyrchik
parent 18ec5d7c8e
commit 51afcc1182
2 changed files with 16 additions and 0 deletions

View file

@ -15,6 +15,8 @@ import (
type InhumePrm struct {
tombstone *oid.Address
addrs []oid.Address
forceRemoval bool
}
// InhumeRes encapsulates results of inhume operation.
@ -42,6 +44,15 @@ func (p *InhumePrm) MarkAsGarbage(addrs ...oid.Address) {
}
}
// WithForceRemoval inhumes objects specified via MarkAsGarbage with GC mark
// without any object restrictions checks.
func (p *InhumePrm) WithForceRemoval() {
if p != nil {
p.forceRemoval = true
p.tombstone = nil
}
}
var errInhumeFailure = errors.New("inhume operation failed")
// Inhume calls metabase. Inhume method to mark an object as removed. It won't be
@ -66,6 +77,9 @@ func (e *StorageEngine) inhume(prm InhumePrm) (InhumeRes, error) {
}
var shPrm shard.InhumePrm
if prm.forceRemoval {
shPrm.ForceRemoval()
}
for i := range prm.addrs {
if prm.tombstone != nil {

View file

@ -31,6 +31,8 @@ func (p *Policer) processObject(ctx context.Context, addr oid.Address) {
if container.IsErrNotFound(err) {
var prm engine.InhumePrm
prm.MarkAsGarbage(addr)
prm.WithForceRemoval()
_, err := p.jobQueue.localStorage.Inhume(prm)
if err != nil {
p.log.Error("could not inhume object with missing container",