From 0f9625309188a13e7535a390036968554d722354 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Mon, 20 Feb 2023 16:00:09 +0300 Subject: [PATCH 1/2] [TrueCloudLab#16] pool: Don't count grpc canceled error Signed-off-by: Denis Kirillov --- pool/pool.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index 012b0950..e47d6d66 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -32,6 +32,8 @@ import ( "go.uber.org/atomic" "go.uber.org/zap" "go.uber.org/zap/zapcore" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) // client represents virtual connection to the single FrostFS network endpoint from which Pool is formed. @@ -995,11 +997,7 @@ func (c *clientWrapper) incRequests(elapsed time.Duration, method MethodIndex) { func (c *clientStatusMonitor) handleError(st apistatus.Status, err error) error { if err != nil { - // non-status logic error that could be returned - // from the SDK client; should not be considered - // as a connection error - var siErr *object.SplitInfoError - if !errors.As(err, &siErr) { + if needCountError(err) { c.incErrorRate() } @@ -1018,6 +1016,20 @@ func (c *clientStatusMonitor) handleError(st apistatus.Status, err error) error return err } +func needCountError(err error) bool { + // non-status logic error that could be returned + // from the SDK client; should not be considered + // as a connection error + var siErr *object.SplitInfoError + if errors.As(err, &siErr) { + return false + } + + // we can't use errors.Is(err, context.Canceled) + // https://github.com/grpc/grpc-go/issues/4375 + return status.Code(err) != codes.Canceled +} + // clientBuilder is a type alias of client constructors which open connection // to the given endpoint. type clientBuilder = func(endpoint string) client From 6da5d7dade6057b7a8ef5e12ceee74851df2dcdb Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Mon, 20 Feb 2023 16:19:44 +0300 Subject: [PATCH 2/2] [TrueCloudLab#16] Update go version in CI tests Signed-off-by: Denis Kirillov --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 28d42bdb..0b7de71c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - go_versions: [ '1.17.x', '1.18.x', '1.19.x' ] + go_versions: [ '1.18.x', '1.19.x', '1.20.x' ] fail-fast: false steps: - uses: actions/checkout@v3