[#763] metabase: Add container objects counter

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-11-01 20:53:24 +03:00
parent 226e84d782
commit 9c98fa6152
7 changed files with 535 additions and 49 deletions

View file

@ -183,16 +183,8 @@ func (db *DB) insertObject(tx *bbolt.Tx, obj *objectSDK.Object, id []byte, si *o
}
if !isParent {
err = db.updateCounter(tx, phy, 1, true)
if err != nil {
return fmt.Errorf("could not increase phy object counter: %w", err)
}
// it is expected that putting an unavailable object is
// impossible and should be handled on the higher levels
err = db.updateCounter(tx, logical, 1, true)
if err != nil {
return fmt.Errorf("could not increase logical object counter: %w", err)
if err = db.incCounters(tx, cnr); err != nil {
return err
}
}