mirror of
https://github.com/MariaDB/server.git
synced 2025-12-03 05:41:09 +03:00
Manual merge/pull from mysql-next-mr.
Conflicts: - sql/sql_insert.cc
This commit is contained in:
@@ -511,9 +511,7 @@ static void handle_bootstrap_impl(THD *thd)
|
||||
break;
|
||||
|
||||
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
|
||||
#ifdef USING_TRANSACTIONS
|
||||
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
|
||||
#endif
|
||||
}
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
@@ -812,11 +810,7 @@ bool do_command(THD *thd)
|
||||
|
||||
net_new_transaction(net);
|
||||
|
||||
packet_length= my_net_read(net);
|
||||
#if defined(ENABLED_PROFILING)
|
||||
thd->profiling.start_new_query();
|
||||
#endif
|
||||
if (packet_length == packet_error)
|
||||
if ((packet_length= my_net_read(net)) == packet_error)
|
||||
{
|
||||
DBUG_PRINT("info",("Got error %d reading command from socket %s",
|
||||
net->error,
|
||||
@@ -873,9 +867,6 @@ bool do_command(THD *thd)
|
||||
return_value= dispatch_command(command, thd, packet+1, (uint) (packet_length-1));
|
||||
|
||||
out:
|
||||
#if defined(ENABLED_PROFILING)
|
||||
thd->profiling.finish_current_query();
|
||||
#endif
|
||||
DBUG_RETURN(return_value);
|
||||
}
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
@@ -977,6 +968,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
DBUG_ENTER("dispatch_command");
|
||||
DBUG_PRINT("info",("packet: '%*.s'; command: %d", packet_length, packet, command));
|
||||
|
||||
#if defined(ENABLED_PROFILING)
|
||||
thd->profiling.start_new_query();
|
||||
#endif
|
||||
MYSQL_COMMAND_START(thd->thread_id, command,
|
||||
thd->security_ctx->priv_user,
|
||||
(char *) thd->security_ctx->host_or_ip);
|
||||
@@ -989,7 +983,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thd->enable_slow_log= TRUE;
|
||||
thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
|
||||
thd->set_time();
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
thd->query_id= global_query_id;
|
||||
|
||||
switch( command ) {
|
||||
@@ -1011,7 +1005,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
|
||||
thread_running++;
|
||||
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
|
||||
/**
|
||||
Clear the set of flags that are expected to be cleared at the
|
||||
@@ -1234,9 +1228,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thd->profiling.set_query_source(thd->query(), thd->query_length());
|
||||
#endif
|
||||
|
||||
if (!(specialflag & SPECIAL_NO_PRIOR))
|
||||
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
|
||||
|
||||
mysql_parse(thd, thd->query(), thd->query_length(), &end_of_stmt);
|
||||
|
||||
while (!thd->killed && (end_of_stmt != NULL) && ! thd->is_error())
|
||||
@@ -1277,7 +1268,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
(char *) thd->security_ctx->host_or_ip);
|
||||
|
||||
thd->set_query(beginning_of_next_stmt, length);
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
/*
|
||||
Count each statement from the client.
|
||||
*/
|
||||
@@ -1285,12 +1276,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thd->query_id= next_query_id();
|
||||
thd->set_time(); /* Reset the query start time. */
|
||||
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
mysql_parse(thd, beginning_of_next_stmt, length, &end_of_stmt);
|
||||
}
|
||||
|
||||
if (!(specialflag & SPECIAL_NO_PRIOR))
|
||||
my_pthread_setprio(pthread_self(),WAIT_PRIOR);
|
||||
DBUG_PRINT("info",("query ready"));
|
||||
break;
|
||||
}
|
||||
@@ -1505,8 +1494,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
}
|
||||
#endif
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
VOID(my_net_write(net, (uchar*) buff, length));
|
||||
VOID(net_flush(net));
|
||||
(void) my_net_write(net, (uchar*) buff, length);
|
||||
(void) net_flush(net);
|
||||
thd->stmt_da->disable_status();
|
||||
#endif
|
||||
break;
|
||||
@@ -1601,13 +1590,16 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thd_proc_info(thd, "cleaning up");
|
||||
thd->set_query(NULL, 0);
|
||||
thd->command=COM_SLEEP;
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list
|
||||
pthread_mutex_lock(&LOCK_thread_count); // For process list
|
||||
thread_running--;
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
thd_proc_info(thd, 0);
|
||||
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
|
||||
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
|
||||
|
||||
#if defined(ENABLED_PROFILING)
|
||||
thd->profiling.finish_current_query();
|
||||
#endif
|
||||
if (MYSQL_QUERY_DONE_ENABLED() || MYSQL_COMMAND_DONE_ENABLED())
|
||||
{
|
||||
int res;
|
||||
@@ -7189,7 +7181,7 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query)
|
||||
uint error=ER_NO_SUCH_THREAD;
|
||||
DBUG_ENTER("kill_one_thread");
|
||||
DBUG_PRINT("enter", ("id=%lu only_kill=%d", id, only_kill_query));
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count)); // For unlink from list
|
||||
pthread_mutex_lock(&LOCK_thread_count); // For unlink from list
|
||||
I_List_iterator<THD> it(threads);
|
||||
while ((tmp=it++))
|
||||
{
|
||||
@@ -7201,7 +7193,7 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query)
|
||||
break;
|
||||
}
|
||||
}
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
if (tmp)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user