← Back to team overview

maria-developers team mailing list archive

Re: [Commits] Rev 4271: MDEV-6601 Assertion `!thd->in_active_multi_stmt_transa ction() || thd->in_multi_stmt_transaction_mode()' failed on executing a stored procedure with commit in lp:~maria-captains/maria/5.5

 

Hi, Sergei.

I'd add SERVER_STATUS_LAST_ROW_SENT to the status_backup_mask.
It's not necessary as I don't see it affecting anything, but just to make a sign that we don't
want this status to go higher out of the call.

Best regards.
HF


25.08.2014 10:49, Sergei Golubchik wrote:
At lp:~maria-captains/maria/5.5

------------------------------------------------------------
revno: 4271
revision-id: sergii@xxxxxxxxx-20140825064904-h8isjhv963kbxlzy
parent: knielsen@xxxxxxxxxxxxxxx-20140813134639-wk760plnzg5wu4x8
fixes bug: https://mariadb.atlassian.net/browse/MDEV-6601
committer: Sergei Golubchik <sergii@xxxxxxxxx>
branch nick: 5.5
timestamp: Mon 2014-08-25 08:49:04 +0200
message:
   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, as --ps --embedded needs.
   In particular, don't restore SERVER_STATUS_IN_TRANS.
=== modified file 'mysql-test/r/sp-bugs.result'
--- a/mysql-test/r/sp-bugs.result	2014-01-24 12:50:18 +0000
+++ b/mysql-test/r/sp-bugs.result	2014-08-25 06:49:04 +0000
@@ -268,3 +268,9 @@ END $$
  CALL test_5531(1);
  DROP PROCEDURE test_5531;
  DROP TABLE t1;
+create procedure sp() begin
+commit;
+end|
+start transaction;
+call sp();
+drop procedure sp;

=== modified file 'mysql-test/t/sp-bugs.test'
--- a/mysql-test/t/sp-bugs.test	2014-01-24 12:50:18 +0000
+++ b/mysql-test/t/sp-bugs.test	2014-08-25 06:49:04 +0000
@@ -285,3 +285,16 @@ DELIMITER ;$$
  CALL test_5531(1);
  DROP PROCEDURE test_5531;
  DROP TABLE t1;
+
+#
+# MDEV-6601 Assertion `!thd->in_active_multi_stmt_transa ction() || thd->in_multi_stmt_transaction_mode()' failed on executing a stored procedure with commit
+#
+delimiter |;
+create procedure sp() begin
+  commit;
+end|
+delimiter ;|
+start transaction;
+call sp();
+drop procedure sp;
+

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2014-04-15 13:17:47 +0000
+++ b/sql/sp_head.cc	2014-08-25 06:49:04 +0000
@@ -1224,6 +1224,7 @@ sp_head::execute(THD *thd, bool merge_da
    Item_change_list old_change_list;
    String old_packet;
    uint old_server_status;
+  const uint status_backup_mask= SERVER_STATUS_CURSOR_EXISTS;
    Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
    Object_creation_ctx *saved_creation_ctx;
    Warning_info *saved_warning_info;
@@ -1358,7 +1359,7 @@ sp_head::execute(THD *thd, bool merge_da
      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 +1489,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;
+  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);

_______________________________________________
commits mailing list
commits@xxxxxxxxxxx
https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits