From 5aacb8fc86210ee6a7da02ba15a9edc4a250f269 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 27 May 2024 15:52:08 +0300 Subject: [PATCH] [#1144] metabase: Save parent attributes for ec-chunks Signed-off-by: Airat Arifullin --- go.mod | 2 +- go.sum | Bin 43159 -> 43159 bytes pkg/local_object_storage/metabase/put.go | 10 ++++++++-- pkg/services/policer/ec_test.go | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 6edd305bb..093560953 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240530152826-2f6d3209e1d3 git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240409111539-e7a05a49ff45 git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20231101111734-b3ad3335ff65 - git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240531121442-717a7d00ef21 + git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240531132048-ebd8fcd1685f git.frostfs.info/TrueCloudLab/hrw v1.2.1 git.frostfs.info/TrueCloudLab/policy-engine v0.0.0-20240513163744-1f6f4163d40d git.frostfs.info/TrueCloudLab/tzhash v1.8.0 diff --git a/go.sum b/go.sum index dcae21bc3042e55b20288f76a064512c541bdba8..6f5034f007666fef08b5e9135774fc80a8a6222c 100644 GIT binary patch delta 169 zcmbP!k!kuxrVVdc9F2_(Oe}O$lTs|wl2Z)LEKJiBG7PQCoP3-O{e#_ogY(RDg1pM~ z3k>tq49Ze7(@LFEqEf0#!iwB1!}7F4-LfakvuI4d$|CN8X_9_=zFuyA3dlecNB<;W zGxM;}!t97ZuN;4u5Vw#Fx4cqcch^#HiwsMbBF6|1m#D%r=TM-53X^r&xHjKo-MI(= DPNO#C delta 171 zcmbP!k!kuxrVVdc9E=Q2OpJ8R4b2nHQw$7J(~JxiG7POs)AKE}EsG7bO%0u#eKTB4 zatl3Nv&{D^9j&;h21tMcf_JF#Ys=z1;j1keMmv zP9B9$`NgUJ1)(OcnVtc`?iCq+seu(nf&Q+E`TB-M78yon#g)b7ljT?xC+o6tZNA64 Ga}fZml{Jt6 diff --git a/pkg/local_object_storage/metabase/put.go b/pkg/local_object_storage/metabase/put.go index 8a08adc36..966db9401 100644 --- a/pkg/local_object_storage/metabase/put.go +++ b/pkg/local_object_storage/metabase/put.go @@ -361,8 +361,6 @@ func updateFKBTIndexes(tx *bbolt.Tx, obj *objectSDK.Object, f updateIndexItemFun cnr, _ := obj.ContainerID() objKey := objectKey(id, make([]byte, objectKeySize)) - attrs := obj.Attributes() - key := make([]byte, bucketKeySize) err := f(tx, namedBucketItem{ name: ownerBucketName(cnr, key), @@ -373,6 +371,14 @@ func updateFKBTIndexes(tx *bbolt.Tx, obj *objectSDK.Object, f updateIndexItemFun return err } + var attrs []objectSDK.Attribute + if obj.ECHeader() != nil { + attrs = obj.ECHeader().ParentAttributes() + objKey = objectKey(obj.ECHeader().Parent(), make([]byte, objectKeySize)) + } else { + attrs = obj.Attributes() + } + // user specified attributes for i := range attrs { key = attributeBucketName(cnr, attrs[i].Key(), key) diff --git a/pkg/services/policer/ec_test.go b/pkg/services/policer/ec_test.go index 11e7a8cdf..9492787dc 100644 --- a/pkg/services/policer/ec_test.go +++ b/pkg/services/policer/ec_test.go @@ -114,7 +114,7 @@ func TestECChunkHasInvalidPlacement(t *testing.T) { chunkObject.SetID(chunkAddress.Object()) chunkObject.SetPayload([]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}) chunkObject.SetPayloadSize(uint64(10)) - chunkObject.SetECHeader(objectSDK.NewECHeader(parentID, nil, nil, 1, 3, []byte{}, 0)) + chunkObject.SetECHeader(objectSDK.NewECHeader(objectSDK.ECParentInfo{ID: parentID}, 0, 3, []byte{}, 0)) var policy netmapSDK.PlacementPolicy require.NoError(t, policy.DecodeString("EC 2.1"))