Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Managing Transactions #163

Open
enescaglar opened this issue Aug 3, 2020 · 5 comments
Open

Managing Transactions #163

enescaglar opened this issue Aug 3, 2020 · 5 comments
Labels
8sp feature A new functionality

Comments

@enescaglar
Copy link

Hi,

Is there a way to manage transactions through the library?

In tarantool, transaction is started with box.begin() and committed with box.commit() functions. But I couldn't find any methods in the library to manage the transactions.

What I would like to do is, begin a transaction, make updates/inserts to a space and then commit the transaction.

I tried adding some functions like below and calling these functions from the library, but it didn't work.

function begin_transaction(dummy)
box.begin()
end

function commit_transaction(dummy)
box.commit()
end

Thank you.

@olegrok
Copy link
Contributor

olegrok commented Aug 3, 2020

Hi!
Tarantool doesn't have interactive transactions (tarantool/tarantool#2016)

You should call box.begin() and box.commit() inside one tarantool event loop iteration. Also you couldn't yield inside transactions. There is only one way to insert/update/... data transactionally from connector - write stored procedure with transaction inside and call it.

So, you can read more about transaction management in Tarantool in our documentation https://www.tarantool.io/en/doc/2.5/book/box/atomic/

@olegrok olegrok added the question Further information is requested label Aug 3, 2020
@Totktonada Totktonada added blocked Not ready to be implemented feature A new functionality and removed question Further information is requested labels Aug 3, 2020
@Totktonada
Copy link
Member

I'll left the issue open as the feature requested blocked on the corresponding tarantool functionality.

@enescaglar
Copy link
Author

Thank you for the answer.

There is only one way to insert/update/... data transactionally from connector - write stored procedure with transaction inside and call it.

I was trying to implement such solution and stuck with this #162
Do you have any idea on this? Sample codes inside the documentation are somewhat limited and I couldn't figure out how to call a function with a list input.

Thank you.

@Totktonada
Copy link
Member

I was trying to implement such solution and stuck with this #162

Answered, discussed and resolved :)

@Totktonada
Copy link
Member

tarantool/tarantool#2016 is implemented now, the issue is not blocked anymore.

@Totktonada Totktonada added 8sp and removed blocked Not ready to be implemented labels Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8sp feature A new functionality
Projects
None yet
Development

No branches or pull requests

5 participants