From 5f2417c1e05f56557ed244d681e32e5fe83d84b9 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 21 Mar 2025 11:20:53 +0300 Subject: [PATCH 1/3] [#1695] qos: Add treesync tag Tree sync is too much different from GC and rebuild to use the same tag for GC and tree sync. Change-Id: Ib44d5fa9a88daff507d759d0b0410cc9272e236f Signed-off-by: Dmitrii Stepanov --- internal/qos/grpc.go | 4 ++-- internal/qos/limiter.go | 2 +- internal/qos/stats.go | 1 + internal/qos/tags.go | 7 +++++++ internal/qos/validate.go | 1 + pkg/services/tree/service.go | 2 +- 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/internal/qos/grpc.go b/internal/qos/grpc.go index 534a1f74b..58cd9e52c 100644 --- a/internal/qos/grpc.go +++ b/internal/qos/grpc.go @@ -26,7 +26,7 @@ func NewAdjustOutgoingIOTagUnaryClientInterceptor() grpc.UnaryClientInterceptor if err != nil { tag = IOTagClient } - if tag == IOTagBackground || tag == IOTagPolicer || tag == IOTagWritecache { + if tag.IsLocal() { tag = IOTagInternal } ctx = tagging.ContextWithIOTag(ctx, tag.String()) @@ -44,7 +44,7 @@ func NewAdjustOutgoingIOTagStreamClientInterceptor() grpc.StreamClientIntercepto if err != nil { tag = IOTagClient } - if tag == IOTagBackground || tag == IOTagPolicer || tag == IOTagWritecache { + if tag.IsLocal() { tag = IOTagInternal } ctx = tagging.ContextWithIOTag(ctx, tag.String()) diff --git a/internal/qos/limiter.go b/internal/qos/limiter.go index e92cef652..82f9917a5 100644 --- a/internal/qos/limiter.go +++ b/internal/qos/limiter.go @@ -74,7 +74,7 @@ func createScheduler(config limits.OpConfig) (scheduler, error) { func converToSchedulingTags(limits []limits.IOTagConfig) map[string]scheduling.TagInfo { result := make(map[string]scheduling.TagInfo) - for _, tag := range []IOTag{IOTagClient, IOTagBackground, IOTagInternal, IOTagPolicer, IOTagWritecache} { + for _, tag := range []IOTag{IOTagClient, IOTagBackground, IOTagInternal, IOTagPolicer, IOTagWritecache, IOTagTreeSync} { result[tag.String()] = scheduling.TagInfo{ Share: defaultShare, } diff --git a/internal/qos/stats.go b/internal/qos/stats.go index f077f552b..aa4d4caf9 100644 --- a/internal/qos/stats.go +++ b/internal/qos/stats.go @@ -9,6 +9,7 @@ var statTags = map[string]struct{}{ IOTagPolicer.String(): {}, IOTagWritecache.String(): {}, IOTagCritical.String(): {}, + IOTagTreeSync.String(): {}, unknownStatsTag: {}, } diff --git a/internal/qos/tags.go b/internal/qos/tags.go index 9db45f190..2781dec76 100644 --- a/internal/qos/tags.go +++ b/internal/qos/tags.go @@ -13,6 +13,7 @@ const ( IOTagClient IOTag = "client" IOTagInternal IOTag = "internal" IOTagBackground IOTag = "background" + IOTagTreeSync IOTag = "treesync" IOTagWritecache IOTag = "writecache" IOTagPolicer IOTag = "policer" IOTagCritical IOTag = "critical" @@ -34,6 +35,8 @@ func FromRawString(s string) (IOTag, error) { return IOTagWritecache, nil case string(IOTagPolicer): return IOTagPolicer, nil + case string(IOTagTreeSync): + return IOTagTreeSync, nil default: return ioTagUnknown, fmt.Errorf("unknown tag %s", s) } @@ -50,3 +53,7 @@ func IOTagFromContext(ctx context.Context) string { } return tag } + +func (t IOTag) IsLocal() bool { + return t == IOTagBackground || t == IOTagPolicer || t == IOTagWritecache || t == IOTagTreeSync +} diff --git a/internal/qos/validate.go b/internal/qos/validate.go index 3fa4ebbd1..75bf4f4b9 100644 --- a/internal/qos/validate.go +++ b/internal/qos/validate.go @@ -47,6 +47,7 @@ func validateTags(configTags []limits.IOTagConfig) error { IOTagBackground: {}, IOTagWritecache: {}, IOTagPolicer: {}, + IOTagTreeSync: {}, } for _, t := range configTags { tag, err := FromRawString(t.Tag) diff --git a/pkg/services/tree/service.go b/pkg/services/tree/service.go index eeffec08b..b9bb96bab 100644 --- a/pkg/services/tree/service.go +++ b/pkg/services/tree/service.go @@ -85,7 +85,7 @@ func New(opts ...Option) *Service { // Start starts the service. func (s *Service) Start(ctx context.Context) { - ctx = tagging.ContextWithIOTag(ctx, qos.IOTagBackground.String()) + ctx = tagging.ContextWithIOTag(ctx, qos.IOTagTreeSync.String()) go s.replicateLoop(ctx) go s.syncLoop(ctx) -- 2.45.3 From a66df96cbb3654ac79ffe885e82c88fc1f52a5ad Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 21 Mar 2025 11:59:25 +0300 Subject: [PATCH 2/3] [#1695] mod: Bump frostfs-observability version Change-Id: Id362b71f743ff70c8cd374030c9fa67e2566022f Signed-off-by: Dmitrii Stepanov --- cmd/frostfs-cli/internal/client/sdk.go | 2 +- cmd/frostfs-cli/modules/tree/client.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- pkg/network/cache/multi.go | 2 +- pkg/services/tree/cache.go | 2 +- pkg/services/tree/sync.go | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/frostfs-cli/internal/client/sdk.go b/cmd/frostfs-cli/internal/client/sdk.go index 2d9c45cbd..1eadfa2e1 100644 --- a/cmd/frostfs-cli/internal/client/sdk.go +++ b/cmd/frostfs-cli/internal/client/sdk.go @@ -56,7 +56,7 @@ func GetSDKClient(ctx context.Context, cmd *cobra.Command, key *ecdsa.PrivateKey prmDial := client.PrmDial{ Endpoint: addr.URIAddr(), GRPCDialOptions: []grpc.DialOption{ - grpc.WithChainUnaryInterceptor(tracing.NewUnaryClientInteceptor()), + grpc.WithChainUnaryInterceptor(tracing.NewUnaryClientInterceptor()), grpc.WithChainStreamInterceptor(tracing.NewStreamClientInterceptor()), grpc.WithDefaultCallOptions(grpc.WaitForReady(true)), }, diff --git a/cmd/frostfs-cli/modules/tree/client.go b/cmd/frostfs-cli/modules/tree/client.go index 933378df6..421b96ccd 100644 --- a/cmd/frostfs-cli/modules/tree/client.go +++ b/cmd/frostfs-cli/modules/tree/client.go @@ -33,7 +33,7 @@ func _client() (tree.TreeServiceClient, error) { opts := []grpc.DialOption{ grpc.WithChainUnaryInterceptor( - tracing.NewUnaryClientInteceptor(), + tracing.NewUnaryClientInterceptor(), ), grpc.WithChainStreamInterceptor( tracing.NewStreamClientInterceptor(), diff --git a/go.mod b/go.mod index eeaca1645..fafb4f828 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( git.frostfs.info/TrueCloudLab/frostfs-contract v0.21.1 git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 git.frostfs.info/TrueCloudLab/frostfs-locode-db v0.4.1-0.20240710074952-65761deb5c0d - git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20250212111929-d34e1329c824 + git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20250321063246-93b681a20248 git.frostfs.info/TrueCloudLab/frostfs-qos v0.0.0-20250310135838-3e7ca9403529 git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20250306092416-69b0711d12d9 git.frostfs.info/TrueCloudLab/hrw v1.2.1 diff --git a/go.sum b/go.sum index a8f7216a5..7818583d4 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSV git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU= git.frostfs.info/TrueCloudLab/frostfs-locode-db v0.4.1-0.20240710074952-65761deb5c0d h1:uJ/wvuMdepbkaV8XMS5uN9B0FQWMep0CttSuDZiDhq0= git.frostfs.info/TrueCloudLab/frostfs-locode-db v0.4.1-0.20240710074952-65761deb5c0d/go.mod h1:7ZZq8iguY7qFsXajdHGmZd2AW4QbucyrJwhbsRfOfek= -git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20250212111929-d34e1329c824 h1:Mxw1c/8t96vFIUOffl28lFaHKi413oCBfLMGJmF9cFA= -git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20250212111929-d34e1329c824/go.mod h1:kbwB4v2o6RyOfCo9kEFeUDZIX3LKhmS0yXPrtvzkQ1g= +git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20250321063246-93b681a20248 h1:fluzML8BIIabd07LyPSjc0JAV2qymWkPiFaLrXdALLA= +git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20250321063246-93b681a20248/go.mod h1:kbwB4v2o6RyOfCo9kEFeUDZIX3LKhmS0yXPrtvzkQ1g= git.frostfs.info/TrueCloudLab/frostfs-qos v0.0.0-20250310135838-3e7ca9403529 h1:CBreXSxGoYJAdZ1QdJPsDs1UCXGF5psinII0lxtohsc= git.frostfs.info/TrueCloudLab/frostfs-qos v0.0.0-20250310135838-3e7ca9403529/go.mod h1:PCijYq4oa8vKtIEcUX6jRiszI6XAW+nBwU+T1kB4d1U= git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20250306092416-69b0711d12d9 h1:svCl6NDAPZ/KuQPjdVKo74RkCIANesxUPM45zQZDhSw= diff --git a/pkg/network/cache/multi.go b/pkg/network/cache/multi.go index e94fa580a..77420865a 100644 --- a/pkg/network/cache/multi.go +++ b/pkg/network/cache/multi.go @@ -66,7 +66,7 @@ func (x *multiClient) createForAddress(ctx context.Context, addr network.Address grpc.WithChainUnaryInterceptor( qos.NewAdjustOutgoingIOTagUnaryClientInterceptor(), metrics.NewUnaryClientInterceptor(), - tracing.NewUnaryClientInteceptor(), + tracing.NewUnaryClientInterceptor(), tagging.NewUnaryClientInteceptor(), ), grpc.WithChainStreamInterceptor( diff --git a/pkg/services/tree/cache.go b/pkg/services/tree/cache.go index 70f4a843b..3359af2c5 100644 --- a/pkg/services/tree/cache.go +++ b/pkg/services/tree/cache.go @@ -99,7 +99,7 @@ func (c *clientCache) dialTreeService(ctx context.Context, netmapAddr string) (* grpc.WithChainUnaryInterceptor( qos.NewAdjustOutgoingIOTagUnaryClientInterceptor(), metrics.NewUnaryClientInterceptor(), - tracing.NewUnaryClientInteceptor(), + tracing.NewUnaryClientInterceptor(), tagging.NewUnaryClientInteceptor(), ), grpc.WithChainStreamInterceptor( diff --git a/pkg/services/tree/sync.go b/pkg/services/tree/sync.go index 89450b739..103e2a613 100644 --- a/pkg/services/tree/sync.go +++ b/pkg/services/tree/sync.go @@ -344,7 +344,7 @@ func (*Service) createConnection(a network.Address) (*grpc.ClientConn, error) { grpc.WithChainUnaryInterceptor( qos.NewAdjustOutgoingIOTagUnaryClientInterceptor(), metrics.NewUnaryClientInterceptor(), - tracing_grpc.NewUnaryClientInteceptor(), + tracing_grpc.NewUnaryClientInterceptor(), tagging.NewUnaryClientInteceptor(), ), grpc.WithChainStreamInterceptor( -- 2.45.3 From d5758fc4c6125806482f3c1e44554df67e7fc860 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 21 Mar 2025 13:19:28 +0300 Subject: [PATCH 3/3] [#1695] qos: Sort tags by asc Change-Id: Ia23e392bb49d2536096de2ba07fc6f8fb7ac0489 Signed-off-by: Dmitrii Stepanov --- internal/qos/limiter.go | 2 +- internal/qos/stats.go | 6 +++--- internal/qos/tags.go | 24 ++++++++++++------------ internal/qos/validate.go | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/qos/limiter.go b/internal/qos/limiter.go index 82f9917a5..98d254fd0 100644 --- a/internal/qos/limiter.go +++ b/internal/qos/limiter.go @@ -74,7 +74,7 @@ func createScheduler(config limits.OpConfig) (scheduler, error) { func converToSchedulingTags(limits []limits.IOTagConfig) map[string]scheduling.TagInfo { result := make(map[string]scheduling.TagInfo) - for _, tag := range []IOTag{IOTagClient, IOTagBackground, IOTagInternal, IOTagPolicer, IOTagWritecache, IOTagTreeSync} { + for _, tag := range []IOTag{IOTagBackground, IOTagClient, IOTagInternal, IOTagPolicer, IOTagTreeSync, IOTagWritecache} { result[tag.String()] = scheduling.TagInfo{ Share: defaultShare, } diff --git a/internal/qos/stats.go b/internal/qos/stats.go index aa4d4caf9..3ecfad9f9 100644 --- a/internal/qos/stats.go +++ b/internal/qos/stats.go @@ -3,13 +3,13 @@ package qos const unknownStatsTag = "unknown" var statTags = map[string]struct{}{ - IOTagClient.String(): {}, IOTagBackground.String(): {}, + IOTagClient.String(): {}, + IOTagCritical.String(): {}, IOTagInternal.String(): {}, IOTagPolicer.String(): {}, - IOTagWritecache.String(): {}, - IOTagCritical.String(): {}, IOTagTreeSync.String(): {}, + IOTagWritecache.String(): {}, unknownStatsTag: {}, } diff --git a/internal/qos/tags.go b/internal/qos/tags.go index 2781dec76..e3f7cafd6 100644 --- a/internal/qos/tags.go +++ b/internal/qos/tags.go @@ -10,33 +10,33 @@ import ( type IOTag string const ( - IOTagClient IOTag = "client" - IOTagInternal IOTag = "internal" IOTagBackground IOTag = "background" + IOTagClient IOTag = "client" + IOTagCritical IOTag = "critical" + IOTagInternal IOTag = "internal" + IOTagPolicer IOTag = "policer" IOTagTreeSync IOTag = "treesync" IOTagWritecache IOTag = "writecache" - IOTagPolicer IOTag = "policer" - IOTagCritical IOTag = "critical" ioTagUnknown IOTag = "" ) func FromRawString(s string) (IOTag, error) { switch s { - case string(IOTagCritical): - return IOTagCritical, nil - case string(IOTagClient): - return IOTagClient, nil - case string(IOTagInternal): - return IOTagInternal, nil case string(IOTagBackground): return IOTagBackground, nil - case string(IOTagWritecache): - return IOTagWritecache, nil + case string(IOTagClient): + return IOTagClient, nil + case string(IOTagCritical): + return IOTagCritical, nil + case string(IOTagInternal): + return IOTagInternal, nil case string(IOTagPolicer): return IOTagPolicer, nil case string(IOTagTreeSync): return IOTagTreeSync, nil + case string(IOTagWritecache): + return IOTagWritecache, nil default: return ioTagUnknown, fmt.Errorf("unknown tag %s", s) } diff --git a/internal/qos/validate.go b/internal/qos/validate.go index 75bf4f4b9..d4475e38b 100644 --- a/internal/qos/validate.go +++ b/internal/qos/validate.go @@ -42,12 +42,12 @@ func validateOpConfig(c limits.OpConfig) error { func validateTags(configTags []limits.IOTagConfig) error { tags := map[IOTag]tagConfig{ + IOTagBackground: {}, IOTagClient: {}, IOTagInternal: {}, - IOTagBackground: {}, - IOTagWritecache: {}, IOTagPolicer: {}, IOTagTreeSync: {}, + IOTagWritecache: {}, } for _, t := range configTags { tag, err := FromRawString(t.Tag) -- 2.45.3