mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Simplified away init_new_connection_thread()
It was meaningful only for one-thread-per-connection scheduler anyway, so call init_new_connection_handler_thread() directly from handle_one_connection(). It was somewhat harmful for no-threads scheduler, because it'd attempt to detach main thread on AIX_3_2 and Siemens unix (and DEC OSF/1 3.2 too). Also it does duplicate my_thread_init() call, which may produce a warning under EXTRA_DEBUG_THREADS. start_wsrep_THD() shouldn't have called it at all: it already detached and called my_thread_init(). Part of MDEV-19515 - Improve connect speed
This commit is contained in:
@ -82,8 +82,6 @@ bool do_command(THD *thd);
|
||||
ensure that the proper MySQL Server logic attached to these events is
|
||||
executed.
|
||||
*/
|
||||
/* Initialise a new connection handler thread */
|
||||
bool init_new_connection_handler_thread();
|
||||
/* Set up connection thread before use as execution thread */
|
||||
bool setup_connection_thread_globals(THD *thd);
|
||||
/* Prepare connection as part of connection set-up */
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
#include "mariadb.h"
|
||||
#include "mysqld.h"
|
||||
#include "sql_connect.h" // init_new_connection_handler_thread
|
||||
#include "scheduler.h"
|
||||
#include "sql_class.h"
|
||||
#include "sql_callback.h"
|
||||
@ -133,16 +132,11 @@ void one_thread_per_connection_scheduler(scheduler_functions *func,
|
||||
func->max_threads= *arg_max_connections + 1;
|
||||
func->max_connections= arg_max_connections;
|
||||
func->connection_count= arg_connection_count;
|
||||
func->init_new_connection_thread= init_new_connection_handler_thread;
|
||||
func->add_connection= create_thread_to_handle_connection;
|
||||
func->end_thread= one_thread_per_connection_end;
|
||||
func->post_kill_notification= post_kill_notification;
|
||||
}
|
||||
#else
|
||||
bool init_new_connection_handler_thread()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void handle_connection_in_main_thread(CONNECT *connect)
|
||||
{
|
||||
}
|
||||
@ -158,7 +152,6 @@ void one_thread_scheduler(scheduler_functions *func)
|
||||
func->max_threads= 1;
|
||||
func->max_connections= &max_connections;
|
||||
func->connection_count= &connection_count;
|
||||
func->init_new_connection_thread= init_new_connection_handler_thread;
|
||||
func->add_connection= handle_connection_in_main_thread;
|
||||
func->end_thread= no_threads_end;
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ struct scheduler_functions
|
||||
uint max_threads, *connection_count;
|
||||
ulong *max_connections;
|
||||
bool (*init)(void);
|
||||
bool (*init_new_connection_thread)(void);
|
||||
void (*add_connection)(CONNECT *connect);
|
||||
void (*thd_wait_begin)(THD *thd, int wait_type);
|
||||
void (*thd_wait_end)(THD *thd);
|
||||
|
@ -1303,6 +1303,14 @@ pthread_handler_t handle_one_connection(void *arg)
|
||||
|
||||
mysql_thread_set_psi_id(connect->thread_id);
|
||||
|
||||
if (init_new_connection_handler_thread())
|
||||
{
|
||||
scheduler_functions *scheduler= connect->scheduler;
|
||||
connect->close_with_error(0, 0, ER_OUT_OF_RESOURCES);
|
||||
scheduler->end_thread(0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
do_handle_one_connection(connect);
|
||||
return 0;
|
||||
}
|
||||
@ -1340,8 +1348,7 @@ void do_handle_one_connection(CONNECT *connect)
|
||||
{
|
||||
ulonglong thr_create_utime= microsecond_interval_timer();
|
||||
THD *thd;
|
||||
if (connect->scheduler->init_new_connection_thread() ||
|
||||
!(thd= connect->create_thd(NULL)))
|
||||
if (!(thd= connect->create_thd(NULL)))
|
||||
{
|
||||
scheduler_functions *scheduler= connect->scheduler;
|
||||
connect->close_with_error(0, 0, ER_OUT_OF_RESOURCES);
|
||||
|
@ -383,11 +383,6 @@ end:
|
||||
|
||||
/* Dummy functions, do nothing */
|
||||
|
||||
static bool tp_init_new_connection_thread()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool tp_end_thread(THD *, bool)
|
||||
{
|
||||
return 0;
|
||||
@ -512,7 +507,6 @@ static scheduler_functions tp_scheduler_functions=
|
||||
NULL,
|
||||
NULL,
|
||||
tp_init, // init
|
||||
tp_init_new_connection_thread, // init_new_connection_thread
|
||||
tp_add_connection, // add_connection
|
||||
tp_wait_begin, // thd_wait_begin
|
||||
tp_wait_end, // thd_wait_end
|
||||
|
@ -2619,13 +2619,6 @@ void* start_wsrep_THD(void *arg)
|
||||
|
||||
mysql_thread_set_psi_id(thd->thread_id);
|
||||
thd->thr_create_utime= microsecond_interval_timer();
|
||||
if (MYSQL_CALLBACK_ELSE(thread_scheduler, init_new_connection_thread, (), 0))
|
||||
{
|
||||
close_connection(thd, ER_OUT_OF_RESOURCES);
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
|
||||
goto error;
|
||||
}
|
||||
|
||||
// </5.1.17>
|
||||
/*
|
||||
|
Reference in New Issue
Block a user