lua: gracefully fail space on/before replace trigger if txn was aborted
lbox_push_event_f and lbox_push_event_f callback functions used for passing the statement between txn and space on/before replace Lua triggers don't assume that the transaction may be aborted by yield after the current statement began (this may happen if a trigger callback yields). In this case, all statements in txn would be rolled back and txn_current_stmt would return NULL, leading to a crash. Let's fix this by checking if the transaction is still active and raising an error immediately if it isn't, thus skipping Lua triggers. Notes: - We merged lbox_pop_txn_stmt_and_check_format into lbox_pop_txn_stmt, because the latter is only called by the former. - Since lbox_push_event_f callback may now fail, we have to update lbox_trigger_run to handle it. Closes #8027 NO_DOC=bug fix (cherry picked from commit 1a678a5e)
Showing
- changelogs/unreleased/gh-8027-txn-handle-abort-in-trigger.md 5 additions, 0 deletionschangelogs/unreleased/gh-8027-txn-handle-abort-in-trigger.md
- src/box/lua/space.cc 38 additions, 26 deletionssrc/box/lua/space.cc
- src/lua/trigger.c 11 additions, 9 deletionssrc/lua/trigger.c
- src/lua/trigger.h 4 additions, 2 deletionssrc/lua/trigger.h
- test/box-luatest/gh_8027_txn_handle_abort_in_trigger_test.lua 92 additions, 0 deletions.../box-luatest/gh_8027_txn_handle_abort_in_trigger_test.lua
Loading
Please register or sign in to comment