From 09938a98411142872f9c0981c9d21a6a49ebb058 Mon Sep 17 00:00:00 2001
From: Pavel Karpy
Date: Thu, 20 Apr 2023 19:17:08 +0300
Subject: [PATCH] Revert "[#262] meta: Do not return old expired objects"
This reverts commit 3d23b087
Signed-off-by: Pavel Karpy
---
CHANGELOG.md | 1 -
pkg/local_object_storage/metabase/db_test.go | 7 ------
pkg/local_object_storage/metabase/get.go | 13 +---------
pkg/local_object_storage/metabase/util.go | 25 --------------------
4 files changed, 1 insertion(+), 45 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 954bad844..8a9bcfd41 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,7 +8,6 @@ Changelog for FrostFS Node
### Fixed
- Take network settings into account during netmap contract update (#100)
- Read config files from dir even if config file not provided via `--config` for node (#238)
-- Expired by more than 1 epoch objects could be returned (#262)
- Notary requests parsing according to `neo-go`'s updates (#268)
### Removed
diff --git a/pkg/local_object_storage/metabase/db_test.go b/pkg/local_object_storage/metabase/db_test.go
index a3b26da79..9ef7bf8bc 100644
--- a/pkg/local_object_storage/metabase/db_test.go
+++ b/pkg/local_object_storage/metabase/db_test.go
@@ -73,13 +73,6 @@ func checkExpiredObjects(t *testing.T, db *meta.DB, f func(exp, nonExp *objectSD
require.NoError(t, metaPut(db, nonExpObj, nil))
f(expObj, nonExpObj)
-
- oldExpObj := testutil.GenerateObject()
- setExpiration(oldExpObj, 1)
-
- require.NoError(t, metaPut(db, oldExpObj, nil))
-
- f(oldExpObj, nonExpObj)
}
func setExpiration(o *objectSDK.Object, epoch uint64) {
diff --git a/pkg/local_object_storage/metabase/get.go b/pkg/local_object_storage/metabase/get.go
index c3a5880bf..fff32d6ad 100644
--- a/pkg/local_object_storage/metabase/get.go
+++ b/pkg/local_object_storage/metabase/get.go
@@ -66,24 +66,13 @@ func (db *DB) Get(ctx context.Context, prm GetPrm) (res GetRes, err error) {
}
currEpoch := db.epochState.CurrentEpoch()
- var obj *objectSDK.Object
err = db.boltDB.View(func(tx *bbolt.Tx) error {
key := make([]byte, addressKeySize)
- obj, err = db.get(tx, prm.addr, key, true, prm.raw, currEpoch)
+ res.hdr, err = db.get(tx, prm.addr, key, true, prm.raw, currEpoch)
return err
})
- if err != nil {
- return
- }
-
- err = validate(obj, currEpoch)
- if err != nil {
- return
- }
-
- res.hdr = obj
return
}
diff --git a/pkg/local_object_storage/metabase/util.go b/pkg/local_object_storage/metabase/util.go
index d4c93c750..b60c97fd7 100644
--- a/pkg/local_object_storage/metabase/util.go
+++ b/pkg/local_object_storage/metabase/util.go
@@ -4,9 +4,7 @@ import (
"bytes"
"crypto/sha256"
"fmt"
- "strconv"
- objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
@@ -261,26 +259,3 @@ func isLockObject(tx *bbolt.Tx, idCnr cid.ID, obj oid.ID) bool {
bucketNameLockers(idCnr, make([]byte, bucketKeySize)),
objectKey(obj, make([]byte, objectKeySize)))
}
-
-// performs object validity checks.
-func validate(obj *object.Object, currEpoch uint64) error {
- for _, a := range obj.Attributes() {
- if key := a.Key(); key != objectV2.SysAttributeExpEpoch && key != objectV2.SysAttributeExpEpochNeoFS {
- continue
- }
-
- expEpoch, err := strconv.ParseUint(a.Value(), 10, 64)
- if err != nil {
- // unexpected for already stored and valudated objects
- return fmt.Errorf("expiration epoch parsing: %w", err)
- }
-
- if expEpoch < currEpoch {
- return ErrObjectIsExpired
- }
-
- break
- }
-
- return nil
-}
--
2.45.2