1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Bug#20094067: BACKPORT BUG#19683834 TO 5.5 AND 5.6

Backporting the patch and the test case fixed as part
of BUG#16041903 and BUG#19683834 respectively.
This commit is contained in:
Nisha Gopalakrishnan
2015-01-27 13:13:55 +05:30
parent 7a408dbdf4
commit aa1de73728
7 changed files with 335 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -815,7 +815,7 @@ THD::THD()
stmt_da(&main_da),
is_fatal_error(0),
transaction_rollback_request(0),
is_fatal_sub_stmt_error(0),
is_fatal_sub_stmt_error(false),
rand_used(0),
time_zone_used(0),
in_lock_tables(0),
@@ -3679,7 +3679,8 @@ extern "C" int thd_binlog_format(const MYSQL_THD thd)
extern "C" void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all)
{
mark_transaction_to_rollback(thd, all);
DBUG_ASSERT(thd);
thd->mark_transaction_to_rollback(all);
}
extern "C" bool thd_binlog_filter_ok(const MYSQL_THD thd)
@@ -3873,9 +3874,12 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
If we've left sub-statement mode, reset the fatal error flag.
Otherwise keep the current value, to propagate it up the sub-statement
stack.
NOTE: is_fatal_sub_stmt_error can be set only if we've been in the
sub-statement mode.
*/
if (!in_sub_stmt)
is_fatal_sub_stmt_error= FALSE;
is_fatal_sub_stmt_error= false;
if ((variables.option_bits & OPTION_BIN_LOG) && is_update_query(lex->sql_command) &&
!is_current_stmt_binlog_format_row())
@@ -3988,27 +3992,28 @@ void THD::get_definer(LEX_USER *definer)
/**
Mark transaction to rollback and mark error as fatal to a sub-statement.
@param thd Thread handle
@param all TRUE <=> rollback main transaction.
*/
void mark_transaction_to_rollback(THD *thd, bool all)
void THD::mark_transaction_to_rollback(bool all)
{
if (thd)
{
thd->is_fatal_sub_stmt_error= TRUE;
thd->transaction_rollback_request= all;
/*
Aborted transactions can not be IGNOREd.
Switch off the IGNORE flag for the current
SELECT_LEX. This should allow my_error()
to report the error and abort the execution
flow, even in presence
of IGNORE clause.
*/
if (thd->lex->current_select)
thd->lex->current_select->no_error= FALSE;
}
/*
There is no point in setting is_fatal_sub_stmt_error unless
we are actually in_sub_stmt.
*/
if (in_sub_stmt)
is_fatal_sub_stmt_error= true;
transaction_rollback_request= all;
/*
Aborted transactions can not be IGNOREd.
Switch off the IGNORE flag for the current
SELECT_LEX. This should allow my_error()
to report the error and abort the execution
flow, even in presence
of IGNORE clause.
*/
if (lex->current_select)
lex->current_select->no_error= false;
}
/***************************************************************************
Handling of XA id cacheing