summaryrefslogtreecommitdiff
path: root/sql/sql_connect.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2019-05-19 02:10:40 +0400
committerSergey Vojtovich <svoj@mariadb.org>2019-05-21 17:55:09 +0400
commitebc55c8577be7b8b8c3d9433feb4ce457f5b6cc5 (patch)
treeaa39a653cebe6509fdd00d21dc16098469d6d102 /sql/sql_connect.cc
parent6900aaf417c6540a22ab74c6badaf42cd37e43e1 (diff)
downloadmariadb-git-ebc55c8577be7b8b8c3d9433feb4ce457f5b6cc5.tar.gz
Simplified away scheduler_functions::end_thread()
Code properly integrated into callers instead. do_handle_one_connection(): no need to reset thd and thd->thread_stack as they're not updated by cache_thread(). Part of MDEV-19515 - Improve connect speed
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r--sql/sql_connect.cc36
1 files changed, 17 insertions, 19 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 3646aee0f03..1485ee9f363 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1112,7 +1112,6 @@ bool setup_connection_thread_globals(THD *thd)
close_connection(thd, ER_OUT_OF_RESOURCES);
statistic_increment(aborted_connects,&LOCK_status);
statistic_increment(connection_errors_internal, &LOCK_status);
- thd->scheduler->end_thread(thd, 0);
return 1; // Error
}
return 0;
@@ -1304,14 +1303,15 @@ 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;
- }
+ else
+ do_handle_one_connection(connect, true);
- do_handle_one_connection(connect);
+ DBUG_PRINT("info", ("killing thread"));
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
+ ERR_remove_state(0);
+#endif
+ my_thread_end();
return 0;
}
@@ -1344,15 +1344,13 @@ bool thd_is_connection_alive(THD *thd)
}
-void do_handle_one_connection(CONNECT *connect)
+void do_handle_one_connection(CONNECT *connect, bool put_in_cache)
{
ulonglong thr_create_utime= microsecond_interval_timer();
THD *thd;
if (!(thd= connect->create_thd(NULL)))
{
- scheduler_functions *scheduler= connect->scheduler;
connect->close_with_error(0, 0, ER_OUT_OF_RESOURCES);
- scheduler->end_thread(0, 0);
return;
}
@@ -1388,7 +1386,11 @@ void do_handle_one_connection(CONNECT *connect)
*/
thd->thread_stack= (char*) &thd;
if (setup_connection_thread_globals(thd))
+ {
+ unlink_thd(thd);
+ delete thd;
return;
+ }
for (;;)
{
@@ -1422,16 +1424,12 @@ end_thread:
if (thd->userstat_running)
update_global_user_stats(thd, create_user, time(NULL));
- if (thd->scheduler->end_thread(thd, 1))
- return; // Probably no-threads
-
- /*
- If end_thread() returns, this thread has been schedule to
- handle the next connection.
- */
- thd= current_thd;
- thd->thread_stack= (char*) &thd;
+ unlink_thd(thd);
+ if (IF_WSREP(thd->wsrep_applier, false) || !put_in_cache ||
+ !cache_thread(thd))
+ break;
}
+ delete thd;
}
#endif /* EMBEDDED_LIBRARY */