[#1318] metabase: Add immediate object deletion

Mark objects with GC immediately after a Tombstone is received.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-04-08 20:06:13 +03:00 committed by LeL
parent 8107c8d1a9
commit fe8076e60a
3 changed files with 33 additions and 16 deletions

View file

@ -65,10 +65,11 @@ func TestInhumeTombOnTomb(t *testing.T) {
require.NoError(t, err)
// record with {addr1:addr2} should be removed from graveyard
// as a tomb-on-tomb
res, err := db.Exists(existsPrm.WithAddress(addr1))
require.NoError(t, err)
require.False(t, res.Exists())
// as a tomb-on-tomb; metabase should return ObjectNotFound
// NOT ObjectAlreadyRemoved since that record has been removed
// from graveyard but addr1 is still marked with GC
_, err = db.Exists(existsPrm.WithAddress(addr1))
require.ErrorAs(t, err, new(apistatus.ObjectNotFound))
// addr3 should be inhumed {addr3: addr1}
_, err = db.Exists(existsPrm.WithAddress(addr3))
@ -82,10 +83,10 @@ func TestInhumeTombOnTomb(t *testing.T) {
require.NoError(t, err)
// record with addr1 key should not appear in graveyard
// (tomb can not be inhumed)
res, err = db.Exists(existsPrm.WithAddress(addr1))
require.NoError(t, err)
require.False(t, res.Exists())
// (tomb can not be inhumed) but should be kept as object
// with GC mark
_, err = db.Exists(existsPrm.WithAddress(addr1))
require.ErrorAs(t, err, new(apistatus.ObjectNotFound))
}
func TestInhumeLocked(t *testing.T) {