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

Merge 10.4 into 10.5

This commit is contained in:
Aleksey Midenkov
2019-12-02 13:35:54 +03:00
47 changed files with 1241 additions and 109 deletions

View File

@ -206,10 +206,10 @@ static bool check_fields(THD *thd, TABLE_LIST *table, List<Item> &items,
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++)
@ -217,8 +217,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;
@ -480,7 +483,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");
@ -717,6 +720,11 @@ int mysql_update(THD *thd,
Later we also ensure that we are only using one table (no sub queries)
*/
DBUG_PRINT("info", ("HA_CAN_DIRECT_UPDATE_AND_DELETE: %s", (table->file->ha_table_flags() & HA_CAN_DIRECT_UPDATE_AND_DELETE) ? "TRUE" : "FALSE"));
DBUG_PRINT("info", ("using_io_buffer: %s", query_plan.using_io_buffer ? "TRUE" : "FALSE"));
DBUG_PRINT("info", ("ignore: %s", ignore ? "TRUE" : "FALSE"));
DBUG_PRINT("info", ("virtual_columns_marked_for_read: %s", table->check_virtual_columns_marked_for_read() ? "TRUE" : "FALSE"));
DBUG_PRINT("info", ("virtual_columns_marked_for_write: %s", table->check_virtual_columns_marked_for_write() ? "TRUE" : "FALSE"));
if ((table->file->ha_table_flags() & HA_CAN_DIRECT_UPDATE_AND_DELETE) &&
!has_triggers && !binlog_is_row &&
!query_plan.using_io_buffer && !ignore &&
@ -927,11 +935,16 @@ update_begin:
if (do_direct_update)
{
/* Direct updating is supported */
ha_rows update_rows= 0, found_rows= 0;
DBUG_PRINT("info", ("Using direct update"));
table->reset_default_fields();
if (unlikely(!(error= table->file->ha_direct_update_rows(&updated))))
if (unlikely(!(error= table->file->ha_direct_update_rows(&update_rows,
&found_rows))))
error= -1;
found= updated;
updated= update_rows;
found= found_rows;
if (found < updated)
found= updated;
goto update_end;
}
@ -2243,7 +2256,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;
}
}
@ -2712,7 +2725,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++)