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

holyfoot at askmonty.org holyfoot at askmonty.org
Mon Dec 9 05:20:54 EET 2013

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

revno: 3995
revision-id: holyfoot at askmonty.org-20131209020845-9o3l30ao90vzf600
parent: holyfoot at askmonty.org-20131208143921-3veatgg9wngyzb47
committer: Alexey Botchkov <holyfoot at askmonty.org>
branch nick: mdev-5138
timestamp: Mon 2013-12-09 06:08:45 +0400
  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	2013-11-19 12:16:25 +0000
+++ b/sql/sp_head.cc	2013-12-09 02:08:45 +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