summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-08-25 16:58:19 +0200
committerSergei Golubchik <sergii@pisem.net>2014-08-25 16:58:19 +0200
commitdd25e7f0ad002c79a8d9768f9d824e79800fb88d (patch)
tree20bed7cff87d1b29180899b5b76196b133a15c06 /sql/sp_head.cc
parent5569132ffebba3fd2e37964543f658ed24d8caaf (diff)
downloadmariadb-git-dd25e7f0ad002c79a8d9768f9d824e79800fb88d.tar.gz
MDEV-6601 Assertion `!thd->in_active_multi_stmt_transa ction() || thd->in_multi_stmt_transaction_mode()' failed on executing a stored procedure with commit
Don't restore the whole of thd->server_status after a routine invocation, only restore SERVER_STATUS_CURSOR_EXISTS and SERVER_STATUS_LAST_ROW_SENT, as --ps --embedded needs. In particular, don't restore SERVER_STATUS_IN_TRANS.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 3272e29389b..2cd627a2a32 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1224,6 +1224,8 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
Item_change_list old_change_list;
String old_packet;
uint old_server_status;
+ const uint status_backup_mask= SERVER_STATUS_CURSOR_EXISTS |
+ SERVER_STATUS_LAST_ROW_SENT;
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
Object_creation_ctx *saved_creation_ctx;
Warning_info *saved_warning_info;
@@ -1358,7 +1360,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
It is probably safe to use same thd->convert_buff everywhere.
*/
old_packet.swap(thd->packet);
- old_server_status= thd->server_status;
+ old_server_status= thd->server_status & status_backup_mask;
/*
Switch to per-instruction arena here. We can do it since we cleanup
@@ -1488,7 +1490,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
thd->spcont->pop_all_cursors(); // To avoid memory leaks after an error
/* Restore all saved */
- thd->server_status= old_server_status;
+ thd->server_status= (thd->server_status & ~status_backup_mask) | old_server_status;
old_packet.swap(thd->packet);
DBUG_ASSERT(thd->change_list.is_empty());
old_change_list.move_elements_to(&thd->change_list);