Skip to content

Commit

Permalink
fix unwrap raw values in wide results
Browse files Browse the repository at this point in the history
  • Loading branch information
rekby committed Nov 24, 2023
1 parent 3c08fa3 commit a37ab0e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Context for call options now have same lifetime as driver (previous - same lifetime as context for call Open function).

## v3.54.2
* Added context to some internal methods for better tracing
* Added `trace.FunctionID` helper and `FunctionID` field to trace start info's
Expand Down
19 changes: 18 additions & 1 deletion driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
internalTable "github.com/ydb-platform/ydb-go-sdk/v3/internal/table"
tableConfig "github.com/ydb-platform/ydb-go-sdk/v3/internal/table/config"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/topic/topicclientinternal"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xcontext"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xsync"
Expand All @@ -47,6 +48,9 @@ var _ Connection = (*Driver)(nil)

// Driver type provide access to YDB service clients
type Driver struct { //nolint:maligned
ctx context.Context // cancel while Driver.Close called.
ctxCancel context.CancelFunc

userInfo *dsn.UserInfo

logger log.Logger
Expand Down Expand Up @@ -106,10 +110,13 @@ func (d *Driver) Close(ctx context.Context) (finalErr error) {
defer func() {
onDone(finalErr)
}()
d.ctxCancel()

d.mtx.Lock()
defer d.mtx.Unlock()

d.ctxCancel()

defer func() {
for _, f := range d.onClose {
f(d)
Expand Down Expand Up @@ -268,9 +275,19 @@ func New(ctx context.Context, opts ...Option) (_ *Driver, err error) {
}

func newConnectionFromOptions(ctx context.Context, opts ...Option) (_ *Driver, err error) {
ctx, driverCtxCancel := xcontext.WithCancel(xcontext.WithoutDeadline(ctx))
defer func() {
if err != nil {
driverCtxCancel()
}
}()

d := &Driver{
children: make(map[uint64]*Driver),
children: make(map[uint64]*Driver),
ctx: ctx,
ctxCancel: driverCtxCancel,
}

if caFile, has := os.LookupEnv("YDB_SSL_ROOT_CERTIFICATES_FILE"); has {
d.opts = append(d.opts,
WithCertificatesFromFile(caFile),
Expand Down

0 comments on commit a37ab0e

Please sign in to comment.