Skip to content

Commit 05bc129

Browse files
authored
Merge pull request #1731 from ydb-platform/auto-tx
Added `query.EmptyTxControl()` + Marked as deprecated `query.NoTx()`
2 parents 3b878aa + c15805d commit 05bc129

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
* Added `query.EmptyTxControl()` for empty transaction control (server-side defines transaction control by internal logic)
2+
* Marked as deprecated `query.NoTx()` because this is wrong name for server-side transaction control inference
3+
14
## v3.107.0
25
* Refactored internal client balancer: added singleton for getting gRPC-connection (auto dial and auto reconnect on non-ready state) for use in discovery attempts
36
* Added `topicoptions.IncludePartitionStats()` for `Topic().Describe()` in order to get partition stats from server

query/transaction.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,23 @@ func TxControl(opts ...tx.ControlOption) *TransactionControl {
4646
return tx.NewControl(opts...)
4747
}
4848

49-
func NoTx() *TransactionControl {
49+
// EmptyTxControl defines transaction control inference on server-side by query content
50+
func EmptyTxControl() *TransactionControl {
5051
return nil
5152
}
5253

54+
// NoTx defines nil transaction control
55+
// This is wrong name for transaction control inference on server-side by query content
56+
// Deprecated: Use EmptyTxControl instead.
57+
// Will be removed after Oct 2025.
58+
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
59+
func NoTx() *TransactionControl {
60+
return EmptyTxControl()
61+
}
62+
5363
// DefaultTxControl returns default transaction control for use default tx control on server-side
5464
func DefaultTxControl() *TransactionControl {
55-
return NoTx()
65+
return EmptyTxControl()
5666
}
5767

5868
// SerializableReadWriteTxControl returns transaction control with serializable read-write isolation mode

tests/slo/native/query/storage.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (s *Storage) CreateTable(ctx context.Context) error {
216216
fmt.Sprintf(createTableQuery, s.tablePath, s.cfg.MinPartitionsCount, s.cfg.PartitionSize,
217217
s.cfg.MinPartitionsCount, s.cfg.MaxPartitionsCount,
218218
),
219-
query.WithTxControl(query.NoTx()),
219+
query.WithTxControl(query.EmptyTxControl()),
220220
)
221221
}, query.WithIdempotent(),
222222
query.WithLabel("CREATE TABLE"),
@@ -235,7 +235,7 @@ func (s *Storage) DropTable(ctx context.Context) error {
235235
func(ctx context.Context, session query.Session) error {
236236
return session.Exec(ctx,
237237
fmt.Sprintf(dropTableQuery, s.tablePath),
238-
query.WithTxControl(query.NoTx()),
238+
query.WithTxControl(query.EmptyTxControl()),
239239
)
240240
},
241241
query.WithIdempotent(),

0 commit comments

Comments
 (0)