From ca847584ebc57212d255978b2ed95d97f2e430db Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Sat, 11 May 2019 19:51:31 +0400 Subject: [PATCH] Cleanup redundant abort_loop checks abort_loop is intended to break accepting connections loop in main thread, however it is being used for other purposes. cache_thread() is governed by kill_cached_threads, no need to check abort_loop here. Check in create_new_thread() is redundant, abort_loop already checked by caller. Part of MDEV-19515 - Improve connect speed --- sql/mysqld.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index dec23535551..da6833131db 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2670,8 +2670,7 @@ static bool cache_thread(THD *thd) DBUG_ASSERT(thd); mysql_mutex_lock(&LOCK_thread_cache); - if (cached_thread_count < thread_cache_size && - ! abort_loop && !kill_cached_threads) + if (cached_thread_count < thread_cache_size && !kill_cached_threads) { /* Don't kill the thread, just put it in cache for reuse */ DBUG_PRINT("info", ("Adding thread to cache")); @@ -2689,7 +2688,7 @@ static bool cache_thread(THD *thd) #endif set_timespec(abstime, THREAD_CACHE_TIMEOUT); - while (!abort_loop && ! wake_thread && ! kill_cached_threads) + while (! wake_thread && ! kill_cached_threads) { int error= mysql_cond_timedwait(&COND_thread_cache, &LOCK_thread_cache, &abstime); @@ -6260,14 +6259,14 @@ void create_new_thread(CONNECT *connect) mysql_mutex_lock(&LOCK_connection_count); if (*connect->scheduler->connection_count >= - *connect->scheduler->max_connections + 1|| abort_loop) + *connect->scheduler->max_connections + 1) { DBUG_PRINT("error",("Too many connections")); mysql_mutex_unlock(&LOCK_connection_count); statistic_increment(denied_connections, &LOCK_status); statistic_increment(connection_errors_max_connection, &LOCK_status); - connect->close_with_error(0, NullS, abort_loop ? ER_SERVER_SHUTDOWN : ER_CON_COUNT_ERROR); + connect->close_with_error(0, NullS, ER_CON_COUNT_ERROR); DBUG_VOID_RETURN; }