Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-34814 mysqld hangs on startup when --init-file target does not e… #3536

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5344,6 +5344,26 @@ static void test_lc_time_sz()
#endif//DBUG_OFF


static void run_main_loop()
{
select_thread=pthread_self();
mysql_mutex_lock(&LOCK_start_thread);
select_thread_in_use=1;
mysql_mutex_unlock(&LOCK_start_thread);

#ifdef _WIN32
handle_connections_win();
#else
handle_connections_sockets();

mysql_mutex_lock(&LOCK_start_thread);
select_thread_in_use=0;
mysql_cond_broadcast(&COND_start_thread);
mysql_mutex_unlock(&LOCK_start_thread);
#endif /* _WIN32 */
}


#ifdef __WIN__
int win_main(int argc, char **argv)
#else
Expand Down Expand Up @@ -5540,9 +5560,6 @@ int mysqld_main(int argc, char **argv)
SYSVAR_AUTOSIZE(my_thread_stack_size, new_thread_stack_size);
}

select_thread=pthread_self();
select_thread_in_use=1;

#ifdef HAVE_LIBWRAP
libwrapName= my_progname+dirname_length(my_progname);
openlog(libwrapName, LOG_PID, LOG_AUTH);
Expand Down Expand Up @@ -5596,7 +5613,6 @@ int mysqld_main(int argc, char **argv)
// Recover and exit.
if (wsrep_recovery)
{
select_thread_in_use= 0;
if (WSREP_ON)
wsrep_recover();
else
Expand Down Expand Up @@ -5671,7 +5687,6 @@ int mysqld_main(int argc, char **argv)

if (opt_bootstrap)
{
select_thread_in_use= 0; // Allow 'kill' to work
int bootstrap_error= bootstrap(mysql_stdin);
if (!abort_loop)
unireg_abort(bootstrap_error);
Expand Down Expand Up @@ -5751,16 +5766,7 @@ int mysqld_main(int argc, char **argv)
/* Memory used when everything is setup */
start_memory_used= global_status_var.global_memory_used;

#ifdef _WIN32
handle_connections_win();
#else
handle_connections_sockets();

mysql_mutex_lock(&LOCK_start_thread);
select_thread_in_use=0;
mysql_cond_broadcast(&COND_start_thread);
mysql_mutex_unlock(&LOCK_start_thread);
#endif /* _WIN32 */
run_main_loop();

/* Shutdown requested */
char *user= shutdown_user.load(std::memory_order_relaxed);
Expand Down