mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-20441 ER_CRASHED_ON_USAGE upon update on versioned Aria table
Turn read cache off for update and multi-update for versioned table. no_cache is reinited on each TABLE open because it is applicable for specific algorithms. As a side fix vers_insert_history_row() honors vers_write setting. Aria with row_format=fixed uses IO_CACHE of type READ_CACHE for sequential read in update loop. When history row is inserted inside this loop the cache misses it and fails with error. TODO: Currently maria_extra() does not support SEQ_READ_APPEND. Probably it might be possible to use this type of cache.
This commit is contained in:
@ -184,10 +184,10 @@ static bool check_fields(THD *thd, List<Item> &items, bool update_view)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool check_has_vers_fields(TABLE *table, List<Item> &items)
|
||||
bool TABLE::vers_check_update(List<Item> &items)
|
||||
{
|
||||
List_iterator<Item> it(items);
|
||||
if (!table->versioned())
|
||||
if (!versioned_write())
|
||||
return false;
|
||||
|
||||
while (Item *item= it++)
|
||||
@ -195,8 +195,11 @@ static bool check_has_vers_fields(TABLE *table, List<Item> &items)
|
||||
if (Item_field *item_field= item->field_for_view_update())
|
||||
{
|
||||
Field *field= item_field->field;
|
||||
if (field->table == table && !field->vers_update_unversioned())
|
||||
if (field->table == this && !field->vers_update_unversioned())
|
||||
{
|
||||
no_cache= true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -415,7 +418,7 @@ int mysql_update(THD *thd,
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
bool has_vers_fields= check_has_vers_fields(table, fields);
|
||||
bool has_vers_fields= table->vers_check_update(fields);
|
||||
if (check_key_in_view(thd, table_list))
|
||||
{
|
||||
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias.str, "UPDATE");
|
||||
@ -2133,7 +2136,7 @@ multi_update::initialize_tables(JOIN *join)
|
||||
if (safe_update_on_fly(thd, join->join_tab, table_ref, all_tables))
|
||||
{
|
||||
table_to_update= table; // Update table on the fly
|
||||
has_vers_fields= check_has_vers_fields(table, *fields);
|
||||
has_vers_fields= table->vers_check_update(*fields);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -2609,7 +2612,7 @@ int multi_update::do_updates()
|
||||
if (table->vfield)
|
||||
empty_record(table);
|
||||
|
||||
has_vers_fields= check_has_vers_fields(table, *fields);
|
||||
has_vers_fields= table->vers_check_update(*fields);
|
||||
|
||||
check_opt_it.rewind();
|
||||
while(TABLE *tbl= check_opt_it++)
|
||||
|
Reference in New Issue
Block a user