1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Merge next-mr -> next-4284.

This commit is contained in:
Konstantin Osipov
2010-02-02 02:22:16 +03:00
311 changed files with 7149 additions and 2702 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -452,7 +452,7 @@ static void handle_bootstrap_impl(THD *thd)
query= (char *) thd->memdup_w_gap(buff, length + 1,
thd->db_length + 1 +
QUERY_CACHE_FLAGS_SIZE);
thd->set_query(query, length);
thd->set_query_and_id(query, length, next_query_id());
DBUG_PRINT("query",("%-.4096s",thd->query()));
#if defined(ENABLED_PROFILING)
thd->profiling.start_new_query();
@@ -463,7 +463,6 @@ static void handle_bootstrap_impl(THD *thd)
We don't need to obtain LOCK_thread_count here because in bootstrap
mode we have only one thread.
*/
thd->query_id=next_query_id();
thd->set_time();
mysql_parse(thd, thd->query(), length, & found_semicolon);
close_thread_tables(thd); // Free tables
@@ -811,12 +810,10 @@ 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();
pthread_mutex_lock(&LOCK_thread_count);
thd->query_id= global_query_id;
thd->set_query_id(get_query_id());
if (!(server_command_flags[command] & CF_SKIP_QUERY_ID))
next_query_id();
thread_running++;
pthread_mutex_unlock(&LOCK_thread_count);
inc_thread_running();
if (!(server_command_flags[command] & CF_SKIP_QUESTIONS))
statistic_increment(thd->status_var.questions, &LOCK_status);
@@ -1047,16 +1044,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->security_ctx->priv_user,
(char *) thd->security_ctx->host_or_ip);
thd->set_query(beginning_of_next_stmt, length);
pthread_mutex_lock(&LOCK_thread_count);
thd->set_query_and_id(beginning_of_next_stmt, length, next_query_id());
/*
Count each statement from the client.
*/
statistic_increment(thd->status_var.questions, &LOCK_status);
thd->query_id= next_query_id();
thd->set_time(); /* Reset the query start time. */
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
pthread_mutex_unlock(&LOCK_thread_count);
mysql_parse(thd, beginning_of_next_stmt, length, &end_of_stmt);
}
@@ -1380,9 +1374,7 @@ 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;
pthread_mutex_lock(&LOCK_thread_count); // For process list
thread_running--;
pthread_mutex_unlock(&LOCK_thread_count);
dec_thread_running();
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));
@@ -2003,11 +1995,11 @@ mysql_execute_command(THD *thd)
restore status variables, as we don't want 'show status' to cause
changes
*/
pthread_mutex_lock(&LOCK_status);
mysql_mutex_lock(&LOCK_status);
add_diff_to_status(&global_status_var, &thd->status_var,
&old_status_var);
thd->status_var= old_status_var;
pthread_mutex_unlock(&LOCK_status);
mysql_mutex_unlock(&LOCK_status);
break;
}
case SQLCOM_SHOW_DATABASES:
@@ -7293,6 +7285,9 @@ void get_default_definer(THD *thd, LEX_USER *definer)
definer->host.str= (char *) sctx->priv_host;
definer->host.length= strlen(definer->host.str);
definer->password.str= NULL;
definer->password.length= 0;
}
@@ -7344,6 +7339,8 @@ LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name)
definer->user= *user_name;
definer->host= *host_name;
definer->password.str= NULL;
definer->password.length= 0;
return definer;
}