1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge branch '10.5' into 10.6

This commit is contained in:
Sergei Golubchik
2022-10-02 22:14:21 +02:00
245 changed files with 9723 additions and 2458 deletions

View File

@ -38,6 +38,8 @@
#include "debug.h" // debug_crash_here
#include "mysql/psi/mysql_sp.h"
#include "wsrep_mysqld.h"
#include <my_time.h>
#include <mysql_time.h>
/*************************************************************************/
@ -222,7 +224,7 @@ static File_option triggers_file_parameters[]=
},
{
{ STRING_WITH_LEN("created") },
my_offsetof(class Table_triggers_list, create_times),
my_offsetof(class Table_triggers_list, hr_create_times),
FILE_OPTIONS_ULLLIST
},
{ { 0, 0 }, 0, FILE_OPTIONS_STRING }
@ -1057,6 +1059,10 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
if (!(trigger= new (&table->mem_root) Trigger(this, 0)))
goto err;
/* Time with in microseconds */
trigger->hr_create_time= make_hr_time(thd->query_start(),
thd->query_start_sec_part());
/* Create trigger_name.TRN file to ensure trigger name is unique */
if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type,
(uchar*)&trigname, trigname_file_parameters))
@ -1069,8 +1075,6 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
/* Populate the trigger object */
trigger->sql_mode= thd->variables.sql_mode;
/* Time with 2 decimals, like in MySQL 5.7 */
trigger->create_time= ((ulonglong) thd->query_start())*100 + thd->query_start_sec_part()/10000;
build_trig_stmt_query(thd, tables, stmt_query, &trigger_definition,
&trigger->definer, trg_definer_holder);
@ -1138,7 +1142,7 @@ void Table_triggers_list::empty_lists()
client_cs_names.empty();
connection_cl_names.empty();
db_cl_names.empty();
create_times.empty();
hr_create_times.empty();
}
@ -1174,7 +1178,7 @@ bool Trigger::add_to_file_list(void* param_arg)
base->client_cs_names.push_back(&client_cs_name, mem_root) ||
base->connection_cl_names.push_back(&connection_cl_name, mem_root) ||
base->db_cl_names.push_back(&db_cl_name, mem_root) ||
base->create_times.push_back(&create_time, mem_root))
base->hr_create_times.push_back(&hr_create_time.val, mem_root))
return 1;
return 0;
}
@ -1584,7 +1588,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db,
List_iterator_fast<LEX_CSTRING> it_client_cs_name(trigger_list->client_cs_names);
List_iterator_fast<LEX_CSTRING> it_connection_cl_name(trigger_list->connection_cl_names);
List_iterator_fast<LEX_CSTRING> it_db_cl_name(trigger_list->db_cl_names);
List_iterator_fast<ulonglong> it_create_times(trigger_list->create_times);
List_iterator_fast<ulonglong>
it_create_times(trigger_list->hr_create_times);
LEX *old_lex= thd->lex;
LEX lex;
sp_rcontext *save_spcont= thd->spcont;
@ -1670,7 +1675,13 @@ bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db,
trigger->sql_mode= sql_mode;
trigger->definition= *trg_create_str;
trigger->create_time= trg_create_time ? *trg_create_time : 0;
trigger->hr_create_time.val= trg_create_time ? *trg_create_time : 0;
/*
Fix time if in 100th of second (comparison with max uint * 100
(max possible timestamp in the old format))
*/
if (trigger->hr_create_time.val < 429496729400ULL)
trigger->hr_create_time.val*= 10000;
trigger->name= sp ? sp->m_name : empty_clex_str;
trigger->on_table_name.str= (char*) lex.raw_trg_on_table_name_begin;
trigger->on_table_name.length= (lex.raw_trg_on_table_name_end -