[#461] metabase: Delete graves regardless of the presence of objects

`Inhume` operation can be performed on already deleted objects, and in this
case the entry will be added to the graveyard. `Delete` operation finishes
with error if object is not presented in metabase. However, the entry in the
cemetery must be deleted regardless of the presence of the object.

Additionally, now `Delete` does not return an error in the absence of an
object.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-04-06 17:07:42 +03:00 committed by Alex Vanin
parent 27cf6f5112
commit df909984bd
2 changed files with 27 additions and 4 deletions

View file

@ -102,3 +102,16 @@ func TestDeleteAllChildren(t *testing.T) {
require.NoError(t, err)
require.False(t, ex)
}
func TestGraveOnlyDelete(t *testing.T) {
db := newDB(t)
defer releaseDB(db)
addr := generateAddress()
// inhume non-existent object by address
require.NoError(t, meta.Inhume(db, addr, nil))
// delete the object data
require.NoError(t, meta.Delete(db, addr))
}