Commit efb61c12 authored by Sergey Vojtovich's avatar Sergey Vojtovich

Simplified away CONNECT::real_id

It was wrong anyway, as it may not get updated by the time created thread
reads it. And it was 0 for cached threads.

Part of MDEV-19515 - Improve connect speed
parent 7192d7b7
...@@ -6208,8 +6208,9 @@ void create_thread_to_handle_connection(CONNECT *connect) ...@@ -6208,8 +6208,9 @@ void create_thread_to_handle_connection(CONNECT *connect)
DBUG_PRINT("info",(("creating thread %lu"), (ulong) connect->thread_id)); DBUG_PRINT("info",(("creating thread %lu"), (ulong) connect->thread_id));
connect->prior_thr_create_utime= microsecond_interval_timer(); connect->prior_thr_create_utime= microsecond_interval_timer();
pthread_t tmp;
if (auto error= mysql_thread_create(key_thread_one_connection, if (auto error= mysql_thread_create(key_thread_one_connection,
&connect->real_id, &connection_attrib, &tmp, &connection_attrib,
handle_one_connection, (void*) connect)) handle_one_connection, (void*) connect))
{ {
char error_message_buff[MYSQL_ERRMSG_SIZE]; char error_message_buff[MYSQL_ERRMSG_SIZE];
......
...@@ -1522,6 +1522,6 @@ THD *CONNECT::create_thd(THD *thd) ...@@ -1522,6 +1522,6 @@ THD *CONNECT::create_thd(THD *thd)
my_localhost : 0; my_localhost : 0;
thd->scheduler= scheduler; thd->scheduler= scheduler;
thd->real_id= real_id; thd->real_id= pthread_self(); /* Duplicates THD::store_globals() setting. */
DBUG_RETURN(thd); DBUG_RETURN(thd);
} }
...@@ -34,14 +34,13 @@ class CONNECT : public ilink { ...@@ -34,14 +34,13 @@ class CONNECT : public ilink {
Vio *vio; /* Copied to THD with my_net_init() */ Vio *vio; /* Copied to THD with my_net_init() */
scheduler_functions *scheduler; scheduler_functions *scheduler;
my_thread_id thread_id; my_thread_id thread_id;
pthread_t real_id;
/* Own variables */ /* Own variables */
bool thread_count_incremented; bool thread_count_incremented;
ulonglong prior_thr_create_utime; ulonglong prior_thr_create_utime;
CONNECT() CONNECT()
:vio(0), scheduler(thread_scheduler), thread_id(0), real_id(0), :vio(0), scheduler(thread_scheduler), thread_id(0),
thread_count_incremented(0), prior_thr_create_utime(0) thread_count_incremented(0), prior_thr_create_utime(0)
{ {
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment