[#1408] metabase: Fix EC search with slow and fast filters
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
f83f7feb8c
commit
434048e8d9
2 changed files with 83 additions and 2 deletions
|
@ -762,6 +762,56 @@ func TestDB_SelectOwnerID(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestDB_SelectECWithFastAndSlowFilters(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db := newDB(t)
|
||||
defer func() { require.NoError(t, db.Close()) }()
|
||||
|
||||
cnr := cidtest.ID()
|
||||
ecChunk1 := oidtest.ID()
|
||||
ecChunk2 := oidtest.ID()
|
||||
ecParent := oidtest.ID()
|
||||
var ecParentAddr oid.Address
|
||||
ecParentAddr.SetContainer(cnr)
|
||||
ecParentAddr.SetObject(ecParent)
|
||||
var ecParentAttr []objectSDK.Attribute
|
||||
var attr objectSDK.Attribute
|
||||
attr.SetKey(objectSDK.AttributeFilePath)
|
||||
attr.SetValue("/1/2/3")
|
||||
ecParentAttr = append(ecParentAttr, attr)
|
||||
|
||||
chunkObj := testutil.GenerateObjectWithCID(cnr)
|
||||
chunkObj.SetContainerID(cnr)
|
||||
chunkObj.SetID(ecChunk1)
|
||||
chunkObj.SetPayload([]byte{0, 1, 2, 3, 4})
|
||||
chunkObj.SetPayloadSize(uint64(5))
|
||||
chunkObj.SetECHeader(objectSDK.NewECHeader(objectSDK.ECParentInfo{ID: ecParent, Attributes: ecParentAttr}, 0, 3, []byte{}, 0))
|
||||
|
||||
chunkObj2 := testutil.GenerateObjectWithCID(cnr)
|
||||
chunkObj2.SetContainerID(cnr)
|
||||
chunkObj2.SetID(ecChunk2)
|
||||
chunkObj2.SetPayload([]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9})
|
||||
chunkObj2.SetPayloadSize(uint64(10))
|
||||
chunkObj2.SetECHeader(objectSDK.NewECHeader(objectSDK.ECParentInfo{ID: ecParent, Attributes: ecParentAttr}, 1, 3, []byte{}, 0))
|
||||
|
||||
// put object with EC
|
||||
|
||||
var prm meta.PutPrm
|
||||
prm.SetObject(chunkObj)
|
||||
_, err := db.Put(context.Background(), prm)
|
||||
require.NoError(t, err)
|
||||
|
||||
prm.SetObject(chunkObj2)
|
||||
_, err = db.Put(context.Background(), prm)
|
||||
require.NoError(t, err)
|
||||
|
||||
fs := objectSDK.SearchFilters{}
|
||||
fs.AddRootFilter()
|
||||
fs.AddFilter(objectSDK.AttributeFilePath, "/1/2/3", objectSDK.MatchCommonPrefix)
|
||||
testSelect(t, db, cnr, fs, ecParentAddr)
|
||||
}
|
||||
|
||||
type testTarget struct {
|
||||
objects []*objectSDK.Object
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue