mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
manually merged
This commit is contained in:
@ -117,7 +117,7 @@ int mysql_update(THD *thd,
|
||||
{
|
||||
bool using_limit= limit != HA_POS_ERROR;
|
||||
bool safe_update= thd->options & OPTION_SAFE_UPDATES;
|
||||
bool used_key_is_modified, transactional_table, log_delayed;
|
||||
bool used_key_is_modified, transactional_table;
|
||||
int res;
|
||||
int error=0;
|
||||
uint used_index;
|
||||
@ -471,7 +471,6 @@ int mysql_update(THD *thd,
|
||||
query_cache_invalidate3(thd, table_list, 1);
|
||||
}
|
||||
|
||||
log_delayed= (transactional_table || table->s->tmp_table);
|
||||
if ((updated || (error < 0)) && (error <= 0 || !transactional_table))
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
@ -479,11 +478,11 @@ int mysql_update(THD *thd,
|
||||
if (error <= 0)
|
||||
thd->clear_error();
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
log_delayed, FALSE);
|
||||
transactional_table, FALSE);
|
||||
if (mysql_bin_log.write(&qinfo) && transactional_table)
|
||||
error=1; // Rollback update
|
||||
}
|
||||
if (!log_delayed)
|
||||
if (!transactional_table)
|
||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
||||
}
|
||||
if (transactional_table)
|
||||
@ -1002,7 +1001,6 @@ multi_update::initialize_tables(JOIN *join)
|
||||
DBUG_RETURN(1);
|
||||
main_table=join->join_tab->table;
|
||||
trans_safe= transactional_tables= main_table->file->has_transactions();
|
||||
log_delayed= trans_safe || main_table->s->tmp_table != NO_TMP_TABLE;
|
||||
table_to_update= 0;
|
||||
|
||||
/* Create a temporary table for keys to all tables, except main table */
|
||||
@ -1337,17 +1335,13 @@ int multi_update::do_updates(bool from_send_error)
|
||||
goto err;
|
||||
}
|
||||
updated++;
|
||||
if (table->s->tmp_table != NO_TMP_TABLE)
|
||||
log_delayed= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (updated != org_updated)
|
||||
{
|
||||
if (table->s->tmp_table != NO_TMP_TABLE)
|
||||
log_delayed= 1; // Tmp tables forces delay log
|
||||
if (table->file->has_transactions())
|
||||
log_delayed= transactional_tables= 1;
|
||||
transactional_tables= 1;
|
||||
else
|
||||
trans_safe= 0; // Can't do safe rollback
|
||||
}
|
||||
@ -1368,10 +1362,8 @@ err:
|
||||
|
||||
if (updated != org_updated)
|
||||
{
|
||||
if (table->s->tmp_table != NO_TMP_TABLE)
|
||||
log_delayed= 1;
|
||||
if (table->file->has_transactions())
|
||||
log_delayed= transactional_tables= 1;
|
||||
transactional_tables= 1;
|
||||
else
|
||||
trans_safe= 0;
|
||||
}
|
||||
@ -1413,11 +1405,11 @@ bool multi_update::send_eof()
|
||||
if (local_error <= 0)
|
||||
thd->clear_error();
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
log_delayed, FALSE);
|
||||
transactional_tables, FALSE);
|
||||
if (mysql_bin_log.write(&qinfo) && trans_safe)
|
||||
local_error= 1; // Rollback update
|
||||
}
|
||||
if (!log_delayed)
|
||||
if (!transactional_tables)
|
||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user