mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
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
This commit is contained in:
parent
042f5165e3
commit
ca847584eb
1 changed files with 4 additions and 5 deletions
|
@ -2670,8 +2670,7 @@ static bool cache_thread(THD *thd)
|
||||||
DBUG_ASSERT(thd);
|
DBUG_ASSERT(thd);
|
||||||
|
|
||||||
mysql_mutex_lock(&LOCK_thread_cache);
|
mysql_mutex_lock(&LOCK_thread_cache);
|
||||||
if (cached_thread_count < thread_cache_size &&
|
if (cached_thread_count < thread_cache_size && !kill_cached_threads)
|
||||||
! abort_loop && !kill_cached_threads)
|
|
||||||
{
|
{
|
||||||
/* Don't kill the thread, just put it in cache for reuse */
|
/* Don't kill the thread, just put it in cache for reuse */
|
||||||
DBUG_PRINT("info", ("Adding thread to cache"));
|
DBUG_PRINT("info", ("Adding thread to cache"));
|
||||||
|
@ -2689,7 +2688,7 @@ static bool cache_thread(THD *thd)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
set_timespec(abstime, THREAD_CACHE_TIMEOUT);
|
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,
|
int error= mysql_cond_timedwait(&COND_thread_cache, &LOCK_thread_cache,
|
||||||
&abstime);
|
&abstime);
|
||||||
|
@ -6260,14 +6259,14 @@ void create_new_thread(CONNECT *connect)
|
||||||
mysql_mutex_lock(&LOCK_connection_count);
|
mysql_mutex_lock(&LOCK_connection_count);
|
||||||
|
|
||||||
if (*connect->scheduler->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"));
|
DBUG_PRINT("error",("Too many connections"));
|
||||||
|
|
||||||
mysql_mutex_unlock(&LOCK_connection_count);
|
mysql_mutex_unlock(&LOCK_connection_count);
|
||||||
statistic_increment(denied_connections, &LOCK_status);
|
statistic_increment(denied_connections, &LOCK_status);
|
||||||
statistic_increment(connection_errors_max_connection, &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;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue