[#840] metabase: Distinguish objects with tombstones and GC marks

Each object from graveyard has tombstone or GC mark. If object has
tombstone, metabase should return `ErrAlreadyRemoved` on object requests.
This is the case when user clearly removed the object from container. GC
marks are used for physical removal which can appear even if object is still
presented in container (Control service, Policer job, etc.). In this case
metabase should return 404 error on object requests.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-09-24 18:18:04 +03:00 committed by Alex Vanin
parent 02e6df683a
commit 14329ab565
4 changed files with 42 additions and 9 deletions

View file

@ -94,6 +94,20 @@ func TestDB_Get(t *testing.T) {
require.NoError(t, err)
require.True(t, binaryEqual(child.CutPayload().Object(), newChild))
})
t.Run("get removed object", func(t *testing.T) {
obj := generateAddress()
ts := generateAddress()
require.NoError(t, meta.Inhume(db, obj, ts))
_, err := meta.Get(db, obj)
require.ErrorIs(t, err, object.ErrAlreadyRemoved)
obj = generateAddress()
require.NoError(t, meta.Inhume(db, obj, nil))
_, err = meta.Get(db, obj)
require.ErrorIs(t, err, object.ErrNotFound)
})
}
// binary equal is used when object contains empty lists in the structure and