1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-18727 improve DML operation of System Versioning

MDEV-18957 UPDATE with LIMIT clause is wrong for versioned partitioned tables

UPDATE, DELETE: replace linear search of current/historical records
with vers_setup_conds().

Additional DML cases in view.test
This commit is contained in:
Aleksey Midenkov
2019-11-22 14:29:03 +03:00
parent a14544260c
commit 0076dce2c8
19 changed files with 271 additions and 87 deletions

View File

@ -878,11 +878,6 @@ update_begin:
THD_STAGE_INFO(thd, stage_updating);
while (!(error=info.read_record()) && !thd->killed)
{
if (table->versioned() && !table->vers_end_field()->is_max())
{
continue;
}
explain->tracker.on_record_read();
thd->inc_examined_row_count(1);
if (!select || select->skip_record(thd) > 0)
@ -1266,6 +1261,21 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
thd->lex->allow_sum_func.clear_all();
/* 10.4:
if (table_list->has_period() &&
select_lex->period_setup_conds(thd, table_list))
DBUG_RETURN(true);
*/
DBUG_ASSERT(table_list->table);
// conds could be cached from previous SP call
DBUG_ASSERT(!table_list->vers_conditions.is_set() ||
!*conds || thd->stmt_arena->is_stmt_execute());
if (select_lex->vers_setup_conds(thd, table_list))
DBUG_RETURN(TRUE);
*conds= select_lex->where;
/*
We do not call DT_MERGE_FOR_INSERT because it has no sense for simple
(not multi-) update
@ -1786,6 +1796,9 @@ bool mysql_multi_update(THD *thd, TABLE_LIST *table_list, List<Item> *fields,
thd->abort_on_warning= !ignore && thd->is_strict_mode();
List<Item> total_list;
if (select_lex->vers_setup_conds(thd, table_list))
DBUG_RETURN(1);
res= mysql_select(thd,
table_list, select_lex->with_wild, total_list, conds,
select_lex->order_list.elements,
@ -2345,11 +2358,6 @@ int multi_update::send_data(List<Item> &not_used_values)
if (table->status & (STATUS_NULL_ROW | STATUS_UPDATED))
continue;
if (table->versioned() && !table->vers_end_field()->is_max())
{
continue;
}
if (table == table_to_update)
{
/*