forked from TrueCloudLab/frostfs-node
[#9999] metabase: Do not store payload hash to metabase
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
8bd3480ce6
commit
865cc69a6f
2 changed files with 0 additions and 83 deletions
|
@ -274,18 +274,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
|
||||
|
|
|
@ -333,77 +333,6 @@ func TestDB_SelectInhume(t *testing.T) {
|
|||
)
|
||||
}
|
||||
|
||||
func TestDB_SelectPayloadHash(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db := newDB(t)
|
||||
defer func() { require.NoError(t, db.Close()) }()
|
||||
|
||||
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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue