Skip to content

Commit

Permalink
internal pool implementation from table pool
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Sep 6, 2024
1 parent cd58c33 commit e6d948b
Show file tree
Hide file tree
Showing 40 changed files with 2,474 additions and 1,772 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/slo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ jobs:
workload_build_context4: ../..
workload_build_options4: -f Dockerfile --build-arg SRC_PATH=native/query --build-arg JOB_NAME=workload-native-query

language_id5: 'native-query-with-pool'
workload_path5: 'tests/slo'
language5: 'Native ydb-go-sdk/v3 over query-service with session pool'
workload_build_context5: ../..
workload_build_options5: -f Dockerfile --build-arg SRC_PATH=native/query/with/pool --build-arg JOB_NAME=workload-native-query-with-pool

- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
YDB_LOCAL_SURVIVE_RESTART: true
YDB_USE_IN_MEMORY_PDISKS: true
YDB_TABLE_ENABLE_PREPARED_DDL: true
YDB_ENABLE_COLUMN_TABLES: true
options: '-h localhost'
env:
OS: ubuntu-latest
Expand Down Expand Up @@ -119,6 +120,7 @@ jobs:
YDB_USE_IN_MEMORY_PDISKS: true
YDB_TABLE_ENABLE_PREPARED_DDL: true
YDB_FEATURE_FLAGS: enable_topic_service_tx
YDB_ENABLE_COLUMN_TABLES: true
options: '-h localhost'
env:
OS: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Extracted session pool implementation from table client to `internal/pool`

## v3.79.0
* Added commit messages for topic listener
* EOF error in RecvMsg is no longer logged
Expand Down
36 changes: 8 additions & 28 deletions internal/pool/defaults.go
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
package pool

const DefaultLimit = 50
import (
"time"
)

var defaultTrace = &Trace{
OnNew: func(info *NewStartInfo) func(info *NewDoneInfo) {
return func(info *NewDoneInfo) {
}
},
OnClose: func(info *CloseStartInfo) func(info *CloseDoneInfo) {
return func(info *CloseDoneInfo) {
}
},
OnTry: func(info *TryStartInfo) func(info *TryDoneInfo) {
return func(info *TryDoneInfo) {
}
},
OnWith: func(info *WithStartInfo) func(info *WithDoneInfo) {
return func(info *WithDoneInfo) {
}
},
OnPut: func(info *PutStartInfo) func(info *PutDoneInfo) {
return func(info *PutDoneInfo) {
}
},
OnGet: func(info *GetStartInfo) func(info *GetDoneInfo) {
return func(info *GetDoneInfo) {
}
},
OnChange: func(info ChangeInfo) {},
}
const (
DefaultLimit = 50
defaultCreateTimeout = 5 * time.Second
defaultCloseTimeout = time.Second
)
27 changes: 27 additions & 0 deletions internal/pool/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ package pool

import (
"errors"

"github.com/ydb-platform/ydb-go-genproto/protos/Ydb"
grpcCodes "google.golang.org/grpc/codes"

"github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
)

var (
Expand All @@ -10,3 +15,25 @@ var (
errPoolIsOverflow = errors.New("pool is overflow")
errNoProgress = errors.New("no progress")
)

func isRetriable(err error) bool {
if err == nil {
panic(err)
}

switch {
case
xerrors.Is(err, errPoolIsOverflow),
xerrors.IsRetryableError(err),
xerrors.IsOperationError(err, Ydb.StatusIds_OVERLOADED),
xerrors.IsTransportError(
err,
grpcCodes.ResourceExhausted,
grpcCodes.DeadlineExceeded,
grpcCodes.Unavailable,
):
return true
default:
return false
}
}
Loading

0 comments on commit e6d948b

Please sign in to comment.