mirror of
https://github.com/MariaDB/server.git
synced 2026-04-24 09:15:30 +02:00
Better fix for "Halloween" effect ...
This commit is contained in:
parent
40a781a6d6
commit
8a2bd0d4ba
4 changed files with 11 additions and 11 deletions
|
|
@ -82,7 +82,8 @@ class ha_innobase: public handler
|
|||
HA_PRIMARY_KEY_IN_READ_INDEX |
|
||||
HA_DROP_BEFORE_CREATE |
|
||||
HA_NO_PREFIX_CHAR_KEYS |
|
||||
HA_TABLE_SCAN_ON_INDEX),
|
||||
HA_TABLE_SCAN_ON_INDEX |
|
||||
HA_NOT_MULTI_UPDATE),
|
||||
last_dup_key((uint) -1),
|
||||
start_of_scan(0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@
|
|||
#define HA_CAN_FULLTEXT (HA_NO_PREFIX_CHAR_KEYS*2)
|
||||
#define HA_CAN_SQL_HANDLER (HA_CAN_FULLTEXT*2)
|
||||
#define HA_NO_AUTO_INCREMENT (HA_CAN_SQL_HANDLER*2)
|
||||
#define HA_NOT_MULTI_UPDATE (HA_NO_AUTO_INCREMENT*2)
|
||||
|
||||
/*
|
||||
Next record gives next record according last record read (even
|
||||
|
|
|
|||
|
|
@ -823,7 +823,7 @@ class multi_update : public select_result
|
|||
{
|
||||
TABLE_LIST *all_tables, *update_tables, *table_being_updated;
|
||||
THD *thd;
|
||||
TABLE **tmp_tables, *main_table;
|
||||
TABLE **tmp_tables, *main_table, *table_to_update;
|
||||
TMP_TABLE_PARAM *tmp_table_param;
|
||||
ha_rows updated, found;
|
||||
List <Item> *fields, *values;
|
||||
|
|
@ -831,7 +831,7 @@ class multi_update : public select_result
|
|||
uint table_count;
|
||||
Copy_field *copy_field;
|
||||
enum enum_duplicates handle_duplicates;
|
||||
bool do_update, trans_safe, transactional_tables, log_delayed, on_the_fly;
|
||||
bool do_update, trans_safe, transactional_tables, log_delayed;
|
||||
|
||||
public:
|
||||
multi_update(THD *thd_arg, TABLE_LIST *ut, List<Item> *fields,
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ multi_update::multi_update(THD *thd_arg, TABLE_LIST *table_list,
|
|||
:all_tables(table_list), update_tables(0), thd(thd_arg), tmp_tables(0),
|
||||
updated(0), found(0), fields(field_list), values(value_list),
|
||||
table_count(0), copy_field(0), handle_duplicates(handle_duplicates_arg),
|
||||
do_update(1), trans_safe(0), on_the_fly(1)
|
||||
do_update(1), trans_safe(0)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -538,15 +538,13 @@ multi_update::initialize_tables(JOIN *join)
|
|||
main_table=join->join_tab->table;
|
||||
trans_safe= transactional_tables= main_table->file->has_transactions();
|
||||
log_delayed= trans_safe || main_table->tmp_table != NO_TMP_TABLE;
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
if (main_table->db_type == DB_TYPE_INNODB)
|
||||
on_the_fly=0;
|
||||
#endif
|
||||
table_to_update= (main_table->file->table_flags() & HA_NOT_MULTI_UPDATE) ?
|
||||
(TABLE *) 0 : main_table;
|
||||
/* Create a temporary table for all tables after except main table */
|
||||
for (table_ref= update_tables; table_ref; table_ref=table_ref->next)
|
||||
{
|
||||
TABLE *table=table_ref->table;
|
||||
if (!on_the_fly || table != main_table)
|
||||
if (table != table_to_update)
|
||||
{
|
||||
uint cnt= table_ref->shared;
|
||||
ORDER group;
|
||||
|
|
@ -626,7 +624,7 @@ bool multi_update::send_data(List<Item> ¬_used_values)
|
|||
|
||||
uint offset= cur_table->shared;
|
||||
table->file->position(table->record[0]);
|
||||
if (on_the_fly && table == main_table)
|
||||
if (table == table_to_update)
|
||||
{
|
||||
table->status|= STATUS_UPDATED;
|
||||
store_record(table,1);
|
||||
|
|
@ -719,7 +717,7 @@ int multi_update::do_updates(bool from_send_error)
|
|||
for (cur_table= update_tables; cur_table ; cur_table= cur_table->next)
|
||||
{
|
||||
table = cur_table->table;
|
||||
if (on_the_fly && table == main_table)
|
||||
if (table == table_to_update)
|
||||
continue; // Already updated
|
||||
|
||||
org_updated= updated;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue