diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-12-15 13:59:38 +0530 |
---|---|---|
committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-12-28 16:59:29 +0530 |
commit | fad1d15326651a92895c799829ff66edc37fc20f (patch) | |
tree | 42ec5b7784677b579b7655afaaaa880af270551f /sql | |
parent | 4daf9d7c3ee05baf7643f3a866e6d3828e1bb93b (diff) | |
download | mariadb-git-fad1d15326651a92895c799829ff66edc37fc20f.tar.gz |
MDEV-25460: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())'
failed in Diagnostics_area::set_ok_status in my_ok from
mysql_sql_stmt_prepare
Analysis: Before PREPARE is executed, binlog_format is STATEMENT.
This PREPARE had SET STATEMENT which sets binlog_format to ROW. Now after
PREPARE is done we reset the binlog_format (back to STATEMENT). But we have
temporary table, it doesn't let changing binlog_format=ROW to
binlog_format=STATEMENT and gives error which goes unreported. This
unreported error eventually causes assertion failure.
Fix: Change return type for LEX::restore_set_statement_var() to bool and
make it return error state.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_lex.cc | 7 | ||||
-rw-r--r-- | sql/sql_lex.h | 2 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index ed0b4b36553..125bbfe1bfd 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -4766,18 +4766,19 @@ void LEX::free_arena_for_set_stmt() DBUG_VOID_RETURN; } -void LEX::restore_set_statement_var() +bool LEX::restore_set_statement_var() { + bool err= false; DBUG_ENTER("LEX::restore_set_statement_var"); if (!old_var_list.is_empty()) { DBUG_PRINT("info", ("vars: %d", old_var_list.elements)); - sql_set_variables(thd, &old_var_list, false); + err= sql_set_variables(thd, &old_var_list, false); old_var_list.empty(); free_arena_for_set_stmt(); } DBUG_ASSERT(!is_arena_for_set_stmt()); - DBUG_VOID_RETURN; + DBUG_RETURN(err); } /* diff --git a/sql/sql_lex.h b/sql/sql_lex.h index bdf52e8ef7b..5585a95f67f 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -3094,7 +3094,7 @@ public: int print_explain(select_result_sink *output, uint8 explain_flags, bool is_analyze, bool *printed_anything); - void restore_set_statement_var(); + bool restore_set_statement_var(); void init_last_field(Column_definition *field, const char *name, CHARSET_INFO *cs); void set_last_field_type(const Lex_field_type_st &type); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 9339cb925e5..bb1a99d9eef 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -4283,7 +4283,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) Restore original values of variables modified on handling SET STATEMENT clause. */ - thd->lex->restore_set_statement_var(); + error|= thd->lex->restore_set_statement_var(); /* The order is important */ lex->unit.cleanup(); |