[#9999] metabase: Do not store all user attributes
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
5cb95c065e
commit
bf0ec1ad7e
2 changed files with 6 additions and 125 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
gio "io"
|
||||
"time"
|
||||
|
||||
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
||||
objectCore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
|
||||
storagelog "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/log"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr"
|
||||
|
@ -101,7 +102,8 @@ func (db *DB) put(tx *bbolt.Tx,
|
|||
obj *objectSDK.Object,
|
||||
id []byte,
|
||||
si *objectSDK.SplitInfo,
|
||||
currEpoch uint64) error {
|
||||
currEpoch uint64,
|
||||
) error {
|
||||
cnr, ok := obj.ContainerID()
|
||||
if !ok {
|
||||
return errors.New("missing container in object")
|
||||
|
@ -325,6 +327,9 @@ func updateFKBTIndexes(tx *bbolt.Tx, obj *objectSDK.Object, f updateIndexItemFun
|
|||
|
||||
// user specified attributes
|
||||
for i := range attrs {
|
||||
if attrs[i].Key() != objectV2.SysAttributeExpEpoch && attrs[i].Key() != "S3-Access-Box-CRDT-Name" {
|
||||
continue
|
||||
}
|
||||
key = attributeBucketName(cnr, attrs[i].Key(), key)
|
||||
err := f(tx, namedBucketItem{
|
||||
name: key,
|
||||
|
|
|
@ -19,130 +19,6 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestDB_SelectUserAttributes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db := newDB(t)
|
||||
|
||||
cnr := cidtest.ID()
|
||||
|
||||
raw1 := testutil.GenerateObjectWithCID(cnr)
|
||||
testutil.AddAttribute(raw1, "foo", "bar")
|
||||
testutil.AddAttribute(raw1, "x", "y")
|
||||
|
||||
err := putBig(db, raw1)
|
||||
require.NoError(t, err)
|
||||
|
||||
raw2 := testutil.GenerateObjectWithCID(cnr)
|
||||
testutil.AddAttribute(raw2, "foo", "bar")
|
||||
testutil.AddAttribute(raw2, "x", "z")
|
||||
|
||||
err = putBig(db, raw2)
|
||||
require.NoError(t, err)
|
||||
|
||||
raw3 := testutil.GenerateObjectWithCID(cnr)
|
||||
testutil.AddAttribute(raw3, "a", "b")
|
||||
|
||||
err = putBig(db, raw3)
|
||||
require.NoError(t, err)
|
||||
|
||||
raw4 := testutil.GenerateObjectWithCID(cnr)
|
||||
testutil.AddAttribute(raw4, "path", "test/1/2")
|
||||
|
||||
err = putBig(db, raw4)
|
||||
require.NoError(t, err)
|
||||
|
||||
raw5 := testutil.GenerateObjectWithCID(cnr)
|
||||
testutil.AddAttribute(raw5, "path", "test/1/3")
|
||||
|
||||
err = putBig(db, raw5)
|
||||
require.NoError(t, err)
|
||||
|
||||
raw6 := testutil.GenerateObjectWithCID(cnr)
|
||||
testutil.AddAttribute(raw6, "path", "test/2/3")
|
||||
|
||||
err = putBig(db, raw6)
|
||||
require.NoError(t, err)
|
||||
|
||||
fs := objectSDK.SearchFilters{}
|
||||
fs.AddFilter("foo", "bar", objectSDK.MatchStringEqual)
|
||||
testSelect(t, db, cnr, fs,
|
||||
object.AddressOf(raw1),
|
||||
object.AddressOf(raw2),
|
||||
)
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter("x", "y", objectSDK.MatchStringEqual)
|
||||
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter("x", "y", objectSDK.MatchStringNotEqual)
|
||||
testSelect(t, db, cnr, fs, object.AddressOf(raw2))
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter("a", "b", objectSDK.MatchStringEqual)
|
||||
testSelect(t, db, cnr, fs, object.AddressOf(raw3))
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter("c", "d", objectSDK.MatchStringEqual)
|
||||
testSelect(t, db, cnr, fs)
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter("foo", "", objectSDK.MatchNotPresent)
|
||||
testSelect(t, db, cnr, fs,
|
||||
object.AddressOf(raw3),
|
||||
object.AddressOf(raw4),
|
||||
object.AddressOf(raw5),
|
||||
object.AddressOf(raw6),
|
||||
)
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter("a", "", objectSDK.MatchNotPresent)
|
||||
testSelect(t, db, cnr, fs,
|
||||
object.AddressOf(raw1),
|
||||
object.AddressOf(raw2),
|
||||
object.AddressOf(raw4),
|
||||
object.AddressOf(raw5),
|
||||
object.AddressOf(raw6),
|
||||
)
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
testSelect(t, db, cnr, fs,
|
||||
object.AddressOf(raw1),
|
||||
object.AddressOf(raw2),
|
||||
object.AddressOf(raw3),
|
||||
object.AddressOf(raw4),
|
||||
object.AddressOf(raw5),
|
||||
object.AddressOf(raw6),
|
||||
)
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter("key", "", objectSDK.MatchNotPresent)
|
||||
testSelect(t, db, cnr, fs,
|
||||
object.AddressOf(raw1),
|
||||
object.AddressOf(raw2),
|
||||
object.AddressOf(raw3),
|
||||
object.AddressOf(raw4),
|
||||
object.AddressOf(raw5),
|
||||
object.AddressOf(raw6),
|
||||
)
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter("path", "test", objectSDK.MatchCommonPrefix)
|
||||
testSelect(t, db, cnr, fs,
|
||||
object.AddressOf(raw4),
|
||||
object.AddressOf(raw5),
|
||||
object.AddressOf(raw6),
|
||||
)
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter("path", "test/1", objectSDK.MatchCommonPrefix)
|
||||
testSelect(t, db, cnr, fs,
|
||||
object.AddressOf(raw4),
|
||||
object.AddressOf(raw5),
|
||||
)
|
||||
}
|
||||
|
||||
func TestDB_SelectRootPhyParent(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
Loading…
Reference in a new issue