@@ -3,7 +3,6 @@ package table
33import (
44 "context"
55
6- "github.com/ydb-platform/ydb-go-sdk/v3/internal/backoff"
76 "github.com/ydb-platform/ydb-go-sdk/v3/internal/table/config"
87 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
98 "github.com/ydb-platform/ydb-go-sdk/v3/retry"
@@ -50,18 +49,14 @@ func doTx(
5049 attempts , onIntermediate := 0 , trace .TableOnDoTx (
5150 opts .Trace ,
5251 & ctx ,
52+ opts .ID ,
5353 opts .Idempotent ,
5454 isRetryCalledAbove (ctx ),
5555 )
5656 defer func () {
5757 onIntermediate (err )(attempts , err )
5858 }()
59- err = retryBackoff (
60- ctx ,
61- c ,
62- opts .FastBackoff ,
63- opts .SlowBackoff ,
64- opts .Idempotent ,
59+ err = retryBackoff (ctx , c ,
6560 func (ctx context.Context , s table.Session ) (err error ) {
6661 attempts ++
6762
@@ -110,6 +105,7 @@ func doTx(
110105
111106 return nil
112107 },
108+ opts .RetryOptions ... ,
113109 )
114110 if err != nil {
115111 return xerrors .WithStackTrace (err )
@@ -127,11 +123,11 @@ func do(
127123 if opts .Trace == nil {
128124 opts .Trace = & trace.Table {}
129125 }
130- attempts , onIntermediate := 0 , trace .TableOnDo (opts .Trace , & ctx , opts .Idempotent , isRetryCalledAbove (ctx ))
126+ attempts , onIntermediate := 0 , trace .TableOnDo (opts .Trace , & ctx , opts .ID , opts . Idempotent , isRetryCalledAbove (ctx ))
131127 defer func () {
132128 onIntermediate (err )(attempts , err )
133129 }()
134- return retryBackoff (ctx , c , opts . FastBackoff , opts . SlowBackoff , opts . Idempotent ,
130+ return retryBackoff (ctx , c ,
135131 func (ctx context.Context , s table.Session ) (err error ) {
136132 attempts ++
137133
@@ -156,16 +152,15 @@ func do(
156152
157153 return nil
158154 },
155+ opts .RetryOptions ... ,
159156 )
160157}
161158
162159func retryBackoff (
163160 ctx context.Context ,
164161 p SessionProvider ,
165- fastBackoff backoff.Backoff ,
166- slowBackoff backoff.Backoff ,
167- isOperationIdempotent bool ,
168162 op table.Operation ,
163+ opts ... retry.Option ,
169164) (err error ) {
170165 err = retry .Retry (markRetryCall (ctx ),
171166 func (ctx context.Context ) (err error ) {
@@ -188,9 +183,7 @@ func retryBackoff(
188183
189184 return nil
190185 },
191- retry .WithFastBackoff (fastBackoff ),
192- retry .WithSlowBackoff (slowBackoff ),
193- retry .WithIdempotent (isOperationIdempotent ),
186+ opts ... ,
194187 )
195188 if err != nil {
196189 return xerrors .WithStackTrace (err )
@@ -200,16 +193,14 @@ func retryBackoff(
200193
201194func retryOptions (trace * trace.Table , opts ... table.Option ) * table.Options {
202195 options := & table.Options {
203- Trace : trace ,
204- FastBackoff : backoff .Fast ,
205- SlowBackoff : backoff .Slow ,
196+ Trace : trace ,
206197 TxSettings : table .TxSettings (
207198 table .WithSerializableReadWrite (),
208199 ),
209200 }
210- for _ , o := range opts {
211- if o != nil {
212- o (options )
201+ for _ , opt := range opts {
202+ if opt != nil {
203+ opt . ApplyTableOption (options )
213204 }
214205 }
215206 return options
0 commit comments