Skip to content

Commit 1c67c41

Browse files
committed
v3.0.0 release
1 parent 0156067 commit 1c67c41

File tree

18 files changed

+170
-254
lines changed

18 files changed

+170
-254
lines changed

.github/workflows/changelog.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
on:
2+
pull_request_target:
3+
4+
name: changelog
5+
6+
jobs:
7+
changelog:
8+
name: changelog
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout sources
12+
uses: actions/checkout@v2
13+
14+
- name: Changelog updated
15+
uses: Zomzog/[email protected]
16+
with:
17+
fileName: CHANGELOG.md
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/version.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
on:
2+
pull_request_target:
3+
4+
name: version
5+
6+
jobs:
7+
changelog:
8+
name: version
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout sources
12+
uses: actions/checkout@v2
13+
14+
- name: Version updated
15+
uses: Zomzog/[email protected]
16+
with:
17+
fileName: internal/meta/version.go
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

AUTHORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
The following authors have created the source code of "Yandex Database GO SDK"
22
published and distributed by YANDEX LLC as the owner:
33

4-
Sergey Kamardin <kamardin@yandex-team.ru>
4+
Aleksey Myasnikov <asmyasnikov@yandex-team.ru>

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 3.0.0
2+
* Refactored sources for splitting public interfaces and internal
3+
implementation for core changes in the future without change major version
4+
* Refactored of transport level of driver - now we use grpc code generation by stock `protoc-gen-go` instead internal protoc codegen. New API provide operate from codegen grpc-clients with driver as a single grpc client connection. But driver hide inside self a pool of grpc connections to different cluster endpoints YDB. All communications with YDB (base services includes to driver: table, discovery, coordiantion and ratelimiter) provides stock codegen grpc-clients now.
5+
* Much changed API of driver for easy usage.
6+
* Dropped package `ydbsql` (moved to external project)
7+
* Extracted yandex-cloud authentication to external project
8+
* Extracted examples to external project
9+
* Changed of traces API for next usage in jaeger и prometheus
10+
* Dropped old APIs marked as `deprecated`
11+
* Added integration tests with docker ydb container
12+
* Changed table session and endpoint link type from string address to integer NodeID
13+
114
## 2.10.1
215
* Fixed race on ydbsql concurrent connect. This hotfix only for v2 version
316

NEXT_MAJOR_RELEASE.md

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,2 @@
11
# Breaking changes for the next major release
2-
- [x] Delete deprecated api package
3-
- [x] Delete deprecated internalapi package
4-
- [x] Delete deprecated parameter KeepAliveBatchSize from session pool
5-
- [x] Delete deprecated ConnUsePolicy, EndpointInfo, WithEndpointInfo, WithEndpointInfoAndPolicy, ContextConn
6-
- [x] Delete deprecated client option DefaultMaxQueryCacheSize, MaxQueryCacheSize and client query cache
7-
- [x] Change `proto` codegen code in `api` from `internal/cmd/protoc-gen` tool to standard `protoc-gen-go` tool.
8-
This need for change imports to standard. Current imports are deprecated and linters alarms
9-
- [x] Replace grpc and protobuf libraries to actual
10-
- [x] Replace all internal usages of `driver.Call()` and `driver.StreamRead()` to code-generated grpc-clients,
11-
which will be use driver as `grpc.ClientConnInterface` provider.
12-
- [x] Delete deprecated Driver interface
13-
- [x] Remove or hide (do private) deprecated API for new `scanner`.
14-
- [x] Delete deprecated ready statistics from session pool
15-
- [x] Hide (do private) entity `table.Client` or `table.SessionPool` because it most difficultly for SDK users
16-
- [x] Drop `table.SessionProvider.PutBusy()` interface func
17-
- [x] Drop `Retry.MustCheckSession()` func
18-
- [x] Drop `RetryCheckSession` constant
19-
- [x] Drop `table.SessionPoolStats.BusyCheck` counter
20-
- [x] Drop `ydbsql.WithSessionPoolBusyCheckInterval()`
21-
- [x] Drop `connect.WithSessionPoolBusyCheckInterval()`
22-
- [x] Drop marked as deprecated some retry constants
23-
- [x] Extract auth package to neighbour project(-s) for isolation ydb-go-sdk from unnecessary dependencies
24-
- [x] Extract coordination package to neighbour project as plugin over ydb-go-sdk
25-
- [x] Extract ratelimiter package to neighbour project as plugin over ydb-go-sdk
26-
- [x] Extract experimental package to neighbour project as plugin over ydb-go-sdk
27-
- [x] Refactoring Trace API: exclude duplicates of data from closure Trace functions
28-
- [x] Move traceutil from internal to root
29-
- [X] Drop ReadConnStats() public method. Use Cluster.Stats() instead
30-
- [x] Drop deprecated NextStreamSet (merged logic into NextSet)
2+
- [ ]

README.md

Lines changed: 33 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,12 @@ The straightforward example of querying data may look similar to this:
5959
// Determine timeout for connect or do nothing
6060
ctx := context.Background()
6161

62-
connectParams, err := ydb.ConnectionString(os.Getenv("YDB"))
63-
if err != nil {
64-
_, _ = fmt.Fprintf(os.Stderr, "cannot create connect params from connection string env['YDB'] = '%s': %v\n", os.Getenv("YDB"), err)
65-
os.Exit(1)
66-
}
67-
6862
// connect package helps to connect to database, returns connection object which
6963
// provide necessary clients such as table.Client, scheme.Client, etc.
7064
db, err := ydb.New(
7165
ctx,
7266
connectParams,
67+
ydb.WithConnectionString(ydb.ConnectionString(os.Getenv("YDB_CONNECTION_STRING"))),
7368
ydb.WithDialTimeout(3 * time.Second),
7469
ydb.WithCertificatesFromFile("~/.ydb/CA.pem"),
7570
ydb.WithSessionPoolIdleThreshold(time.Second * 5),
@@ -80,35 +75,42 @@ The straightforward example of querying data may look similar to this:
8075
if err != nil {
8176
// handle error
8277
}
83-
defer func() { _ = db.Close() }()
84-
85-
// Create session for execute queries
86-
session, err := db.Table().CreateSession(ctx)
87-
if err != nil {
88-
// handle error
89-
}
90-
defer session.Close(ctx)
78+
defer func() { _ = db.Close(ctx) }()
9179

9280
// Prepare transaction control for upcoming query execution.
9381
// NOTE: result of TxControl() may be reused.
9482
txc := table.TxControl(
95-
table.BeginTx(table.WithSerializableReadWrite()),
96-
table.CommitTx(),
83+
table.BeginTx(table.WithSerializableReadWrite()),
84+
table.CommitTx(),
9785
)
9886

99-
// Execute text query without preparation and with given "autocommit"
100-
// transaction control. That is, transaction will be committed without
101-
// additional calls. Notice the "_" unused variable – it stands for created
102-
// transaction during execution, but as said above, transaction is committed
103-
// for us and `ydb-go-sdk` do not want to do anything with it.
104-
_, res, err := session.Execute(ctx, txc,
105-
`--!syntax_v1
106-
DECLARE $mystr AS Utf8?;
107-
SELECT 42 as id, $mystr as mystr
108-
`,
109-
table.NewQueryParameters(
110-
table.ValueParam("$mystr", types.OptionalValue(types.UTF8Value("test"))),
111-
),
87+
var res *table.Result
88+
89+
// Do() provide the best effort for executing operation
90+
// Do implements internal busy loop until one of the following conditions occurs:
91+
// - deadline was cancelled or deadlined
92+
// - operation returned nil as error
93+
// Note that in case of prepared statements call to Prepare() must be made
94+
// inside the function body.
95+
err := c.Do(
96+
ctx,
97+
func(ctx context.Context, s table.Session) (err error) {
98+
// Execute text query without preparation and with given "autocommit"
99+
// transaction control. That is, transaction will be committed without
100+
// additional calls. Notice the "_" unused variable – it stands for created
101+
// transaction during execution, but as said above, transaction is committed
102+
// for us and `ydb-go-sdk` do not want to do anything with it.
103+
_, res, err := session.Execute(ctx, txc,
104+
`--!syntax_v1
105+
DECLARE $mystr AS Utf8?;
106+
SELECT 42 as id, $mystr as mystr
107+
`,
108+
table.NewQueryParameters(
109+
table.ValueParam("$mystr", types.OptionalValue(types.UTF8Value("test"))),
110+
),
111+
)
112+
return err
113+
},
112114
)
113115
if err != nil {
114116
return err // handle error
@@ -139,35 +141,13 @@ The straightforward example of querying data may look similar to this:
139141
}
140142
```
141143

142-
This example can be tested as https://github.com/ydb-platform/ydb-go-examples/tree/master/from_readme
143-
144144
YDB sessions may become staled and appropriate error will be returned. To
145-
reduce boilerplate overhead for such cases `ydb-go-sdk` provides generic retry logic:
146-
147-
```go
148-
var res *table.Result
149-
// Retry() provide the best effort fo retrying operation
150-
// Retry implements internal busy loop until one of the following conditions occurs:
151-
// - deadline was cancelled or deadlined
152-
// - retry operation returned nil as error
153-
// Note that in case of prepared statements call to Prepare() must be made
154-
// inside the function body.
155-
err := c.Retry(ctx, false,
156-
func(ctx context.Context, s table.Session) (err error) {
157-
res, err = s.Execute(...)
158-
return
159-
},
160-
)
161-
```
162-
163-
That is, instead of manual creation of `table.Session`, we give a
164-
`table.Client` such responsibility. It holds instances of active sessions and
165-
"pings" them periodically to keep them alive.
145+
reduce boilerplate overhead for such cases `ydb-go-sdk` provides generic retry logic
166146

167147
## Credentials <a name="Credentials"></a>
168148

169149
There are different variants to get `ydb.Credentials` object to get authorized.
170-
Usage examples can be found [here](https://github.com/ydb-platform/ydb-go-examples/tree/master/auth).
150+
Usage examples can be found [here](https://github.com/ydb-platform/ydb-go-examples/tree/master/cmd/auth).
171151

172152
## Examples <a name="examples"></a>
173153

go.mod

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ module github.com/ydb-platform/ydb-go-sdk/v3
33
go 1.14
44

55
require (
6+
github.com/ydb-platform/ydb-api-protos v0.0.0-20210921091122-f697ac767e19 // indirect
67
github.com/ydb-platform/ydb-go-genproto v0.0.0-20210916081217-f4e55570b874
7-
google.golang.org/grpc v1.37.0
8+
google.golang.org/grpc v1.38.0
89
google.golang.org/protobuf v1.26.0
910
)
11+
12+
retract (
13+
v3.0.0
14+
v3.0.1
15+
v3.0.2
16+
v3.0.3
17+
)

go.sum

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
3333
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
3434
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
3535
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
36+
github.com/ydb-platform/ydb-api-protos v0.0.0-20210921091122-f697ac767e19 h1:uywQn4qvfAgy7muv7G+C8t+KbKnTkQhs82O45/9CcPg=
37+
github.com/ydb-platform/ydb-api-protos v0.0.0-20210921091122-f697ac767e19/go.mod h1:I0NWnA2hX8d2tKctW3AO2ne1Xc+FhvhA8PbP4iXQa5M=
3638
github.com/ydb-platform/ydb-go-genproto v0.0.0-20210916081217-f4e55570b874 h1:wbpYXEn87uEDkH3RvG37XW2ipEkqxpJUCGAoU1on0yE=
3739
github.com/ydb-platform/ydb-go-genproto v0.0.0-20210916081217-f4e55570b874/go.mod h1:cc138nptTn9eKptCQl/grxP6pBKpo/bnXDiOxuVZtps=
3840
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -70,8 +72,9 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi
7072
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
7173
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
7274
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
73-
google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c=
7475
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
76+
google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=
77+
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
7578
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
7679
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
7780
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=

internal/driver/cluster/balancer/conn/conn.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package conn
22

3-
import "C"
4-
53
import (
64
"context"
75
"sync"

internal/meta/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package meta
22

33
const (
4-
Version = "ydb-go-sdk/2.10.1"
4+
Version = "ydb-go-sdk/3.0.0"
55
)

0 commit comments

Comments
 (0)