[#1323] metabase: Drop payload checksum index

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-08-19 17:20:55 +03:00 committed by Evgenii Stratonikov
parent 15dae8685e
commit 2542d4f5df
3 changed files with 9 additions and 24 deletions

View file

@ -297,18 +297,6 @@ func updateListIndexes(tx *bbolt.Tx, obj *objectSDK.Object, f updateIndexItemFun
objKey := objectKey(idObj, make([]byte, objectKeySize)) objKey := objectKey(idObj, make([]byte, objectKeySize))
bucketName := make([]byte, bucketKeySize) 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() idParent, ok := obj.ParentID()
// index parent ids // index parent ids

View file

@ -195,11 +195,9 @@ func (db *DB) selectFastFilter(
switch f.Header() { switch f.Header() {
case v2object.FilterHeaderObjectID: case v2object.FilterHeaderObjectID:
db.selectObjectID(tx, f, cnr, to, fNum, currEpoch) db.selectObjectID(tx, f, cnr, to, fNum, currEpoch)
case v2object.FilterHeaderOwnerID: case v2object.FilterHeaderOwnerID,
v2object.FilterHeaderPayloadHash:
return // moved to slow filters return // moved to slow filters
case v2object.FilterHeaderPayloadHash:
bucketName := payloadHashBucketName(cnr, bucketName)
db.selectFromList(tx, bucketName, f, to, fNum)
case v2object.FilterHeaderObjectType: case v2object.FilterHeaderObjectType:
for _, bucketName := range bucketNamesForType(cnr, f.Operation(), f.Value()) { for _, bucketName := range bucketNamesForType(cnr, f.Operation(), f.Value()) {
selectAllFromBucket(tx, bucketName, to, fNum) selectAllFromBucket(tx, bucketName, to, fNum)
@ -511,6 +509,9 @@ func (db *DB) matchSlowFilters(tx *bbolt.Tx, addr oid.Address, f objectSDK.Searc
binary.LittleEndian.PutUint64(data, obj.PayloadSize()) binary.LittleEndian.PutUint64(data, obj.PayloadSize())
case v2object.FilterHeaderOwnerID: case v2object.FilterHeaderOwnerID:
data = []byte(obj.OwnerID().EncodeToString()) data = []byte(obj.OwnerID().EncodeToString())
case v2object.FilterHeaderPayloadHash:
cs, _ := obj.PayloadChecksum()
data = cs.Value()
default: default:
continue // ignore unknown search attributes continue // ignore unknown search attributes
} }
@ -546,7 +547,8 @@ func groupFilters(filters objectSDK.SearchFilters) (filterGroup, error) {
v2object.FilterHeaderCreationEpoch, v2object.FilterHeaderCreationEpoch,
v2object.FilterHeaderPayloadLength, v2object.FilterHeaderPayloadLength,
v2object.FilterHeaderHomomorphicHash, v2object.FilterHeaderHomomorphicHash,
v2object.FilterHeaderOwnerID: v2object.FilterHeaderOwnerID,
v2object.FilterHeaderPayloadHash:
res.slowFilters = append(res.slowFilters, filters[i]) res.slowFilters = append(res.slowFilters, filters[i])
default: // fast filters or user attributes if unknown default: // fast filters or user attributes if unknown
res.fastFilters = append(res.fastFilters, filters[i]) res.fastFilters = append(res.fastFilters, filters[i])

View file

@ -102,10 +102,10 @@ const (
// List index buckets. // List index buckets.
// ==================== // ====================
// payloadHashPrefix is used for prefixing List index buckets mapping payload hash to a list of object IDs. // payloadHashPrefix was used for prefixing List index buckets mapping payload hash to a list of object IDs.
// Key: payload hash // Key: payload hash
// Value: list of object IDs // Value: list of object IDs
payloadHashPrefix _
// parentPrefix is used for prefixing List index buckets mapping parent ID to a list of children IDs. // parentPrefix is used for prefixing List index buckets mapping parent ID to a list of children IDs.
// Key: parent ID // Key: parent ID
// Value: list of object IDs // Value: list of object IDs
@ -170,11 +170,6 @@ func cidFromAttributeBucket(val []byte, attributeKey string) []byte {
return val[1:bucketKeySize] return val[1:bucketKeySize]
} }
// payloadHashBucketName returns <CID>_payloadhash.
func payloadHashBucketName(cnr cid.ID, key []byte) []byte {
return bucketName(cnr, payloadHashPrefix, key)
}
// rootBucketName returns <CID>_root. // rootBucketName returns <CID>_root.
func rootBucketName(cnr cid.ID, key []byte) []byte { func rootBucketName(cnr cid.ID, key []byte) []byte {
return bucketName(cnr, rootPrefix, key) return bucketName(cnr, rootPrefix, key)