diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2021-09-07 12:44:12 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2021-09-07 12:44:12 +0400 |
commit | 47207ea291a7600aa8a220b9de348f250afa4e5e (patch) | |
tree | 68851fbd0c799f5ef4d9fd993b577fdae8f581ce | |
parent | b1bc8dfbd1d79e0c161732141310ec32f6af8722 (diff) | |
download | mariadb-git-47207ea291a7600aa8a220b9de348f250afa4e5e.tar.gz |
MDEV-19275
thd->set_time() call fixed.
-rw-r--r-- | sql/sql_class.h | 15 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 7 |
2 files changed, 14 insertions, 8 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index e4efd1e8ba6..a3dea11f0df 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3919,6 +3919,11 @@ public: user_time= t; set_time(); } + inline void force_set_time(my_time_t t, ulong sec_part) + { + start_time= system_time.sec= t; + start_time_sec_part= system_time.sec_part= sec_part; + } /* this is only used by replication and BINLOG command. usecs > TIME_MAX_SECOND_PART means "was not in binlog" @@ -3930,15 +3935,9 @@ public: else { if (sec_part <= TIME_MAX_SECOND_PART) - { - start_time= system_time.sec= t; - start_time_sec_part= system_time.sec_part= sec_part; - } + force_set_time(t, sec_part); else if (t != system_time.sec) - { - start_time= system_time.sec= t; - start_time_sec_part= system_time.sec_part= 0; - } + force_set_time(t, 0); else { start_time= t; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index ac45153fa85..7efc14b6818 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -4859,7 +4859,11 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable) Statement stmt_backup; bool error; Query_arena *save_stmt_arena= thd->stmt_arena; + my_time_t save_query_start= thd->query_start(); + ulong save_query_sec= thd->start_time_sec_part; + Item_change_list save_change_list; + thd->Item_change_list::move_elements_to(&save_change_list); state= STMT_CONVENTIONAL_EXECUTION; @@ -4867,6 +4871,7 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable) if (!(lex= new (mem_root) st_lex_local)) return TRUE; + thd->set_time(); thd->set_n_backup_statement(this, &stmt_backup); thd->set_n_backup_active_arena(this, &stmt_backup); thd->stmt_arena= this; @@ -4880,6 +4885,7 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable) thd->stmt_arena= save_stmt_arena; save_change_list.move_elements_to(thd); + thd->force_set_time(save_query_start, save_query_sec); /* Items and memory will freed in destructor */ @@ -6209,6 +6215,7 @@ loc_advanced_command(MYSQL *mysql, enum enum_server_command command, THD *thd_orig= current_thd; set_current_thd(p->thd); p->thd->thread_stack= (char*) &result; + p->thd->set_time(); result= execute_server_code(p->thd, (const char *)arg, arg_length); p->thd->cleanup_after_query(); mysql_audit_release(p->thd); |