diff --git a/pkg/local_object_storage/metabase/put.go b/pkg/local_object_storage/metabase/put.go index 28a15eeca..86619f5ee 100644 --- a/pkg/local_object_storage/metabase/put.go +++ b/pkg/local_object_storage/metabase/put.go @@ -277,18 +277,6 @@ func updateListIndexes(tx *bbolt.Tx, obj *objectSDK.Object, f updateIndexItemFun objKey := objectKey(idObj, make([]byte, objectKeySize)) bucketName := make([]byte, bucketKeySize) - cs, _ := obj.PayloadChecksum() - - // index payload hashes - err := f(tx, namedBucketItem{ - name: payloadHashBucketName(cnr, bucketName), - key: cs.Value(), - val: objKey, - }) - if err != nil { - return err - } - idParent, ok := obj.ParentID() // index parent ids diff --git a/pkg/local_object_storage/metabase/select_test.go b/pkg/local_object_storage/metabase/select_test.go index ea7a4d126..5f6d5175a 100644 --- a/pkg/local_object_storage/metabase/select_test.go +++ b/pkg/local_object_storage/metabase/select_test.go @@ -330,76 +330,6 @@ func TestDB_SelectInhume(t *testing.T) { ) } -func TestDB_SelectPayloadHash(t *testing.T) { - t.Parallel() - - db := newDB(t) - - cnr := cidtest.ID() - - raw1 := testutil.GenerateObjectWithCID(cnr) - err := putBig(db, raw1) - require.NoError(t, err) - - raw2 := testutil.GenerateObjectWithCID(cnr) - err = putBig(db, raw2) - require.NoError(t, err) - - cs, _ := raw1.PayloadChecksum() - payloadHash := hex.EncodeToString(cs.Value()) - - fs := objectSDK.SearchFilters{} - fs.AddFilter(v2object.FilterHeaderPayloadHash, - payloadHash, - objectSDK.MatchStringEqual) - - testSelect(t, db, cnr, fs, object.AddressOf(raw1)) - - fs = objectSDK.SearchFilters{} - fs.AddFilter(v2object.FilterHeaderPayloadHash, - payloadHash[:len(payloadHash)-1], - objectSDK.MatchCommonPrefix) - - testSelect(t, db, cnr, fs, object.AddressOf(raw1)) - - fs = objectSDK.SearchFilters{} - fs.AddFilter(v2object.FilterHeaderPayloadHash, - payloadHash, - objectSDK.MatchStringNotEqual) - - testSelect(t, db, cnr, fs, object.AddressOf(raw2)) - - fs = objectSDK.SearchFilters{} - fs.AddFilter(v2object.FilterHeaderPayloadHash, - "", - objectSDK.MatchNotPresent) - - testSelect(t, db, cnr, fs) - - t.Run("invalid hashes", func(t *testing.T) { - fs = objectSDK.SearchFilters{} - fs.AddFilter(v2object.FilterHeaderPayloadHash, - payloadHash[:len(payloadHash)-1], - objectSDK.MatchStringNotEqual) - - testSelect(t, db, cnr, fs, object.AddressOf(raw1), object.AddressOf(raw2)) - - fs = objectSDK.SearchFilters{} - fs.AddFilter(v2object.FilterHeaderPayloadHash, - payloadHash[:len(payloadHash)-2]+"x", - objectSDK.MatchCommonPrefix) - - testSelect(t, db, cnr, fs) - - fs = objectSDK.SearchFilters{} - fs.AddFilter(v2object.FilterHeaderPayloadHash, - payloadHash[:len(payloadHash)-3]+"x0", - objectSDK.MatchCommonPrefix) - - testSelect(t, db, cnr, fs) - }) -} - func TestDB_SelectWithSlowFilters(t *testing.T) { t.Parallel()