Skip to content

Commit c97f7d1

Browse files
authored
Merge pull request #271 from ydb-platform/do-tx-default-tx-settings
* Defined the `SerializableReadWrite` isolation level by default in `…
2 parents 540ffbb + 15b2174 commit c97f7d1

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
* Updated the genproto dependency
1+
* Defined the `SerializableReadWrite` isolation level by default in `db.Table.DoTx(ctx, func(ctx, tx))`
2+
* Updated the `ydb-go-genproto` dependency
23

34
## v3.26.5
45
* Disabled the `KeepInCache` policy for queries without params

internal/table/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,9 @@ func retryOptions(trace trace.Table, opts ...table.Option) table.Options {
528528
Trace: trace,
529529
FastBackoff: backoff.Fast,
530530
SlowBackoff: backoff.Slow,
531+
TxSettings: table.TxSettings(
532+
table.WithSerializableReadWrite(),
533+
),
531534
}
532535
for _, o := range opts {
533536
o(&options)

table/table.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,24 @@ type Client interface {
3939
// Best effort policy may be implements with outer retry loop includes CreateSession call
4040
CreateSession(ctx context.Context, opts ...Option) (s ClosableSession, err error)
4141

42-
// Do provide the best effort for execute operation
42+
// Do provide the best effort for execute operation.
43+
//
4344
// Do implements internal busy loop until one of the following conditions is met:
4445
// - deadline was canceled or deadlined
4546
// - retry operation returned nil as error
46-
// Warning: if context without deadline or cancellation func than Do can run indefinitely
47+
//
48+
// Warning: if context without deadline or cancellation func than Do can run indefinitely.
4749
Do(ctx context.Context, op Operation, opts ...Option) error
4850

49-
// DoTx provide the best effort for execute transaction
51+
// DoTx provide the best effort for execute transaction.
52+
//
5053
// DoTx implements internal busy loop until one of the following conditions is met:
5154
// - deadline was canceled or deadlined
5255
// - retry operation returned nil as error
53-
// DoTx makes auto begin, commit and rollback of transaction
56+
//
57+
// DoTx makes auto begin (with TxSettings, by default - SerializableReadWrite), commit and
58+
// rollback (on error) of transaction.
59+
//
5460
// If op TxOperation returns nil - transaction will be committed
5561
// If op TxOperation return non nil - transaction will be rollback
5662
// Warning: if context without deadline or cancellation func than DoTx can run indefinitely

0 commit comments

Comments
 (0)