[#1695] qos: Add treesync tag
Some checks failed
DCO action / DCO (pull_request) Successful in 38s
Tests and linters / Run gofumpt (pull_request) Successful in 32s
Build / Build Components (pull_request) Failing after 42s
Vulncheck / Vulncheck (pull_request) Failing after 57s
Tests and linters / Tests (pull_request) Failing after 1m3s
Tests and linters / Staticcheck (pull_request) Failing after 1m8s
Tests and linters / Tests with -race (pull_request) Failing after 1m38s
Pre-commit hooks / Pre-commit (pull_request) Failing after 1m53s
Tests and linters / Lint (pull_request) Failing after 1m58s
Tests and linters / gopls check (pull_request) Failing after 3m9s

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2025-03-21 11:20:53 +03:00
parent f715c6bf86
commit 37263fb0e6
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0
6 changed files with 13 additions and 4 deletions

View file

@ -26,7 +26,7 @@ func NewAdjustOutgoingIOTagUnaryClientInterceptor() grpc.UnaryClientInterceptor
if err != nil { if err != nil {
tag = IOTagClient tag = IOTagClient
} }
if tag == IOTagBackground || tag == IOTagPolicer || tag == IOTagWritecache { if tag.IsLocal() {
tag = IOTagInternal tag = IOTagInternal
} }
ctx = tagging.ContextWithIOTag(ctx, tag.String()) ctx = tagging.ContextWithIOTag(ctx, tag.String())
@ -44,7 +44,7 @@ func NewAdjustOutgoingIOTagStreamClientInterceptor() grpc.StreamClientIntercepto
if err != nil { if err != nil {
tag = IOTagClient tag = IOTagClient
} }
if tag == IOTagBackground || tag == IOTagPolicer || tag == IOTagWritecache { if tag.IsLocal() {
tag = IOTagInternal tag = IOTagInternal
} }
ctx = tagging.ContextWithIOTag(ctx, tag.String()) ctx = tagging.ContextWithIOTag(ctx, tag.String())

View file

@ -74,7 +74,7 @@ func createScheduler(config limits.OpConfig) (scheduler, error) {
func converToSchedulingTags(limits []limits.IOTagConfig) map[string]scheduling.TagInfo { func converToSchedulingTags(limits []limits.IOTagConfig) map[string]scheduling.TagInfo {
result := make(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{ result[tag.String()] = scheduling.TagInfo{
Share: defaultShare, Share: defaultShare,
} }

View file

@ -5,6 +5,7 @@ const unknownStatsTag = "unknown"
var statTags = map[string]struct{}{ var statTags = map[string]struct{}{
IOTagClient.String(): {}, IOTagClient.String(): {},
IOTagBackground.String(): {}, IOTagBackground.String(): {},
IOTagTreeSync.String(): {},
IOTagInternal.String(): {}, IOTagInternal.String(): {},
IOTagPolicer.String(): {}, IOTagPolicer.String(): {},
IOTagWritecache.String(): {}, IOTagWritecache.String(): {},

View file

@ -16,6 +16,7 @@ const (
IOTagWritecache IOTag = "writecache" IOTagWritecache IOTag = "writecache"
IOTagPolicer IOTag = "policer" IOTagPolicer IOTag = "policer"
IOTagCritical IOTag = "critical" IOTagCritical IOTag = "critical"
IOTagTreeSync IOTag = "treesync"
ioTagUnknown IOTag = "" ioTagUnknown IOTag = ""
) )
@ -30,6 +31,8 @@ func FromRawString(s string) (IOTag, error) {
return IOTagInternal, nil return IOTagInternal, nil
case string(IOTagBackground): case string(IOTagBackground):
return IOTagBackground, nil return IOTagBackground, nil
case string(IOTagTreeSync):
return IOTagTreeSync, nil
case string(IOTagWritecache): case string(IOTagWritecache):
return IOTagWritecache, nil return IOTagWritecache, nil
case string(IOTagPolicer): case string(IOTagPolicer):
@ -50,3 +53,7 @@ func IOTagFromContext(ctx context.Context) string {
} }
return tag return tag
} }
func (t IOTag) IsLocal() bool {
return t == IOTagBackground || t == IOTagPolicer || t == IOTagWritecache || t == IOTagTreeSync
}

View file

@ -45,6 +45,7 @@ func validateTags(configTags []limits.IOTagConfig) error {
IOTagClient: {}, IOTagClient: {},
IOTagInternal: {}, IOTagInternal: {},
IOTagBackground: {}, IOTagBackground: {},
IOTagTreeSync: {},
IOTagWritecache: {}, IOTagWritecache: {},
IOTagPolicer: {}, IOTagPolicer: {},
} }

View file

@ -85,7 +85,7 @@ func New(opts ...Option) *Service {
// Start starts the service. // Start starts the service.
func (s *Service) Start(ctx context.Context) { 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.replicateLoop(ctx)
go s.syncLoop(ctx) go s.syncLoop(ctx)