tx: set session and user for commit/rollback triggers
Commit/rollback triggers are run asynchronously, upon receiving the write status from WAL. We can't run them in the original fiber that submitted the WAL request, because it would open a time window between writing a transaction to WAL and committing it in tx, which could lead to violating the cascading rolback principles. As a result, commit/rollback triggers run with admin privileges. Let's fix this issue by temporarily setting session and credentials to the original fiber's for running commit/rollback triggers. Closes #7005 NO_DOC=bugfix
Showing
- changelogs/unreleased/gh-7005-session-on-commit-rollback.md 4 additions, 0 deletionschangelogs/unreleased/gh-7005-session-on-commit-rollback.md
- src/box/session.h 21 additions, 4 deletionssrc/box/session.h
- src/box/txn.c 17 additions, 0 deletionssrc/box/txn.c
- test/box-luatest/gh_7005_session_on_commit_rollback_test.lua 92 additions, 0 deletionstest/box-luatest/gh_7005_session_on_commit_rollback_test.lua
- test/luatest_helpers/misc.lua 16 additions, 0 deletionstest/luatest_helpers/misc.lua
Loading