mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge 10.6 into 10.10
The MDEV-29693 conflict resolution is from Monty, as well as is a bug fix where ANALYZE TABLE wrongly built histograms for single-column PRIMARY KEY. Also includes a fix for safe_malloc error reporting. Other things: - Copied main.log_slow from 10.4 to avoid mtr issue Disabled test: - spider/bugfix.mdev_27239 because we started to get +Error 1429 Unable to connect to foreign data source: localhost -Error 1158 Got an error reading communication packets - main.delayed - Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED This part is disabled for now as it fails randomly with different warnings/errors (no corruption).
This commit is contained in:
@ -582,7 +582,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;
|
||||
@ -948,7 +949,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);
|
||||
@ -2784,6 +2785,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
|
||||
@ -3560,7 +3564,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);
|
||||
@ -3720,7 +3724,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);
|
||||
@ -4116,7 +4120,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 */
|
||||
@ -4880,17 +4885,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);
|
||||
|
Reference in New Issue
Block a user