From 81caf5d822b87a68c9912e296bbda4a51e5ce324 Mon Sep 17 00:00:00 2001 From: asmyasnikov <79263256394@ya.ru> Date: Mon, 4 Apr 2022 16:31:50 +0300 Subject: [PATCH] * Added `ydb.WithOperationTimeout` and `ydb.WithOperationCancelAfter` context modifiers --- CHANGELOG.md | 5 +- context.go | 21 ++ internal/coordination/client.go | 4 + internal/operation/context.go | 54 +++++ internal/operation/params.go | 11 + internal/operation/params_test.go | 337 ++++++++++++++++++++++++++++ internal/ratelimiter/ratelimiter.go | 7 + internal/scheme/scheme.go | 5 + internal/scripting/scripting.go | 3 + internal/table/session.go | 15 ++ internal/table/transaction.go | 2 + test/table_test.go | 1 + 12 files changed, 463 insertions(+), 2 deletions(-) create mode 100644 context.go create mode 100644 internal/operation/context.go create mode 100644 internal/operation/params_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 57ea1e08d..3501e71a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ -* Add go 1.18 to test matrix +* Added `go1.18` to test matrix +* Added `ydb.WithOperationTimeout` and `ydb.WithOperationCancelAfter` context modifiers ## v3.17.0 * Removed redundant `trace.With{Table,Driver,Retry}` and `trace.Context{Table,Driver,Retry}` funcs -* Moved `gtrace` tool from `./cmt/gtrace` to `./internal/cmd/gtrace` +* Moved `gtrace` tool from `./cmd/gtrace` to `./internal/cmd/gtrace` * Refactored `gtrace` tool for generate `Compose` options * Added panic recover on trace calls in `Compose` call step * Added `trace.With{Discovery,Driver,Coordination,Ratelimiter,Table,Scheme,Scripting}PanicCallback` options diff --git a/context.go b/context.go new file mode 100644 index 000000000..02df85dce --- /dev/null +++ b/context.go @@ -0,0 +1,21 @@ +package ydb + +import ( + "context" + "time" + + "github.com/ydb-platform/ydb-go-sdk/v3/internal/operation" +) + +// WithOperationTimeout returns a copy of parent context in which YDB operation timeout +// parameter is set to d. If parent context timeout is smaller than d, parent context is returned. +func WithOperationTimeout(ctx context.Context, operationTimeout time.Duration) context.Context { + return operation.WithTimeout(ctx, operationTimeout) +} + +// WithOperationCancelAfter returns a copy of parent context in which YDB operation +// cancel after parameter is set to d. If parent context cancellation timeout is smaller +// than d, parent context is returned. +func WithOperationCancelAfter(ctx context.Context, operationCancelAfter time.Duration) context.Context { + return operation.WithCancelAfter(ctx, operationCancelAfter) +} diff --git a/internal/coordination/client.go b/internal/coordination/client.go index f4cd7bf72..7c5c241fb 100644 --- a/internal/coordination/client.go +++ b/internal/coordination/client.go @@ -42,6 +42,7 @@ func (c *client) CreateNode(ctx context.Context, path string, config coordinatio RateLimiterCountersMode: config.RatelimiterCountersMode.To(), }, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -65,6 +66,7 @@ func (c *client) AlterNode(ctx context.Context, path string, config coordination RateLimiterCountersMode: config.RatelimiterCountersMode.To(), }, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -80,6 +82,7 @@ func (c *client) DropNode(ctx context.Context, path string) (err error) { &Ydb_Coordination.DropNodeRequest{ Path: path, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -107,6 +110,7 @@ func (c *client) DescribeNode( &Ydb_Coordination.DescribeNodeRequest{ Path: path, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, diff --git a/internal/operation/context.go b/internal/operation/context.go new file mode 100644 index 000000000..b82d505b4 --- /dev/null +++ b/internal/operation/context.go @@ -0,0 +1,54 @@ +package operation + +import ( + "context" + "time" +) + +type ( + ctxOperationTimeoutKey struct{} + ctxOperationCancelAfterKey struct{} +) + +// WithTimeout returns a copy of parent context in which YDB operation timeout +// parameter is set to d. If parent context timeout is smaller than d, parent context is returned. +func WithTimeout(ctx context.Context, operationTimeout time.Duration) context.Context { + if d, ok := Timeout(ctx); ok && operationTimeout >= d { + // The current cancelation timeout is already smaller than the new one. + return ctx + } + return context.WithValue(ctx, ctxOperationTimeoutKey{}, operationTimeout) +} + +// WithCancelAfter returns a copy of parent context in which YDB operation +// cancel after parameter is set to d. If parent context cancellation timeout is smaller +// than d, parent context is returned. +func WithCancelAfter(ctx context.Context, operationCancelAfter time.Duration) context.Context { + if d, ok := CancelAfter(ctx); ok && operationCancelAfter >= d { + // The current cancelation timeout is already smaller than the new one. + return ctx + } + return context.WithValue(ctx, ctxOperationCancelAfterKey{}, operationCancelAfter) +} + +// Timeout returns the timeout within given context after which +// YDB should try to cancel operation and return result regardless of the cancelation. +func Timeout(ctx context.Context) (d time.Duration, ok bool) { + d, ok = ctx.Value(ctxOperationTimeoutKey{}).(time.Duration) + return +} + +// CancelAfter returns the timeout within given context after which +// YDB should try to cancel operation and return result regardless of the cancellation. +func CancelAfter(ctx context.Context) (d time.Duration, ok bool) { + d, ok = ctx.Value(ctxOperationCancelAfterKey{}).(time.Duration) + return +} + +func untilDeadline(ctx context.Context) (time.Duration, bool) { + deadline, ok := ctx.Deadline() + if ok { + return time.Until(deadline), true + } + return 0, false +} diff --git a/internal/operation/params.go b/internal/operation/params.go index 955727702..2ca1c3c01 100644 --- a/internal/operation/params.go +++ b/internal/operation/params.go @@ -1,16 +1,27 @@ package operation import ( + "context" "time" "github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Operations" ) func Params( + ctx context.Context, timeout time.Duration, cancelAfter time.Duration, mode Mode, ) *Ydb_Operations.OperationParams { + if d, ok := Timeout(ctx); ok { + timeout = d + } + if d, ok := CancelAfter(ctx); ok { + cancelAfter = d + } + if d, ok := untilDeadline(ctx); mode == ModeSync && ok && d < timeout { + timeout = d + } if timeout == 0 && cancelAfter == 0 && mode == 0 { return nil } diff --git a/internal/operation/params_test.go b/internal/operation/params_test.go new file mode 100644 index 000000000..d0cf24cc2 --- /dev/null +++ b/internal/operation/params_test.go @@ -0,0 +1,337 @@ +package operation + +import ( + "context" + "reflect" + "testing" + "time" + + "google.golang.org/protobuf/types/known/durationpb" + + "github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Operations" +) + +func TestParams(t *testing.T) { + for _, tt := range []struct { + ctx context.Context + preferContextTimeout bool + timeout time.Duration + cancelAfter time.Duration + mode Mode + exp *Ydb_Operations.OperationParams + }{ + { + ctx: context.Background(), + timeout: 0, + cancelAfter: 0, + mode: 0, + exp: nil, + }, + { + ctx: WithTimeout( + context.Background(), + time.Second*5, + ), + timeout: 0, + cancelAfter: 0, + mode: 0, + exp: &Ydb_Operations.OperationParams{ + OperationTimeout: durationpb.New(time.Second * 5), + }, + }, + { + ctx: WithTimeout( + WithTimeout( + WithTimeout( + WithTimeout( + WithTimeout( + context.Background(), + time.Second*1, + ), + time.Second*2, + ), + time.Second*3, + ), + time.Second*4, + ), + time.Second*5, + ), + timeout: 0, + cancelAfter: 0, + mode: 0, + exp: &Ydb_Operations.OperationParams{ + OperationTimeout: durationpb.New(time.Second * 1), + }, + }, + { + ctx: WithTimeout( + WithTimeout( + WithTimeout( + WithTimeout( + WithTimeout( + context.Background(), + time.Second*5, + ), + time.Second*4, + ), + time.Second*3, + ), + time.Second*2, + ), + time.Second*1, + ), + timeout: 0, + cancelAfter: 0, + mode: 0, + exp: &Ydb_Operations.OperationParams{ + OperationTimeout: durationpb.New(time.Second * 1), + }, + }, + { + ctx: WithCancelAfter( + context.Background(), + time.Second*5, + ), + timeout: 0, + cancelAfter: 0, + mode: 0, + exp: &Ydb_Operations.OperationParams{ + CancelAfter: durationpb.New(time.Second * 5), + }, + }, + { + ctx: WithCancelAfter( + WithCancelAfter( + WithCancelAfter( + WithCancelAfter( + WithCancelAfter( + context.Background(), + time.Second*1, + ), + time.Second*2, + ), + time.Second*3, + ), + time.Second*4, + ), + time.Second*5, + ), + timeout: 0, + cancelAfter: 0, + mode: 0, + exp: &Ydb_Operations.OperationParams{ + CancelAfter: durationpb.New(time.Second * 1), + }, + }, + { + ctx: WithCancelAfter( + WithCancelAfter( + WithCancelAfter( + WithCancelAfter( + WithCancelAfter( + context.Background(), + time.Second*5, + ), + time.Second*4, + ), + time.Second*3, + ), + time.Second*2, + ), + time.Second*1, + ), + timeout: 0, + cancelAfter: 0, + mode: 0, + exp: &Ydb_Operations.OperationParams{ + CancelAfter: durationpb.New(time.Second * 1), + }, + }, + { + ctx: WithCancelAfter( + WithTimeout( + context.Background(), + time.Second*5, + ), + time.Second*5, + ), + timeout: 0, + cancelAfter: 0, + mode: 0, + exp: &Ydb_Operations.OperationParams{ + OperationTimeout: durationpb.New(time.Second * 5), + CancelAfter: durationpb.New(time.Second * 5), + }, + }, + { + ctx: WithCancelAfter( + WithTimeout( + context.Background(), + time.Second*5, + ), + time.Second*5, + ), + timeout: 0, + cancelAfter: 0, + mode: ModeSync, + exp: &Ydb_Operations.OperationParams{ + OperationMode: Ydb_Operations.OperationParams_SYNC, + OperationTimeout: durationpb.New(time.Second * 5), + CancelAfter: durationpb.New(time.Second * 5), + }, + }, + { + ctx: WithCancelAfter( + WithTimeout( + context.Background(), + time.Second*5, + ), + time.Second*5, + ), + timeout: time.Second * 2, + cancelAfter: 0, + mode: ModeSync, + exp: &Ydb_Operations.OperationParams{ + OperationMode: Ydb_Operations.OperationParams_SYNC, + OperationTimeout: durationpb.New(time.Second * 5), + CancelAfter: durationpb.New(time.Second * 5), + }, + }, + { + ctx: WithCancelAfter( + WithTimeout( + context.Background(), + time.Second*5, + ), + time.Second*5, + ), + timeout: time.Second * 2, + cancelAfter: 0, + mode: ModeAsync, + exp: &Ydb_Operations.OperationParams{ + OperationMode: Ydb_Operations.OperationParams_ASYNC, + OperationTimeout: durationpb.New(time.Second * 5), + CancelAfter: durationpb.New(time.Second * 5), + }, + }, + { + ctx: func() context.Context { + // nolint: govet + ctx, _ := context.WithTimeout(WithCancelAfter( + WithTimeout( + context.Background(), + time.Second*5, + ), + time.Second*5, + ), time.Second*10) + return ctx + }(), + timeout: time.Second * 2, + cancelAfter: 0, + mode: ModeAsync, + exp: &Ydb_Operations.OperationParams{ + OperationMode: Ydb_Operations.OperationParams_ASYNC, + OperationTimeout: durationpb.New(time.Second * 5), + CancelAfter: durationpb.New(time.Second * 5), + }, + }, + { + ctx: func() context.Context { + // nolint: govet + ctx, _ := context.WithTimeout(WithCancelAfter( + WithTimeout( + context.Background(), + time.Second*5, + ), + time.Second*5, + ), time.Second*1) + return ctx + }(), + timeout: time.Second * 2, + cancelAfter: 0, + mode: ModeAsync, + exp: &Ydb_Operations.OperationParams{ + OperationMode: Ydb_Operations.OperationParams_ASYNC, + OperationTimeout: durationpb.New(time.Second * 5), + CancelAfter: durationpb.New(time.Second * 5), + }, + }, + { + ctx: func() context.Context { + // nolint: govet + ctx, _ := context.WithTimeout(WithCancelAfter( + WithTimeout( + context.Background(), + time.Second*5, + ), + time.Second*5, + ), time.Second*1) + return ctx + }(), + preferContextTimeout: true, + timeout: time.Second * 2, + cancelAfter: 0, + mode: ModeSync, + exp: &Ydb_Operations.OperationParams{ + OperationMode: Ydb_Operations.OperationParams_SYNC, + OperationTimeout: durationpb.New(time.Second * 1), + CancelAfter: durationpb.New(time.Second * 5), + }, + }, + { + ctx: func() context.Context { + // nolint: govet + ctx, _ := context.WithTimeout(context.Background(), time.Second*1) + return ctx + }(), + preferContextTimeout: true, + timeout: time.Second * 2, + cancelAfter: 0, + mode: ModeSync, + exp: &Ydb_Operations.OperationParams{ + OperationMode: Ydb_Operations.OperationParams_SYNC, + OperationTimeout: durationpb.New(time.Second * 1), + }, + }, + } { + t.Run("", func(t *testing.T) { + got := Params(tt.ctx, tt.timeout, tt.cancelAfter, tt.mode) + t.Logf( + "Params(): {%v}, compare to: {%v}", + got, + tt.exp, + ) + if !tt.preferContextTimeout { + if !reflect.DeepEqual(got, tt.exp) { + t.Errorf( + "Params(): {%v}, want: {%v}", + got, + tt.exp, + ) + } + return + } + if !reflect.DeepEqual(got.OperationMode, tt.exp.OperationMode) { + t.Errorf( + "Params().OperationMode: %v, want: %v", + got.OperationMode, + tt.exp.OperationMode, + ) + } + if !reflect.DeepEqual(got.CancelAfter, tt.exp.CancelAfter) { + t.Errorf( + "Params().CancelAfter: %v, want: %v", + got.CancelAfter.AsDuration(), + tt.exp.CancelAfter.AsDuration(), + ) + } + if got.OperationTimeout.AsDuration() > tt.exp.OperationTimeout.AsDuration() { + t.Errorf( + "Params().OperationTimeout: %v, want: <= %v", + got.OperationTimeout.AsDuration(), + tt.exp.OperationTimeout.AsDuration(), + ) + } + }) + } +} diff --git a/internal/ratelimiter/ratelimiter.go b/internal/ratelimiter/ratelimiter.go index ddbf20cee..8c7e72cc6 100644 --- a/internal/ratelimiter/ratelimiter.go +++ b/internal/ratelimiter/ratelimiter.go @@ -58,6 +58,7 @@ func (c *client) CreateResource( }}, }, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -83,6 +84,7 @@ func (c *client) AlterResource( }}, }, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -100,6 +102,7 @@ func (c *client) DropResource( CoordinationNodePath: coordinationNodePath, ResourcePath: resourcePath, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -123,6 +126,7 @@ func (c *client) ListResource( ResourcePath: resourcePath, Recursive: recursive, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -151,6 +155,7 @@ func (c *client) DescribeResource( CoordinationNodePath: coordinationNodePath, ResourcePath: resourcePath, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -208,6 +213,7 @@ func (c *client) AcquireResource( Required: amount, }, OperationParams: operation.Params( + ctx, acquireOptions.OperationTimeout(), acquireOptions.OperationCancelAfter(), operation.ModeSync, @@ -224,6 +230,7 @@ func (c *client) AcquireResource( Used: amount, }, OperationParams: operation.Params( + ctx, acquireOptions.OperationTimeout(), acquireOptions.OperationCancelAfter(), operation.ModeSync, diff --git a/internal/scheme/scheme.go b/internal/scheme/scheme.go index b4a93ad61..b1538341a 100644 --- a/internal/scheme/scheme.go +++ b/internal/scheme/scheme.go @@ -37,6 +37,7 @@ func (c *client) MakeDirectory(ctx context.Context, path string) (err error) { &Ydb_Scheme.MakeDirectoryRequest{ Path: path, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -52,6 +53,7 @@ func (c *client) RemoveDirectory(ctx context.Context, path string) (err error) { &Ydb_Scheme.RemoveDirectoryRequest{ Path: path, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -73,6 +75,7 @@ func (c *client) ListDirectory(ctx context.Context, path string) (scheme.Directo &Ydb_Scheme.ListDirectoryRequest{ Path: path, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -102,6 +105,7 @@ func (c *client) DescribePath(ctx context.Context, path string) (e scheme.Entry, &Ydb_Scheme.DescribePathRequest{ Path: path, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -131,6 +135,7 @@ func (c *client) ModifyPermissions(ctx context.Context, path string, opts ...sch Actions: desc.actions, ClearPermissions: desc.clear, OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, diff --git a/internal/scripting/scripting.go b/internal/scripting/scripting.go index 1aab26b1b..2e6806742 100644 --- a/internal/scripting/scripting.go +++ b/internal/scripting/scripting.go @@ -39,6 +39,7 @@ func (c *client) Execute( Script: query, Parameters: params.Params(), OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -84,6 +85,7 @@ func (c *client) Explain( Script: query, Mode: mode2mode(mode), OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, @@ -127,6 +129,7 @@ func (c *client) StreamExecute( Script: query, Parameters: params.Params(), OperationParams: operation.Params( + ctx, c.config.OperationTimeout(), c.config.OperationCancelAfter(), operation.ModeSync, diff --git a/internal/table/session.go b/internal/table/session.go index 57432733d..25bfdf20b 100644 --- a/internal/table/session.go +++ b/internal/table/session.go @@ -102,6 +102,7 @@ func newSession(ctx context.Context, cc grpc.ClientConnInterface, config config. ctx, &Ydb_Table.CreateSessionRequest{ OperationParams: operation.Params( + ctx, config.OperationTimeout(), config.OperationCancelAfter(), operation.ModeSync, @@ -179,6 +180,7 @@ func (s *session) Close(ctx context.Context) (err error) { &Ydb_Table.DeleteSessionRequest{ SessionId: s.id, OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -209,6 +211,7 @@ func (s *session) KeepAlive(ctx context.Context) (err error) { &Ydb_Table.KeepAliveRequest{ SessionId: s.id, OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -245,6 +248,7 @@ func (s *session) CreateTable( SessionId: s.id, Path: path, OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -277,6 +281,7 @@ func (s *session) DescribeTable( SessionId: s.id, Path: path, OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -413,6 +418,7 @@ func (s *session) DropTable( SessionId: s.id, Path: path, OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -441,6 +447,7 @@ func (s *session) AlterTable( SessionId: s.id, Path: path, OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -470,6 +477,7 @@ func (s *session) CopyTable( SourcePath: src, DestinationPath: dst, OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -523,6 +531,7 @@ func (s *session) Explain( SessionId: s.id, YqlText: query, OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -573,6 +582,7 @@ func (s *session) Prepare(ctx context.Context, query string) (stmt table.Stateme SessionId: s.id, YqlText: query, OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -672,6 +682,7 @@ func (s *session) executeDataQuery( Parameters: params.Params(), Query: &query.query, OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -710,6 +721,7 @@ func (s *session) ExecuteSchemeQuery( SessionId: s.id, YqlText: query, OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -739,6 +751,7 @@ func (s *session) DescribeTableOptions(ctx context.Context) ( ) request := Ydb_Table.DescribeTableOptionsRequest{ OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -1034,6 +1047,7 @@ func (s *session) BulkUpsert(ctx context.Context, table string, rows types.Value Table: table, Rows: value.ToYDB(rows), OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, @@ -1071,6 +1085,7 @@ func (s *session) BeginTransaction( SessionId: s.id, TxSettings: tx.Settings(), OperationParams: operation.Params( + ctx, s.config.OperationTimeout(), s.config.OperationCancelAfter(), operation.ModeSync, diff --git a/internal/table/transaction.go b/internal/table/transaction.go index 122f2c87c..6bb988cfb 100644 --- a/internal/table/transaction.go +++ b/internal/table/transaction.go @@ -88,6 +88,7 @@ func (tx *transaction) CommitTx( SessionId: tx.s.id, TxId: tx.id, OperationParams: operation.Params( + ctx, tx.s.config.OperationTimeout(), tx.s.config.OperationCancelAfter(), operation.ModeSync, @@ -149,6 +150,7 @@ func (tx *transaction) Rollback(ctx context.Context) (err error) { SessionId: tx.s.id, TxId: tx.id, OperationParams: operation.Params( + ctx, tx.s.config.OperationTimeout(), tx.s.config.OperationCancelAfter(), operation.ModeSync, diff --git a/test/table_test.go b/test/table_test.go index 0cb86343d..c3e019156 100644 --- a/test/table_test.go +++ b/test/table_test.go @@ -200,6 +200,7 @@ func TestTable(t *testing.T) { ydb.WithAccessTokenCredentials(os.Getenv("YDB_ACCESS_TOKEN_CREDENTIALS")), ydb.WithUserAgent("tx"), ydb.With( + config.WithOperationTimeout(123), config.WithOperationTimeout(time.Second*5), config.WithOperationCancelAfter(time.Second*5), config.WithInternalDNSResolver(),