summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorPraveenkumar Hulakund <praveenkumar.hulakund@oracle.com>2013-07-24 15:44:41 +0530
committerPraveenkumar Hulakund <praveenkumar.hulakund@oracle.com>2013-07-24 15:44:41 +0530
commit0ae219cd75eceebd8bc6f9148aff5f5db790f699 (patch)
tree1f9d55d7f07f747fa85ed65a74157afa6be9daf5 /sql/mysqld.cc
parent596e990263bc9b9600ebff8cbf87d0425cead312 (diff)
downloadmariadb-git-0ae219cd75eceebd8bc6f9148aff5f5db790f699.tar.gz
Bug#16865959 - PLEASE BACKPORT BUG 14749800.
Since log_throttle is not available in 5.5. Logging of error message for failure of thread to create new connection in "create_thread_to_handle_connection" is not backported. Since, function "my_plugin_log_message" is not available in 5.5 version and since there is incompatibility between sql_print_XXX function compiled with g++ and alog files with gcc to use sql_print_error, changes related to audit log plugin is not backported.
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc68
1 files changed, 41 insertions, 27 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c97a8c542d6..287ca3e4aa4 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1258,11 +1258,12 @@ void kill_mysql(void)
if (!kill_in_progress)
{
pthread_t tmp;
+ int error;
abort_loop=1;
- if (mysql_thread_create(0, /* Not instrumented */
- &tmp, &connection_attrib, kill_server_thread,
- (void*) 0))
- sql_print_error("Can't create thread to kill server");
+ if ((error= mysql_thread_create(0, /* Not instrumented */
+ &tmp, &connection_attrib,
+ kill_server_thread, (void*) 0)))
+ sql_print_error("Can't create thread to kill server (errno= %d).", error);
}
#endif
DBUG_VOID_RETURN;
@@ -2728,10 +2729,12 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
#endif
#ifdef USE_ONE_SIGNAL_HAND
pthread_t tmp;
- if (mysql_thread_create(0, /* Not instrumented */
- &tmp, &connection_attrib, kill_server_thread,
- (void*) &sig))
- sql_print_error("Can't create thread to kill server");
+ if ((error= mysql_thread_create(0, /* Not instrumented */
+ &tmp, &connection_attrib,
+ kill_server_thread,
+ (void*) &sig)))
+ sql_print_error("Can't create thread to kill server (errno= %d)",
+ error);
#else
kill_server((void*) sig); // MIT THREAD has a alarm thread
#endif
@@ -4116,9 +4119,12 @@ static void create_shutdown_thread()
#ifdef __WIN__
hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name);
pthread_t hThread;
- if (mysql_thread_create(key_thread_handle_shutdown,
- &hThread, &connection_attrib, handle_shutdown, 0))
- sql_print_warning("Can't create thread to handle shutdown requests");
+ int error;
+ if ((error= mysql_thread_create(key_thread_handle_shutdown,
+ &hThread, &connection_attrib,
+ handle_shutdown, 0)))
+ sql_print_warning("Can't create thread to handle shutdown requests"
+ " (errno= %d)", error);
// On "Stop Service" we have to do regular shutdown
Service.SetShutdownEvent(hEventShutdown);
@@ -4132,6 +4138,7 @@ static void create_shutdown_thread()
static void handle_connections_methods()
{
pthread_t hThread;
+ int error;
DBUG_ENTER("handle_connections_methods");
if (hPipe == INVALID_HANDLE_VALUE &&
(!have_tcpip || opt_disable_networking) &&
@@ -4147,22 +4154,24 @@ static void handle_connections_methods()
if (hPipe != INVALID_HANDLE_VALUE)
{
handler_count++;
- if (mysql_thread_create(key_thread_handle_con_namedpipes,
- &hThread, &connection_attrib,
- handle_connections_namedpipes, 0))
+ if ((error= mysql_thread_create(key_thread_handle_con_namedpipes,
+ &hThread, &connection_attrib,
+ handle_connections_namedpipes, 0)))
{
- sql_print_warning("Can't create thread to handle named pipes");
+ sql_print_warning("Can't create thread to handle named pipes"
+ " (errno= %d)", error);
handler_count--;
}
}
if (have_tcpip && !opt_disable_networking)
{
handler_count++;
- if (mysql_thread_create(key_thread_handle_con_sockets,
- &hThread, &connection_attrib,
- handle_connections_sockets_thread, 0))
+ if ((error= mysql_thread_create(key_thread_handle_con_sockets,
+ &hThread, &connection_attrib,
+ handle_connections_sockets_thread, 0)))
{
- sql_print_warning("Can't create thread to handle TCP/IP");
+ sql_print_warning("Can't create thread to handle TCP/IP",
+ " (errno= %d)", error);
handler_count--;
}
}
@@ -4170,11 +4179,12 @@ static void handle_connections_methods()
if (opt_enable_shared_memory)
{
handler_count++;
- if (mysql_thread_create(key_thread_handle_con_sharedmem,
- &hThread, &connection_attrib,
- handle_connections_shared_memory, 0))
+ if ((error= mysql_thread_create(key_thread_handle_con_sharedmem,
+ &hThread, &connection_attrib,
+ handle_connections_shared_memory, 0)))
{
- sql_print_warning("Can't create thread to handle shared memory");
+ sql_print_warning("Can't create thread to handle shared memory",
+ " (errno= %d)", error);
handler_count--;
}
}
@@ -4909,11 +4919,14 @@ static void bootstrap(MYSQL_FILE *file)
bootstrap_file=file;
#ifndef EMBEDDED_LIBRARY // TODO: Enable this
- if (mysql_thread_create(key_thread_bootstrap,
- &thd->real_id, &connection_attrib, handle_bootstrap,
- (void*) thd))
+ int error;
+ if ((error= mysql_thread_create(key_thread_bootstrap,
+ &thd->real_id, &connection_attrib,
+ handle_bootstrap,
+ (void*) thd)))
{
- sql_print_warning("Can't create thread to handle bootstrap");
+ sql_print_warning("Can't create thread to handle bootstrap (errno= %d)",
+ error);
bootstrap_error=-1;
DBUG_VOID_RETURN;
}
@@ -5012,6 +5025,7 @@ void create_thread_to_handle_connection(THD *thd)
DBUG_PRINT("error",
("Can't create thread to handle request (error %d)",
error));
+
thread_count--;
thd->killed= THD::KILL_CONNECTION; // Safety
mysql_mutex_unlock(&LOCK_thread_count);