summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2019-05-12 11:15:53 +0400
committerSergey Vojtovich <svoj@mariadb.org>2019-05-21 17:55:09 +0400
commitefb61c12a929ae176b495e95d8995d9cac649b2d (patch)
tree8d131483467dad822682579b05c1ec01eeca2c27 /sql
parent7192d7b700cc624e91518a3200596ae1cd580e70 (diff)
downloadmariadb-git-efb61c12a929ae176b495e95d8995d9cac649b2d.tar.gz
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
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc3
-rw-r--r--sql/sql_connect.cc2
-rw-r--r--sql/sql_connect.h3
3 files changed, 4 insertions, 4 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5aaa9dd0cf8..63238447e38 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -6208,8 +6208,9 @@ void create_thread_to_handle_connection(CONNECT *connect)
DBUG_PRINT("info",(("creating thread %lu"), (ulong) connect->thread_id));
connect->prior_thr_create_utime= microsecond_interval_timer();
+ pthread_t tmp;
if (auto error= mysql_thread_create(key_thread_one_connection,
- &connect->real_id, &connection_attrib,
+ &tmp, &connection_attrib,
handle_one_connection, (void*) connect))
{
char error_message_buff[MYSQL_ERRMSG_SIZE];
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 68f0461f44c..b88cfcc5025 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1522,6 +1522,6 @@ THD *CONNECT::create_thd(THD *thd)
my_localhost : 0;
thd->scheduler= scheduler;
- thd->real_id= real_id;
+ thd->real_id= pthread_self(); /* Duplicates THD::store_globals() setting. */
DBUG_RETURN(thd);
}
diff --git a/sql/sql_connect.h b/sql/sql_connect.h
index a46fbdfac60..60c6bd5497d 100644
--- a/sql/sql_connect.h
+++ b/sql/sql_connect.h
@@ -34,14 +34,13 @@ public:
Vio *vio; /* Copied to THD with my_net_init() */
scheduler_functions *scheduler;
my_thread_id thread_id;
- pthread_t real_id;
/* Own variables */
bool thread_count_incremented;
ulonglong prior_thr_create_utime;
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)
{
};