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

Merge branch '10.4' into 10.5

This commit is contained in:
Sergei Golubchik
2023-12-01 13:43:58 +01:00
511 changed files with 26233 additions and 3853 deletions

View File

@ -83,6 +83,7 @@
#include "debug_sync.h"
#ifdef WITH_WSREP
#include "wsrep_mysqld.h" /* wsrep_append_table_keys() */
#include "wsrep_trans_observer.h" /* wsrep_start_transction() */
#endif /* WITH_WSREP */
@ -580,7 +581,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 (table_list->next_global &&
open_and_lock_tables(thd, table_list->next_global, TRUE, 0))
{
end_delayed_insert(thd);
error= TRUE;
@ -2664,7 +2666,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
}
THD_STAGE_INFO(client_thd, stage_got_handler_lock);
if (client_thd->killed)
goto error;
goto error2;
if (thd.killed)
{
/*
@ -2689,7 +2691,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
my_message(thd.get_stmt_da()->sql_errno(),
thd.get_stmt_da()->message(), MYF(0));
}
goto error;
goto error2;
}
}
share= table->s;
@ -2718,11 +2720,14 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
&record, (uint) share->reclength,
&bitmap, (uint) share->column_bitmap_size*4,
NullS))
goto error;
goto error2;
/* Copy the TABLE object. */
copy= new (copy_tmp) TABLE;
*copy= *table;
copy->vcol_refix_list.empty();
init_sql_alloc(key_memory_TABLE, &copy->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0,
MYF(MY_THREAD_SPECIFIC));
/* We don't need to change the file handler here */
/* Assign the pointers for the field pointers array and the record. */
@ -2803,11 +2808,15 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
bzero((char*) bitmap, share->column_bitmap_size * bitmaps_used);
copy->read_set= &copy->def_read_set;
copy->write_set= &copy->def_write_set;
move_root(client_thd->mem_root, &copy->mem_root);
free_root(&copy->mem_root, 0);
DBUG_RETURN(copy);
/* Got fatal error */
error:
free_root(&copy->mem_root, 0);
error2:
tables_in_use--;
mysql_cond_signal(&cond); // Inform thread about abort
DBUG_RETURN(0);
@ -5024,17 +5033,13 @@ bool select_create::send_eof()
thd->wsrep_trx_id(), thd->thread_id, thd->query_id);
/*
append table level exclusive key for CTAS
For CTAS, append table level exclusive key for created table
and table level shared key for selected table.
*/
wsrep_key_arr_t key_arr= {0, 0};
wsrep_prepare_keys_for_isolation(thd,
create_table->db.str,
create_table->table_name.str,
table_list,
&key_arr);
int rcode= wsrep_thd_append_key(thd, key_arr.keys, key_arr.keys_len,
WSREP_SERVICE_KEY_EXCLUSIVE);
wsrep_keys_free(&key_arr);
int rcode= wsrep_append_table_keys(thd, create_table, table_list,
WSREP_SERVICE_KEY_EXCLUSIVE);
rcode= rcode || wsrep_append_table_keys(thd, nullptr, select_tables,
WSREP_SERVICE_KEY_SHARED);
if (rcode)
{
DBUG_PRINT("wsrep", ("row key failed: %d", rcode));