Fix/Allow reading expired locked object #56

Merged
carpawell merged 1 commits from fix/expired-locked-obj into master 2023-02-21 06:56:58 +00:00
3 changed files with 27 additions and 0 deletions

View File

@ -20,6 +20,7 @@ Changelog for FrostFS Node
- Pilorama now can merge multiple batches into one (#2231)
- Storage engine now can start even when some shard components are unavailable (#2238)
- `neofs-cli` buffer for object put increased from 4 KiB to 3 MiB (#2243)
- Expired locked object is available for reading (#56)
### Fixed
- Increase payload size metric on shards' `put` operation (#1794)

View File

@ -100,6 +100,11 @@ func (db *DB) exists(tx *bbolt.Tx, addr oid.Address, currEpoch uint64) (exists b
// - 2 if object is covered with tombstone;
// - 3 if object is expired.
func objectStatus(tx *bbolt.Tx, addr oid.Address, currEpoch uint64) uint8 {
// locked object could not be removed/marked with GC/expired
if objectLocked(tx, addr.Container(), addr.Object()) {
return 0
}
fyrchik commented 2023-02-16 06:05:49 +00:00 (Migrated from github.com)
Review

Can we have an explicit unit-test for this behaviour?

Can we have an explicit unit-test for this behaviour?
carpawell commented 2023-02-17 14:14:36 +00:00 (Migrated from github.com)
Review

sure, added

sure, added
// we check only if the object is expired in the current
// epoch since it is considered the only corner case: the
// GC is expected to collect all the objects that have

View File

@ -169,6 +169,27 @@ func TestDB_Lock(t *testing.T) {
})
}
func TestDB_Lock_Expired(t *testing.T) {
es := &epochState{e: 123}
db := newDB(t, meta.WithEpochState(es))
// put an object
addr := putWithExpiration(t, db, object.TypeRegular, 124)
// expire the obj
es.e = 125
_, err := metaGet(db, addr, false)
require.ErrorIs(t, err, meta.ErrObjectIsExpired)
// lock the obj
require.NoError(t, db.Lock(addr.Container(), oidtest.ID(), []oid.ID{addr.Object()}))
carpawell commented 2023-02-20 10:53:25 +00:00 (Migrated from github.com)
Review

Can we lock an already expired object

yes, and i do not see any problems with that, you? in practice i think that is almost impossible if GC is configured to be relatively fast

> Can we lock an already expired object yes, and i do not see any problems with that, you? in practice i think that is almost impossible if GC is configured to be relatively fast
fyrchik commented 2023-02-20 12:51:52 +00:00 (Migrated from github.com)
Review

Unexpired object should not exits, LOCKing it postfactum seems wrong.

Unexpired object should not exits, `LOCK`ing it postfactum seems wrong.
fyrchik commented 2023-02-20 12:52:03 +00:00 (Migrated from github.com)
Review

Again, not for this PR.

Again, not for this PR.
// object is expired but locked, thus, must be available
_, err = metaGet(db, addr, false)
require.NoError(t, err)
}
func TestDB_IsLocked(t *testing.T) {
db := newDB(t)