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

Merge 11.3 into 11.4

This commit is contained in:
Vladislav Vaintroub
2023-11-21 15:43:20 +01:00
629 changed files with 21967 additions and 30305 deletions

View File

@ -591,7 +591,8 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list)
Open tables used for sub-selects or in stored functions, will also
cache these functions.
*/
if (open_and_lock_tables(thd, table_list->next_global, TRUE, 0))
if (open_and_lock_tables(thd, table_list->next_global, TRUE,
MYSQL_OPEN_IGNORE_ENGINE_STATS))
{
end_delayed_insert(thd);
error= TRUE;
@ -955,7 +956,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
same table in the same connection.
*/
if (thd->locked_tables_mode <= LTM_LOCK_TABLES &&
values_list.elements > 1)
!table->s->long_unique_table && values_list.elements > 1)
{
using_bulk_insert= 1;
table->file->ha_start_bulk_insert(values_list.elements);
@ -1408,6 +1409,7 @@ abort:
thd->abort_on_warning= 0;
if (readbuff)
my_free(readbuff);
status_var_add(thd->status_var.rows_sent, thd->get_sent_row_count());
DBUG_RETURN(retval);
}
@ -2791,6 +2793,9 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
/* Ensure we don't use the table list of the original table */
copy->pos_in_table_list= 0;
/* We don't need statistics for insert delayed */
copy->stats_cb= 0;
/*
Make a copy of all fields.
The copied fields need to point into the copied record. This is done
@ -3567,7 +3572,7 @@ bool Delayed_insert::handle_inserts(void)
we get a crash, then binary log will contain rows that are not yet
written to disk, which will cause problems in replication.
*/
if (!using_bin_log)
if (!using_bin_log && !table->s->long_unique_table)
table->file->extra(HA_EXTRA_WRITE_CACHE);
mysql_mutex_lock(&mutex);
@ -3727,7 +3732,7 @@ bool Delayed_insert::handle_inserts(void)
table->s->table_name.str);
goto err;
}
if (!using_bin_log)
if (!using_bin_log && !table->s->long_unique_table)
table->file->extra(HA_EXTRA_WRITE_CACHE);
mysql_mutex_lock(&mutex);
THD_STAGE_INFO(&thd, stage_insert);
@ -4123,7 +4128,8 @@ int select_insert::prepare2(JOIN *)
if (thd->lex->describe)
DBUG_RETURN(0);
if (thd->lex->current_select->options & OPTION_BUFFER_RESULT &&
thd->locked_tables_mode <= LTM_LOCK_TABLES)
thd->locked_tables_mode <= LTM_LOCK_TABLES &&
!table->s->long_unique_table)
table->file->ha_start_bulk_insert((ha_rows) 0);
/* Same as the other variants of INSERT */
@ -4864,17 +4870,18 @@ select_create::prepare(List<Item> &_values, SELECT_LEX_UNIT *u)
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
if (info.handle_duplicates == DUP_UPDATE)
table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
if (thd->locked_tables_mode <= LTM_LOCK_TABLES)
if (thd->locked_tables_mode <= LTM_LOCK_TABLES &&
!table->s->long_unique_table)
{
table->file->ha_start_bulk_insert((ha_rows) 0);
if (thd->lex->duplicates == DUP_ERROR && !thd->lex->ignore)
table->file->extra(HA_EXTRA_BEGIN_ALTER_COPY);
table->file->extra(HA_EXTRA_WRITE_CACHE);
}
thd->abort_on_warning= !info.ignore && thd->is_strict_mode();
if (check_that_all_fields_are_given_values(thd, table, table_list))
DBUG_RETURN(1);
table->mark_columns_needed_for_insert();
table->file->extra(HA_EXTRA_WRITE_CACHE);
// Mark table as used
table->query_id= thd->query_id;
DBUG_RETURN(0);