Skip to content

Commit

Permalink
Merge branch 'master' into lazy-conn
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Apr 10, 2024
2 parents 902c990 + d38f4ec commit 11528c3
Show file tree
Hide file tree
Showing 130 changed files with 1,566 additions and 828 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/breaking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
contents: read
steps:
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install gorelease
run: test -e ~/go/bin/gorelease || go install golang.org/x/exp/cmd/gorelease@latest
- name: Check broken API changes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Changelog updated
uses: Zomzog/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -63,7 +63,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -76,4 +76,4 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
12 changes: 6 additions & 6 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ jobs:
YDB_VERSION: ${{ matrix.ydb-version }}
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
cache: true
- name: Run basic example ${{ matrix.application }}
Expand Down Expand Up @@ -74,9 +74,9 @@ jobs:
POSTGRES_CONNECTION_STRING: postgres://postgres:postgres@localhost:5432/basic?sslmode=disable
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
cache: true
- name: Run basic example ${{ matrix.application }} with postgres
Expand All @@ -97,9 +97,9 @@ jobs:
SQLITE_CONNECTION_STRING: ${{ matrix.application }}.db
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
cache: true
- name: Run basic example ${{ matrix.application }} with sqlite
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --timeout=5m
Expand All @@ -29,11 +29,11 @@ jobs:
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: generate examples golangci-lint config
run: sed 's/github.com\/ydb-platform\/ydb-go-sdk\/v3/examples/g' .golangci.yml > examples/.golangci.yml
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --timeout=5m
Expand All @@ -45,11 +45,11 @@ jobs:
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: generate slo golangci-lint config
run: sed 's/github.com\/ydb-platform\/ydb-go-sdk\/v3/slo/g' .golangci.yml > tests/slo/.golangci.yml
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --timeout=5m
Expand All @@ -61,9 +61,9 @@ jobs:
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Install utilities
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
CHANGELOG_FILE: CHANGELOG.md
GITHUB_TOKEN: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
token: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
fetch-depth: 0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/slo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run SLO
uses: ydb-platform/slo-tests@js-version
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
workload_build_context4: ../..
workload_build_options4: -f Dockerfile --build-arg SRC_PATH=xorm --build-arg JOB_NAME=workload-xorm

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: slo-logs
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ jobs:
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Test
run: go test -race -coverprofile unit.txt -covermode atomic ./...
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./unit.txt
flags: unit,${{ matrix.os }},go-${{ matrix.go-version }}
Expand Down Expand Up @@ -71,16 +71,16 @@ jobs:
HIDE_APPLICATION_OUTPUT: 1
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Integration test
run: go test -race -tags integration -coverpkg=./... -coverprofile integration-secure.txt -covermode atomic ./tests/integration
- name: Upload Test secure connection coverage report to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./integration-secure.txt
flags: integration,${{ matrix.os }},go-${{ matrix.go-version }},ydb-${{ matrix.ydb-version }}
Expand Down
6 changes: 4 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,12 @@ linters:
- godot
- goerr113
- golint
- gomnd
- ifshort
- interfacebloat
- ireturn
- maintidx
- nonamedreturns
- paralleltest
- scopelint
- structcheck
- testableexamples
- testpackage
Expand Down Expand Up @@ -295,6 +293,7 @@ issues:
- predeclared
- path: _test\.go
linters:
- scopelint
- funlen
- unused
- unparam
Expand All @@ -304,6 +303,9 @@ issues:
- staticcheck
- path: _test\.go
text: "ydb.Connection is deprecated"
- path: examples
linters:
- gomnd

# Allow underscore and capital camel case for readability
# Examples: Type_PRIMITIVE_TYPE_ID_UNSPECIFIED, Ydb_Discovery_V1, _voidValue
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v3.64.0
* Supported `table.Session.RenameTables` method
* Fixed out of range panic if next query result set part is empty
* Updated the indirect dependencies `golang.org/x/net` to `v0.17.0` and `golang.org/x/sys` to `v0.13.0` due to vulnerability issue

## v3.63.0
* Added versioning policy

## v3.62.0
* Restored `WithSessionPoolKeepAliveMinSize` and `WithSessionPoolKeepAliveTimeout` for backward compatibility.
* Fixed leak timers
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Supports `table`, `query`, `discovery`, `coordination`, `ratelimiter`, `scheme`,
`ydb-go-sdk` supports all Go versions supported by the official [Go Release Policy](https://go.dev/doc/devel/release#policy).
That is, the two most recent releases of Go.

## Versioning Policy

`ydb-go-sdk` comply to guidelines from [SemVer2.0.0](https://semver.org/) with an several [exceptions](VERSIONING.md).

## Installation

```sh
Expand Down
24 changes: 24 additions & 0 deletions VERSIONING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# YDB-Go-SDK Versioning Policy

By adhering to these guidelines and exceptions, we aim to provide a stable and reliable development experience for our users (aka [LTS](https://en.wikipedia.org/wiki/Long-term_support)) while still allowing for innovation and improvement.

We endeavor to adhere to versioning guidelines as defined by [SemVer2.0.0](https://semver.org/).

We making the following exceptions to those guidelines:
## Experimental
- We use the `// Experimental` comment for new features in the `ydb-go-sdk`.
- Early adopters of newest feature can report bugs and imperfections in functionality.
- For fix this issues we can make broken changes in experimental API.
- We reserve the right to remove or modify these experimental features at any time without increase of major part of version.
- We want to make experimental API as stable in the future
## Deprecated
- We use the `// Deprecated` comment for deprecated features in the `ydb-go-sdk`.
- Usage of some entity marked with `// Deprecated` can be detected with linters such as [check-deprecated](https://github.com/black-06/check-deprecated), [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) or [go-critic](https://github.com/go-critic/go-critic).
- This helps to our users to soft decline to use the deprecated feature without any impact on their code.
- Deprecated features will not be removed or changed for a minimum period of **six months** since the mark added.
- We reserve the right to remove or modify these deprecated features without increase of major part of version.
## Internals
- Some public API of `ydb-go-sdk` relate to the internals.
- We use the `// Internals` comment for public internals in the `ydb-go-sdk`.
- `ydb-go-sdk` internals can be changed at any time without increase of major part of version.
- Internals will never marked as stable
10 changes: 6 additions & 4 deletions balancers/balancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"github.com/ydb-platform/ydb-go-sdk/v3/internal/conn"
)

// Deprecated: RoundRobin is RandomChoice now
// Deprecated: RoundRobin is an alias to RandomChoice now
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func RoundRobin() *balancerConfig.Config {
return balancerConfig.New()
}
Expand Down Expand Up @@ -62,18 +64,18 @@ type Endpoint interface {
func Prefer(balancer *balancerConfig.Config, filter func(endpoint Endpoint) bool) *balancerConfig.Config {
return balancer.With(
balancerConfig.FilterFunc(func(_ balancerConfig.Info, c conn.Info) bool {
return filter(c.Endpoint())
return filter(c)
}),
)
}

// PreferWithFallback creates balancer which use endpoints by filter
// Balancer "balancer" defines balancing algorithm between endpoints selected with filter
// If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead
func PreferWithFallback(balancer *balancerConfig.Config, filter func(endpoint Endpoint) bool) *balancerConfig.Config {
func PreferWithFallback(balancer *balancerConfig.Config, filter func(endpoint conn.Info) bool) *balancerConfig.Config {
return balancer.With(
balancerConfig.FilterFunc(func(_ balancerConfig.Info, c conn.Info) bool {
return filter(c.Endpoint())
return filter(c)
}),
balancerConfig.AllowFallback(),
)
Expand Down
2 changes: 1 addition & 1 deletion balancers/balancers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestPreferLocationsWithFallback(t *testing.T) {
func applyPreferFilter(info balancerConfig.Info, b *balancerConfig.Config, conns []conn.Info) []conn.Info {
res := make([]conn.Info, 0, len(conns))
for _, c := range conns {
if b.Filter().Allow(info, c) {
if b.Filter(info, c) {
res = append(res, c)
}
}
Expand Down
7 changes: 2 additions & 5 deletions balancers/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,8 @@ func TestFromConfig(t *testing.T) {
}

// function pointers can check equal to nil only
if tt.res.Filter() != nil {
require.NotNil(t, b.Filter())
b = b.With(balancerConfig.FilterFunc(nil))
tt.res = tt.res.With(balancerConfig.FilterFunc(nil))
}
b = b.With(balancerConfig.FilterFunc(nil))
tt.res = tt.res.With(balancerConfig.FilterFunc(nil))

require.Equal(t, tt.res, b)
})
Expand Down
8 changes: 6 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ type Option func(c *Config)

// WithInternalDNSResolver
//
// Deprecated: always used internal dns-resolver
// Deprecated: always used internal dns-resolver.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithInternalDNSResolver() Option {
return func(c *Config) {}
}
Expand Down Expand Up @@ -173,7 +175,9 @@ func WithApplicationName(applicationName string) Option {

// WithUserAgent add provided user agent to all api requests
//
// Deprecated: use WithApplicationName instead
// Deprecated: use WithApplicationName instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithUserAgent(userAgent string) Option {
return func(c *Config) {
c.metaOptions = append(c.metaOptions, meta.WithApplicationNameOption(userAgent))
Expand Down
Loading

0 comments on commit 11528c3

Please sign in to comment.