Skip to content

add interactive transaction support in net.box #2311

Closed
@TarantoolBot

Description

@TarantoolBot

Product: Tarantool
Since: 2.10.0-beta1
Root document: https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/
SME: @ alyapunov

Details

Implement begin, commit and rollback methods for stream object
in net.box, which allows to begin, commit and rollback transaction
accordingly. Now there are multiple ways to begin, commit and rollback
transaction from net.box: using appropriate stream methods, using 'callor 'eval' methods or usingexecutemethod with sql transaction syntax. User can mix these methods, for example, start transaction usingstream:begin(), and commit transaction using stream:call('box.commit')`
or stream:execute('COMMIT').
Simple example of using interactive transactions via iproto from net.box:

stream = conn:new_stream()
space = stream.space.test
space_not_from_stream = conn.space.test

stream:begin()
space:replace({1})
-- return previously inserted tuple, because request
-- belongs to transaction.
space:select({})
-- empty select, because select doesn't belongs to
-- transaction
space_not_from_stream:select({})
stream:call('box.commit')
-- now transaction was commited, so all requests
-- returns tuple.

Different examples of using streams you can find in
gh-5860-implement-streams-in-iproto.test.lua (https://github.com/tarantool/tarantool/blob/master/test/box/net.box_iproto_transactions_over_streams.test.lua)
Requested by @EvgenyMekhanik in tarantool/tarantool@f9ca802.

Related to #2308 and #2310

Metadata

Metadata

Assignees

Labels

featureA new functionalityreference[location] Tarantool manual, Reference partserver[area] Task relates to Tarantool's server (core) functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions