mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Cleanups and fixes
- Added missing delete thd in bootstrap() - Delete wrong 'delete thd' in start_wsrep_THD() - Added missing 'delete thd' in case of SCHEDULER_ONE_THREAD_PER_CONNECTION - Delete wrong dec_thread_running() in destroy_thd() as it caused thread_running to be wrong. - Moved reset_killed() to a normal function to make it easier to debug - Added check of mutex in wsrep_aborting_thd... functions
This commit is contained in:
@ -6396,6 +6396,7 @@ static void bootstrap(MYSQL_FILE *file)
|
||||
sql_print_warning("Can't create thread to handle bootstrap (errno= %d)",
|
||||
error);
|
||||
bootstrap_error=-1;
|
||||
delete thd;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
/* Wait for thread to die */
|
||||
|
@ -2067,6 +2067,23 @@ int THD::killed_errno()
|
||||
}
|
||||
|
||||
|
||||
void THD::reset_killed()
|
||||
{
|
||||
/*
|
||||
Resetting killed has to be done under a mutex to ensure
|
||||
its not done during an awake() call.
|
||||
*/
|
||||
DBUG_ENTER("reset_killed");
|
||||
if (killed != NOT_KILLED)
|
||||
{
|
||||
mysql_mutex_lock(&LOCK_thd_kill);
|
||||
killed= NOT_KILLED;
|
||||
killed_err= 0;
|
||||
mysql_mutex_unlock(&LOCK_thd_kill);
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/*
|
||||
Remember the location of thread info, the structure needed for
|
||||
the structure for the net buffer
|
||||
@ -4630,7 +4647,6 @@ void destroy_thd(MYSQL_THD thd)
|
||||
thd->add_status_to_global();
|
||||
unlink_not_visible_thd(thd);
|
||||
delete thd;
|
||||
dec_thread_running();
|
||||
}
|
||||
|
||||
void reset_thd(MYSQL_THD thd)
|
||||
|
@ -3737,20 +3737,7 @@ public:
|
||||
}
|
||||
}
|
||||
int killed_errno();
|
||||
inline void reset_killed()
|
||||
{
|
||||
/*
|
||||
Resetting killed has to be done under a mutex to ensure
|
||||
its not done during an awake() call.
|
||||
*/
|
||||
if (killed != NOT_KILLED)
|
||||
{
|
||||
mysql_mutex_lock(&LOCK_thd_kill);
|
||||
killed= NOT_KILLED;
|
||||
killed_err= 0;
|
||||
mysql_mutex_unlock(&LOCK_thd_kill);
|
||||
}
|
||||
}
|
||||
void reset_killed();
|
||||
inline void reset_kill_query()
|
||||
{
|
||||
if (killed < KILL_CONNECTION)
|
||||
|
@ -1935,7 +1935,6 @@ pthread_handler_t start_wsrep_THD(void *arg)
|
||||
close_connection(thd, ER_OUT_OF_RESOURCES);
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
|
||||
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -1958,7 +1957,6 @@ pthread_handler_t start_wsrep_THD(void *arg)
|
||||
close_connection(thd, ER_OUT_OF_RESOURCES);
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
|
||||
delete thd;
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -2002,13 +2000,8 @@ pthread_handler_t start_wsrep_THD(void *arg)
|
||||
// at server shutdown
|
||||
}
|
||||
|
||||
if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION)
|
||||
{
|
||||
mysql_mutex_lock(&LOCK_thread_count);
|
||||
thd->unlink();
|
||||
mysql_mutex_unlock(&LOCK_thread_count);
|
||||
unlink_not_visible_thd(thd);
|
||||
delete thd;
|
||||
}
|
||||
my_thread_end();
|
||||
return(NULL);
|
||||
|
||||
@ -2733,6 +2726,7 @@ void wsrep_unlock_rollback()
|
||||
|
||||
my_bool wsrep_aborting_thd_contains(THD *thd)
|
||||
{
|
||||
mysql_mutex_assert_owner(&LOCK_wsrep_rollback);
|
||||
wsrep_aborting_thd_t abortees = wsrep_aborting_thd;
|
||||
while (abortees)
|
||||
{
|
||||
|
Reference in New Issue
Block a user