[#1699] qos: Allow to prohibit operations for IO tag
All checks were successful
Vulncheck / Vulncheck (push) Successful in 1m18s
Pre-commit hooks / Pre-commit (push) Successful in 1m47s
Build / Build Components (push) Successful in 2m24s
Tests and linters / Run gofumpt (push) Successful in 2m29s
Tests and linters / Staticcheck (push) Successful in 3m42s
Tests and linters / Tests (push) Successful in 4m10s
Tests and linters / gopls check (push) Successful in 4m19s
Tests and linters / Lint (push) Successful in 4m56s
Tests and linters / Tests with -race (push) Successful in 5m5s
OCI image / Build container images (push) Successful in 3m57s

Change-Id: I2bee26885244e241d224860978b6de3526527e96
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2025-03-31 14:14:58 +03:00
parent 5a13830a94
commit a5bae6c5af
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0
7 changed files with 25 additions and 6 deletions

View file

@ -90,6 +90,7 @@ func converToSchedulingTags(limits []limits.IOTagConfig) map[string]scheduling.T
if l.ReservedOps != nil && *l.ReservedOps != 0 {
v.ReservedIOPS = l.ReservedOps
}
v.Prohibited = l.Prohibited
result[l.Tag] = v
}
return result
@ -164,8 +165,7 @@ func requestArrival(ctx context.Context, s scheduler, stats map[string]*stat) (R
rel, err := s.RequestArrival(ctx, tag)
stat.inProgress.Add(1)
if err != nil {
if errors.Is(err, scheduling.ErrMClockSchedulerRequestLimitExceeded) ||
errors.Is(err, errSemaphoreLimitExceeded) {
if isResourceExhaustedErr(err) {
stat.resourceExhausted.Add(1)
return nil, &apistatus.ResourceExhausted{}
}
@ -234,3 +234,9 @@ func exportMetrics(metrics Metrics, stats map[string]*stat, shardID, operation s
metrics.SetOperationTagCounters(shardID, operation, tag, pending, inProgress, completed, resExh)
}
}
func isResourceExhaustedErr(err error) bool {
return errors.Is(err, scheduling.ErrMClockSchedulerRequestLimitExceeded) ||
errors.Is(err, errSemaphoreLimitExceeded) ||
errors.Is(err, scheduling.ErrTagRequestsProhibited)
}