Skip to content

Commit 969c0a2

Browse files
authored
Merge branch 'master' into sql_null_params
2 parents bae606f + fedcf14 commit 969c0a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1393
-85
lines changed

.github/workflows/breaking.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
concurrency:
1111
group: broken-changes-${{ github.ref }}
1212
cancel-in-progress: true
13+
if: (!contains(github.event.pull_request.labels.*.name, 'broken changes'))
1314
runs-on: ubuntu-latest
1415
permissions:
1516
pull-requests: write
@@ -24,11 +25,10 @@ jobs:
2425
- name: Install gorelease
2526
run: test -e ~/go/bin/gorelease || go install golang.org/x/exp/cmd/gorelease@latest
2627
- name: Check broken API changes
27-
run: gorelease -base=$GITHUB_BASE_REF 2>&1 > changes.txt | true
28-
- name: Print API changes
29-
run: cat changes.txt
28+
run: set -o pipefail && gorelease | tee changes.txt
29+
# Skip comment for forks - GITHUB_TOKEN doesn't have write permissions for external PRs
3030
- name: Comment Report
31-
if: always()
31+
if: always() && github.event.pull_request.head.repo.full_name == github.repository
3232
uses: marocchino/sticky-pull-request-comment@v2
3333
with:
3434
path: changes.txt

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
pull_request:
88
workflow_dispatch:
99
env:
10-
GOLANGCI_LINT_VERSION: v2.1.6
10+
GOLANGCI_LINT_VERSION: v2.4.0
1111
GO_VERSION: '1.25'
1212
jobs:
1313
golangci:

.golangci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ linters:
4545
- iface
4646
- gosmopolitan
4747
- funcorder
48+
49+
# introduced v2.4.0
50+
- noinlineerr
51+
- wsl_v5
4852
settings:
4953
errcheck:
5054
check-type-assertions: false
@@ -117,6 +121,10 @@ linters:
117121
- name: if-return
118122
- name: increment-decrement
119123
- name: var-naming
124+
arguments:
125+
- [] # AllowList
126+
- [] # DenyList
127+
- - skip-package-name-checks: true
120128
- name: var-declaration
121129
- name: package-comments
122130
- name: range

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
* Supported `sql.Null*` from `database/sql` as query params in `toValue` func
22

3+
## v3.117.3
4+
* Added support for nullable `Date32`, `Datetime64`, `Timestamp64`, and `Interval64` types in the `optional` parameter builder
5+
* Added method `query.WithIssuesHandler` to get query issues
6+
7+
## v3.117.2
8+
* Added support for `Result.RowsAffected()` for YDB `database/sql` driver
9+
* Upgraded minimal version of Go to 1.23.9
10+
* Fixed race in `readerReconnector`
11+
312
## v3.117.1
413
* Fixed scan a column of type `Decimal(precision,scale)` into a struct field of type `types.Decimal{}` using `ScanStruct()`
514
* Fixed race in integration test `TestTopicWriterLogMessagesWithoutData`

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ydb-platform/ydb/blob/main/LICENSE)
44
[![Release](https://img.shields.io/github/v/release/ydb-platform/ydb-go-sdk.svg?style=flat-square)](https://github.com/ydb-platform/ydb-go-sdk/releases)
55
[![PkgGoDev](https://pkg.go.dev/badge/github.com/ydb-platform/ydb-go-sdk/v3)](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3)
6-
![tests](https://github.com/ydb-platform/ydb-go-sdk/workflows/tests/badge.svg)
7-
![lint](https://github.com/ydb-platform/ydb-go-sdk/workflows/lint/badge.svg)
6+
[![tests](https://github.com/ydb-platform/ydb-go-sdk/workflows/tests/badge.svg)](https://github.com/ydb-platform/ydb-go-sdk/actions/workflows/tests.yml)
7+
[![lint](https://github.com/ydb-platform/ydb-go-sdk/workflows/lint/badge.svg)](https://github.com/ydb-platform/ydb-go-sdk/actions/workflows/lint.yml)
88
[![Go Report Card](https://goreportcard.com/badge/github.com/ydb-platform/ydb-go-sdk/v3)](https://goreportcard.com/report/github.com/ydb-platform/ydb-go-sdk/v3)
99
[![codecov](https://codecov.io/gh/ydb-platform/ydb-go-sdk/badge.svg?precision=2)](https://app.codecov.io/gh/ydb-platform/ydb-go-sdk)
1010
![Code lines](https://sloc.xyz/github/ydb-platform/ydb-go-sdk/?category=code)
@@ -25,7 +25,7 @@ That is, the latest two versions of Go (or more, but with no guarantees for extr
2525

2626
## Versioning Policy
2727

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

3030
## Installation
3131

examples/go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module examples
22

3-
go 1.23.0
4-
5-
toolchain go1.23.6
3+
go 1.23.9
64

75
require (
86
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40

examples/topic/topicreader/topicreader_handler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func StartReader(ctx context.Context, db *ydb.Driver) (*topiclistener.TopicListe
2828

2929
type TopicEventsHandler struct {
3030
topiclistener.BaseHandler
31+
3132
listener *topiclistener.TopicListener
3233

3334
m sync.Mutex

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ydb-platform/ydb-go-sdk/v3
22

3-
go 1.22.5
3+
go 1.23.9
44

55
require (
66
github.com/golang-jwt/jwt/v4 v4.5.2

internal/balancer/balancer.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func (b *Balancer) applyDiscoveredEndpoints(ctx context.Context, newest []endpoi
207207
)
208208
}()
209209

210-
connections := endpointsToConnections(b.pool, newest)
210+
connections := conn.EndpointsToConnections(b.pool, newest)
211211
for _, c := range connections {
212212
b.pool.Allow(ctx, c)
213213
c.Endpoint().Touch()
@@ -453,12 +453,3 @@ func (b *Balancer) nextConn(ctx context.Context) (c conn.Conn, err error) {
453453

454454
return c, nil
455455
}
456-
457-
func endpointsToConnections(p *conn.Pool, endpoints []endpoint.Endpoint) []conn.Conn {
458-
conns := make([]conn.Conn, 0, len(endpoints))
459-
for _, e := range endpoints {
460-
conns = append(conns, p.Get(e))
461-
}
462-
463-
return conns
464-
}

internal/balancer/balancer_test.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import (
1414
"google.golang.org/grpc/test/bufconn"
1515

1616
"github.com/ydb-platform/ydb-go-sdk/v3/config"
17+
balancerConfig "github.com/ydb-platform/ydb-go-sdk/v3/internal/balancer/config"
18+
"github.com/ydb-platform/ydb-go-sdk/v3/internal/conn"
19+
"github.com/ydb-platform/ydb-go-sdk/v3/internal/endpoint"
1720
)
1821

1922
func TestBalancer_discoveryConn(t *testing.T) {
@@ -71,6 +74,52 @@ func TestBalancer_discoveryConn(t *testing.T) {
7174
require.NoError(t, err)
7275
}
7376

77+
func TestApplyDiscoveredEndpoints(t *testing.T) {
78+
ctx := context.Background()
79+
80+
cfg := config.New()
81+
pool := conn.NewPool(ctx, cfg)
82+
defer func() { _ = pool.Release(ctx) }()
83+
84+
b := &Balancer{
85+
driverConfig: cfg,
86+
pool: pool,
87+
balancerConfig: balancerConfig.Config{},
88+
}
89+
90+
initial := newConnectionsState(nil, b.balancerConfig.Filter, balancerConfig.Info{}, b.balancerConfig.AllowFallback)
91+
b.connectionsState.Store(initial)
92+
93+
e1 := endpoint.New("e1.example:2135", endpoint.WithIPV6([]string{"2001:db8::1"}), endpoint.WithID(1))
94+
e2 := endpoint.New("e2.example:2135", endpoint.WithIPV6([]string{"2001:db8::2"}), endpoint.WithID(2))
95+
96+
// call with two endpoints
97+
b.applyDiscoveredEndpoints(ctx, []endpoint.Endpoint{e1, e2}, "")
98+
99+
// connectionsState should be updated and reflect the endpoints
100+
after := b.connections()
101+
require.NotNil(t, after)
102+
all := after.All()
103+
require.Equal(t, 2, len(all))
104+
require.Equal(t, e1.Address(), all[0].Address())
105+
require.Equal(t, e1.NodeID(), all[0].NodeID())
106+
require.Equal(t, e2.Address(), all[1].Address())
107+
require.Equal(t, e2.NodeID(), all[1].NodeID())
108+
109+
// partially replace endpoints
110+
e3 := endpoint.New("e3.example:2135", endpoint.WithIPV6([]string{"2001:db8::3"}), endpoint.WithID(1))
111+
b.applyDiscoveredEndpoints(ctx, []endpoint.Endpoint{e2, e3}, "")
112+
// connectionsState should be updated and reflect the endpoints
113+
after = b.connections()
114+
require.NotNil(t, after)
115+
all = after.All()
116+
require.Equal(t, 2, len(all))
117+
require.Equal(t, e2.Address(), all[0].Address())
118+
require.Equal(t, e2.NodeID(), all[0].NodeID())
119+
require.Equal(t, e3.Address(), all[1].Address())
120+
require.Equal(t, e3.NodeID(), all[1].NodeID())
121+
}
122+
74123
// Mock resolver
75124
//
76125

0 commit comments

Comments
 (0)