1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge branch '11.4' into 11.5

This commit is contained in:
Oleksandr Byelkin
2024-05-23 17:01:43 +02:00
1470 changed files with 43538 additions and 14960 deletions

View File

@ -1470,7 +1470,7 @@ static bool check_view_insertability(THD *thd, TABLE_LIST *view,
*trans_end= trans_start + num;
Field_translator *trans;
uint used_fields_buff_size= bitmap_buffer_size(table->s->fields);
uint32 *used_fields_buff= (uint32*)thd->alloc(used_fields_buff_size);
my_bitmap_map *used_fields_buff= (my_bitmap_map*)thd->alloc(used_fields_buff_size);
MY_BITMAP used_fields;
enum_column_usage saved_column_usage= thd->column_usage;
List_iterator_fast<Item> it(fields);
@ -1969,14 +1969,31 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info, select_result *sink)
was used. This ensures that we don't get a problem when the
whole range of the key has been used.
*/
if (info->handle_duplicates == DUP_REPLACE && table->next_number_field &&
if (info->handle_duplicates == DUP_REPLACE &&
key_nr == table->s->next_number_index && insert_id_for_cur_row > 0)
goto err;
if (table->file->ha_table_flags() & HA_DUPLICATE_POS)
if (table->file->has_dup_ref())
{
/*
If engine doesn't support HA_DUPLICATE_POS, the handler may init to
INDEX, but dup_ref could also be set by lookup_handled (and then,
lookup_errkey is set, f.ex. long unique duplicate).
In such case, handler would stay uninitialized, so do it here.
*/
bool init_lookup_handler= table->file->lookup_errkey != (uint)-1 &&
table->file->inited == handler::NONE;
if (init_lookup_handler && table->file->ha_rnd_init_with_error(false))
goto err;
DBUG_ASSERT(table->file->inited == handler::RND);
if (table->file->ha_rnd_pos(table->record[1],table->file->dup_ref))
goto err;
int rnd_pos_err= table->file->ha_rnd_pos(table->record[1],
table->file->dup_ref);
if (init_lookup_handler)
table->file->ha_rnd_end();
if (rnd_pos_err)
goto err;
}
else
{
@ -2419,7 +2436,7 @@ public:
passed from connection thread to the handler thread.
*/
MDL_request grl_protection;
Delayed_insert(SELECT_LEX *current_select)
Delayed_insert(LEX *lex)
:locks_in_memory(0), thd(next_thread_id()),
table(0),tables_in_use(0), stacked_inserts(0),
status(0), retry(0), handler_thread_initialized(FALSE), group_count(0)
@ -2432,8 +2449,9 @@ public:
strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user);
thd.current_tablenr=0;
thd.set_command(COM_DELAYED_INSERT);
thd.lex->current_select= current_select;
thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
thd.lex->current_select= lex->current_select;
thd.lex->sql_command= lex->sql_command; // For innodb::store_lock()
thd.lex->duplicates= lex->duplicates;
/*
Prevent changes to global.lock_wait_timeout from affecting
delayed insert threads as any timeouts in delayed inserts
@ -2609,7 +2627,7 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
*/
if (! (di= find_handler(thd, table_list)))
{
if (!(di= new Delayed_insert(thd->lex->current_select)))
if (!(di= new Delayed_insert(thd->lex)))
goto end_create;
/*
@ -2910,6 +2928,8 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
copy->def_read_set.bitmap= (my_bitmap_map*) bitmap;
copy->def_write_set.bitmap= ((my_bitmap_map*)
(bitmap + share->column_bitmap_size));
create_last_bit_mask(&copy->def_read_set);
create_last_bit_mask(&copy->def_write_set);
bitmaps_used= 2;
if (share->default_fields || share->default_expressions)
{