mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge next-mr -> next-4284.
This commit is contained in:
@ -793,6 +793,9 @@ int mysql_update(THD *thd,
|
||||
{
|
||||
query_cache_invalidate3(thd, table_list, 1);
|
||||
}
|
||||
|
||||
if (thd->transaction.stmt.modified_non_trans_table)
|
||||
thd->transaction.all.modified_non_trans_table= TRUE;
|
||||
|
||||
/*
|
||||
error < 0 means really no error at all: we processed all rows until the
|
||||
@ -815,13 +818,11 @@ int mysql_update(THD *thd,
|
||||
|
||||
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
|
||||
thd->query(), thd->query_length(),
|
||||
transactional_table, FALSE, errcode))
|
||||
transactional_table, FALSE, FALSE, errcode))
|
||||
{
|
||||
error=1; // Rollback update
|
||||
}
|
||||
}
|
||||
if (thd->transaction.stmt.modified_non_trans_table)
|
||||
thd->transaction.all.modified_non_trans_table= TRUE;
|
||||
}
|
||||
DBUG_ASSERT(transactional_table || !updated || thd->transaction.stmt.modified_non_trans_table);
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
@ -885,19 +886,6 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
|
||||
SELECT_LEX *select_lex= &thd->lex->select_lex;
|
||||
DBUG_ENTER("mysql_prepare_update");
|
||||
|
||||
/*
|
||||
Statement-based replication of UPDATE ... LIMIT is not safe as order of
|
||||
rows is not defined, so in mixed mode we go to row-based.
|
||||
|
||||
Note that we may consider a statement as safe if ORDER BY primary_key
|
||||
is present. However it may confuse users to see very similiar statements
|
||||
replicated differently.
|
||||
*/
|
||||
if (thd->lex->current_select->select_limit)
|
||||
{
|
||||
thd->lex->set_stmt_unsafe();
|
||||
thd->set_current_stmt_binlog_row_based_if_mixed();
|
||||
}
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
table_list->grant.want_privilege= table->grant.want_privilege=
|
||||
(SELECT_ACL & ~table->grant.privilege);
|
||||
@ -1763,10 +1751,10 @@ bool multi_update::send_data(List<Item> ¬_used_values)
|
||||
/* non-transactional or transactional table got modified */
|
||||
/* either multi_update class' flag is raised in its branch */
|
||||
if (table->file->has_transactions())
|
||||
transactional_tables= 1;
|
||||
transactional_tables= TRUE;
|
||||
else
|
||||
{
|
||||
trans_safe= 0;
|
||||
trans_safe= FALSE;
|
||||
thd->transaction.stmt.modified_non_trans_table= TRUE;
|
||||
}
|
||||
}
|
||||
@ -1874,10 +1862,9 @@ void multi_update::abort()
|
||||
into repl event.
|
||||
*/
|
||||
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
|
||||
/* the error of binary logging is ignored */
|
||||
(void)thd->binlog_query(THD::ROW_QUERY_TYPE,
|
||||
thd->query(), thd->query_length(),
|
||||
transactional_tables, FALSE, errcode);
|
||||
thd->query(), thd->query_length(),
|
||||
transactional_tables, FALSE, FALSE, errcode);
|
||||
}
|
||||
thd->transaction.all.modified_non_trans_table= TRUE;
|
||||
}
|
||||
@ -2015,10 +2002,10 @@ int multi_update::do_updates()
|
||||
if (updated != org_updated)
|
||||
{
|
||||
if (table->file->has_transactions())
|
||||
transactional_tables= 1;
|
||||
transactional_tables= TRUE;
|
||||
else
|
||||
{
|
||||
trans_safe= 0; // Can't do safe rollback
|
||||
trans_safe= FALSE; // Can't do safe rollback
|
||||
thd->transaction.stmt.modified_non_trans_table= TRUE;
|
||||
}
|
||||
}
|
||||
@ -2047,10 +2034,10 @@ err2:
|
||||
if (updated != org_updated)
|
||||
{
|
||||
if (table->file->has_transactions())
|
||||
transactional_tables= 1;
|
||||
transactional_tables= TRUE;
|
||||
else
|
||||
{
|
||||
trans_safe= 0;
|
||||
trans_safe= FALSE;
|
||||
thd->transaction.stmt.modified_non_trans_table= TRUE;
|
||||
}
|
||||
}
|
||||
@ -2096,8 +2083,9 @@ bool multi_update::send_eof()
|
||||
either from the query's list or via a stored routine: bug#13270,23333
|
||||
*/
|
||||
|
||||
DBUG_ASSERT(trans_safe || !updated ||
|
||||
thd->transaction.stmt.modified_non_trans_table);
|
||||
if (thd->transaction.stmt.modified_non_trans_table)
|
||||
thd->transaction.all.modified_non_trans_table= TRUE;
|
||||
|
||||
if (local_error == 0 || thd->transaction.stmt.modified_non_trans_table)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
@ -2109,14 +2097,15 @@ bool multi_update::send_eof()
|
||||
errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
|
||||
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
|
||||
thd->query(), thd->query_length(),
|
||||
transactional_tables, FALSE, errcode))
|
||||
transactional_tables, FALSE, FALSE, errcode))
|
||||
{
|
||||
local_error= 1; // Rollback update
|
||||
}
|
||||
}
|
||||
if (thd->transaction.stmt.modified_non_trans_table)
|
||||
thd->transaction.all.modified_non_trans_table= TRUE;
|
||||
}
|
||||
DBUG_ASSERT(trans_safe || !updated ||
|
||||
thd->transaction.stmt.modified_non_trans_table);
|
||||
|
||||
if (local_error != 0)
|
||||
error_handled= TRUE; // to force early leave from ::send_error()
|
||||
|
||||
|
Reference in New Issue
Block a user