[#9999] metabase: Do not store payload hash to metabase

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-02-20 16:59:05 +03:00
parent a62d76fd6f
commit 5cb95c065e
2 changed files with 0 additions and 82 deletions

View file

@ -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

View file

@ -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()