Skip to content

Commit 12747f2

Browse files
kprokopenkosyntesioasmyasnikov
authored
fix SLO test database-sql-query (#1836)
Co-authored-by: Konstantin Prokopenko <[email protected]> Co-authored-by: Aleksey Myasnikov <[email protected]>
1 parent e4be58e commit 12747f2

File tree

14 files changed

+500
-400
lines changed

14 files changed

+500
-400
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
* Fixed several issues in `database/sql` error handling
2+
* Improved context management for query result streams.
3+
14
## v3.113.0
25
* Added experimental `config.WithDisableOptimisticUnban` option to disable fast node unban after pessimization
36
* Fixed respect start offset from `topicoptions.WithReaderGetPartitionStartOffset` for commit messages

internal/query/client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func (c *Client) QueryRow(ctx context.Context, q string, opts ...options.Execute
337337
onDone(finalErr)
338338
}()
339339

340-
row, err := clientQueryRow(ctx, c.pool(), q, settings, withTrace(c.config.Trace()))
340+
row, err := clientQueryRow(ctx, c.pool(), q, settings, withStreamResultTrace(c.config.Trace()))
341341
if err != nil {
342342
return nil, xerrors.WithStackTrace(err)
343343
}
@@ -348,7 +348,7 @@ func (c *Client) QueryRow(ctx context.Context, q string, opts ...options.Execute
348348
func clientExec(ctx context.Context, pool sessionPool, q string, opts ...options.Execute) (finalErr error) {
349349
settings := options.ExecuteSettings(opts...)
350350
err := do(ctx, pool, func(ctx context.Context, s *Session) (err error) {
351-
streamResult, err := s.execute(ctx, q, settings, withTrace(s.trace))
351+
streamResult, err := s.execute(ctx, q, settings, withStreamResultTrace(s.trace))
352352
if err != nil {
353353
return xerrors.WithStackTrace(err)
354354
}
@@ -397,7 +397,7 @@ func clientQuery(ctx context.Context, pool sessionPool, q string, opts ...option
397397
) {
398398
settings := options.ExecuteSettings(opts...)
399399
err = do(ctx, pool, func(ctx context.Context, s *Session) (err error) {
400-
streamResult, err := s.execute(ctx, q, options.ExecuteSettings(opts...), withTrace(s.trace))
400+
streamResult, err := s.execute(ctx, q, options.ExecuteSettings(opts...), withStreamResultTrace(s.trace))
401401
if err != nil {
402402
return xerrors.WithStackTrace(err)
403403
}
@@ -487,7 +487,7 @@ func (c *Client) QueryResultSet(
487487
onDone(finalErr, rowsCount)
488488
}()
489489

490-
rs, rowsCount, err = clientQueryResultSet(ctx, c.pool(), q, settings, withTrace(c.config.Trace()))
490+
rs, rowsCount, err = clientQueryResultSet(ctx, c.pool(), q, settings, withStreamResultTrace(c.config.Trace()))
491491
if err != nil {
492492
return nil, xerrors.WithStackTrace(err)
493493
}

internal/query/execute_query.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ func execute(
131131
}
132132

133133
r, err := newResult(ctx, stream, append(opts,
134-
withStatsCallback(settings.StatsCallback()),
135-
withOnClose(executeCancel),
134+
withStreamResultStatsCallback(settings.StatsCallback()),
135+
withStreamResultOnClose(executeCancel),
136136
)...)
137137
if err != nil {
138138
return nil, xerrors.WithStackTrace(err)

0 commit comments

Comments
 (0)