mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-17610 Unexpected connection abort after certain operations from
within stored procedure Always set SERVER_MORE_RESULTS_EXIST when executing stored procedure. statements If statements produce a result, EOF packet needs this flag (SP ends with an OK packet). IF statetement does not produce a result, affected rows count are part of the final OK packet.
This commit is contained in:
@ -7635,6 +7635,22 @@ c1 c2 count(c3)
|
|||||||
2012-03-01 02:00:00 3 1
|
2012-03-01 02:00:00 3 1
|
||||||
DROP PROCEDURE p1;
|
DROP PROCEDURE p1;
|
||||||
# End of 5.5 test
|
# End of 5.5 test
|
||||||
|
CREATE PROCEDURE sp() ALTER TABLE non_existing_table OPTIMIZE PARTITION p0;
|
||||||
|
CALL sp;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.non_existing_table optimize Error Table 'test.non_existing_table' doesn't exist
|
||||||
|
test.non_existing_table optimize status Operation failed
|
||||||
|
SELECT 1;
|
||||||
|
1
|
||||||
|
1
|
||||||
|
DROP PROCEDURE sp;
|
||||||
|
CREATE PROCEDURE sp() SHOW USER_STATISTICS;
|
||||||
|
CALL sp;
|
||||||
|
User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_read Rows_sent Rows_deleted Rows_inserted Rows_updated Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries Total_ssl_connections Max_statement_time_exceeded
|
||||||
|
SELECT 1;
|
||||||
|
1
|
||||||
|
1
|
||||||
|
DROP PROCEDURE sp;
|
||||||
#
|
#
|
||||||
# Bug#12663165 SP DEAD CODE REMOVAL DOESN'T UNDERSTAND CONTINUE HANDLERS
|
# Bug#12663165 SP DEAD CODE REMOVAL DOESN'T UNDERSTAND CONTINUE HANDLERS
|
||||||
#
|
#
|
||||||
|
@ -9073,6 +9073,15 @@ DROP PROCEDURE p1;
|
|||||||
|
|
||||||
--echo # End of 5.5 test
|
--echo # End of 5.5 test
|
||||||
|
|
||||||
|
#MDEV-17610
|
||||||
|
CREATE PROCEDURE sp() ALTER TABLE non_existing_table OPTIMIZE PARTITION p0;
|
||||||
|
CALL sp;
|
||||||
|
SELECT 1;
|
||||||
|
DROP PROCEDURE sp;
|
||||||
|
CREATE PROCEDURE sp() SHOW USER_STATISTICS;
|
||||||
|
CALL sp;
|
||||||
|
SELECT 1;
|
||||||
|
DROP PROCEDURE sp;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Bug#12663165 SP DEAD CODE REMOVAL DOESN'T UNDERSTAND CONTINUE HANDLERS
|
--echo # Bug#12663165 SP DEAD CODE REMOVAL DOESN'T UNDERSTAND CONTINUE HANDLERS
|
||||||
|
@ -243,6 +243,7 @@ sp_get_flags_for_command(LEX *lex)
|
|||||||
case SQLCOM_SHOW_EXPLAIN:
|
case SQLCOM_SHOW_EXPLAIN:
|
||||||
case SQLCOM_SHOW_FIELDS:
|
case SQLCOM_SHOW_FIELDS:
|
||||||
case SQLCOM_SHOW_FUNC_CODE:
|
case SQLCOM_SHOW_FUNC_CODE:
|
||||||
|
case SQLCOM_SHOW_GENERIC:
|
||||||
case SQLCOM_SHOW_GRANTS:
|
case SQLCOM_SHOW_GRANTS:
|
||||||
case SQLCOM_SHOW_ENGINE_STATUS:
|
case SQLCOM_SHOW_ENGINE_STATUS:
|
||||||
case SQLCOM_SHOW_ENGINE_LOGS:
|
case SQLCOM_SHOW_ENGINE_LOGS:
|
||||||
|
@ -2442,15 +2442,14 @@ static bool do_execute_sp(THD *thd, sp_head *sp)
|
|||||||
my_error(ER_SP_BADSELECT, MYF(0), sp->m_qname.str);
|
my_error(ER_SP_BADSELECT, MYF(0), sp->m_qname.str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
If SERVER_MORE_RESULTS_EXISTS is not set,
|
|
||||||
then remember that it should be cleared
|
|
||||||
*/
|
|
||||||
bits_to_be_cleared= (~thd->server_status &
|
|
||||||
SERVER_MORE_RESULTS_EXISTS);
|
|
||||||
thd->server_status|= SERVER_MORE_RESULTS_EXISTS;
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
If SERVER_MORE_RESULTS_EXISTS is not set,
|
||||||
|
then remember that it should be cleared
|
||||||
|
*/
|
||||||
|
bits_to_be_cleared= (~thd->server_status &
|
||||||
|
SERVER_MORE_RESULTS_EXISTS);
|
||||||
|
thd->server_status|= SERVER_MORE_RESULTS_EXISTS;
|
||||||
ha_rows select_limit= thd->variables.select_limit;
|
ha_rows select_limit= thd->variables.select_limit;
|
||||||
thd->variables.select_limit= HA_POS_ERROR;
|
thd->variables.select_limit= HA_POS_ERROR;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user