Skip to content

Commit 7fa8238

Browse files
committed
* Changed trace.RetryLoopStartInfo.Context type from context.Context to *context.Context
1 parent defa4d7 commit 7fa8238

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Fixed bug with unexpected changing of local datacenter flag in endpoint
55
* Refactored errors wrapping (stackedError are not ydb error now, checking `errors.IsYdb(err)` with `errors.As` now)
66
* Wrapped retry operation errors with `errors.WithStackTrace(err)`
7+
* Changed `trace.RetryLoopStartInfo.Context` type from `context.Context` to `*context.Context`
78

89
## v3.16.9
910
* Refactored internal operation and transport errors

internal/table/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func (c *client) CreateSession(ctx context.Context, opts ...table.Option) (table
135135
retry.WithSlowBackoff(options.SlowBackoff),
136136
retry.WithTrace(trace.Retry{
137137
OnRetry: func(info trace.RetryLoopStartInfo) func(trace.RetryLoopIntermediateInfo) func(trace.RetryLoopDoneInfo) {
138-
onIntermediate := trace.TableOnCreateSession(c.config.Trace(), &info.Context)
138+
onIntermediate := trace.TableOnCreateSession(c.config.Trace(), info.Context)
139139
return func(info trace.RetryLoopIntermediateInfo) func(trace.RetryLoopDoneInfo) {
140140
onDone := onIntermediate(info.Error)
141141
return func(info trace.RetryLoopDoneInfo) {

retry/retry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func Retry(ctx context.Context, op retryOperation, opts ...retryOption) (err err
126126
attempts int
127127

128128
code = int64(0)
129-
onIntermediate = trace.RetryOnRetry(h.trace, ctx, h.id, h.idempotent)
129+
onIntermediate = trace.RetryOnRetry(h.trace, &ctx, h.id, h.idempotent)
130130
)
131131
defer func() {
132132
onIntermediate(err)(attempts, err)

trace/retry.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ type (
1515
OnRetry func(RetryLoopStartInfo) func(RetryLoopIntermediateInfo) func(RetryLoopDoneInfo)
1616
}
1717
RetryLoopStartInfo struct {
18-
Context context.Context
18+
// Context make available context in trace callback function.
19+
// Pointer to context provide replacement of context in trace callback function.
20+
// Warning: concurrent access to pointer on client side must be excluded.
21+
// Safe replacement of context are provided only inside callback function
22+
Context *context.Context
1923
ID string
2024
Idempotent bool
2125
}

trace/retry_gtrace.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)