From da38df6cf42f178442393949088d9f74e0909a91 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 10 Dec 2024 03:52:41 +0300 Subject: [PATCH] node/object/put: push meta only if the consistency policy asks for it Signed-off-by: Pavel Karpy --- pkg/services/object/put/distributed.go | 5 +++-- pkg/services/object/put/streamer.go | 16 +++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/pkg/services/object/put/distributed.go b/pkg/services/object/put/distributed.go index 34c819c2b0..d2052b01c0 100644 --- a/pkg/services/object/put/distributed.go +++ b/pkg/services/object/put/distributed.go @@ -33,7 +33,8 @@ type distributedTarget struct { objMeta object.ContentMeta networkMagicNumber uint32 - cnrClient *chaintcontainer.Client + cnrClient *chaintcontainer.Client + metainfoConsistencyAttr string metaMtx sync.RWMutex objSharedMeta []byte @@ -154,7 +155,7 @@ func (t *distributedTarget) Close() (oid.ID, error) { return oid.ID{}, err } - if t.localNodeInContainer { + if t.localNodeInContainer && t.metainfoConsistencyAttr != "" { t.metaMtx.RLock() defer t.metaMtx.RUnlock() diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index 3ba16cb3a3..fbaa631eaa 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -8,6 +8,7 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/services/object/internal" "github.com/nspcc-dev/neofs-node/pkg/services/object/util" + "github.com/nspcc-dev/neofs-sdk-go/container" neofsecdsa "github.com/nspcc-dev/neofs-sdk-go/crypto/ecdsa" "github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/user" @@ -237,11 +238,12 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) internal.Target { return rt }, - relay: relay, - fmt: p.fmtValidator, - localNodeInContainer: prm.localNodeInContainer, - localNodeSigner: prm.localNodeSigner, - cnrClient: p.cfg.cnrClient, + relay: relay, + fmt: p.fmtValidator, + localNodeInContainer: prm.localNodeInContainer, + localNodeSigner: prm.localNodeSigner, + cnrClient: p.cfg.cnrClient, + metainfoConsistencyAttr: metaAttribute(prm.cnr), } } @@ -271,3 +273,7 @@ func (p *Streamer) Close() (*PutResponse, error) { id: id, }, nil } + +func metaAttribute(cnr container.Container) string { + return cnr.Attribute("__NEOFS__METAINFO_CONSISTENCY") +}