[Commits] Rev 4153: MDEV-5138 Numerous test failures in "mtr --ps --embedded". in file:///home/hf/wmar/mdev-5138-2/

holyfoot at askmonty.org holyfoot at askmonty.org
Tue Apr 15 17:36:48 EEST 2014

At file:///home/hf/wmar/mdev-5138-2/

revno: 4153
revision-id: holyfoot at askmonty.org-20140415131747-zjhgef1h9vp2rczl
parent: holyfoot at askmonty.org-20140415131647-nnde8b059g1r2zgi
committer: Alexey Botchkov <holyfoot at askmonty.org>
branch nick: mdev-5138-2
timestamp: Tue 2014-04-15 18:17:47 +0500
  MDEV-5138 Numerous test failures in "mtr --ps --embedded".
       If a prepared statement calls an stored procedure,
       the thd->server_status out of the SP goes up
       to the PS and then to the client. So that the
       client gets the SERVER_STATUS_CURSOR_EXISTS status
       if the SP uses a cursor. Which makes the embedded
       server fail.
       Fixed by saving/restoring the upper-level server_status
       in sp_head::execute().
-------------- next part --------------
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2014-03-17 12:04:28 +0000
+++ b/sql/sp_head.cc	2014-04-15 13:17:47 +0000
@@ -1223,6 +1223,7 @@ sp_head::execute(THD *thd, bool merge_da
   LEX *old_lex;
   Item_change_list old_change_list;
   String old_packet;
+  uint old_server_status;
   Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
   Object_creation_ctx *saved_creation_ctx;
   Warning_info *saved_warning_info;
@@ -1357,6 +1358,7 @@ sp_head::execute(THD *thd, bool merge_da
     It is probably safe to use same thd->convert_buff everywhere.
+  old_server_status= thd->server_status;
     Switch to per-instruction arena here. We can do it since we cleanup
@@ -1486,6 +1488,7 @@ sp_head::execute(THD *thd, bool merge_da
   thd->spcont->pop_all_cursors(); // To avoid memory leaks after an error
   /* Restore all saved */
+  thd->server_status= old_server_status;

More information about the commits mailing list