mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
merge of 5.1-main into mysql-trunk.
Changes to ha_innodb.cc are not propagated to plugin, they will come back via Oracle/Innobase if needed.
This commit is contained in:
@ -458,6 +458,7 @@ pthread_handler_t handle_bootstrap(void *arg)
|
||||
thd->init_for_queries();
|
||||
while (fgets(buff, thd->net.max_packet, file))
|
||||
{
|
||||
char *query;
|
||||
/* strlen() can't be deleted because fgets() doesn't return length */
|
||||
ulong length= (ulong) strlen(buff);
|
||||
while (buff[length-1] != '\n' && !feof(file))
|
||||
@ -490,11 +491,10 @@ pthread_handler_t handle_bootstrap(void *arg)
|
||||
if (strncmp(buff, STRING_WITH_LEN("delimiter")) == 0)
|
||||
continue;
|
||||
|
||||
thd->query_length=length;
|
||||
thd->query= (char*) thd->memdup_w_gap(buff, length+1,
|
||||
thd->db_length+1+
|
||||
QUERY_CACHE_FLAGS_SIZE);
|
||||
thd->query[length] = '\0';
|
||||
query= (char *) thd->memdup_w_gap(buff, length + 1,
|
||||
thd->db_length + 1 +
|
||||
QUERY_CACHE_FLAGS_SIZE);
|
||||
thd->set_query(query, length);
|
||||
DBUG_PRINT("query",("%-.4096s",thd->query));
|
||||
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||
thd->profiling.start_new_query();
|
||||
@ -534,8 +534,9 @@ end:
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
||||
thread_count--;
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
in_bootstrap= FALSE;
|
||||
(void) pthread_cond_broadcast(&COND_thread_count);
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
my_thread_end();
|
||||
pthread_exit(0);
|
||||
#endif
|
||||
@ -659,8 +660,7 @@ int mysql_table_dump(THD *thd, LEX_STRING *db, char *tbl_name)
|
||||
if (check_one_table_access(thd, SELECT_ACL, table_list))
|
||||
goto err;
|
||||
thd->free_list = 0;
|
||||
thd->query_length=(uint) strlen(tbl_name);
|
||||
thd->query = tbl_name;
|
||||
thd->set_query(tbl_name, (uint) strlen(tbl_name));
|
||||
if ((error = mysqld_dump_create_info(thd, table_list, -1)))
|
||||
{
|
||||
my_error(ER_GET_ERRNO, MYF(0), my_errno);
|
||||
@ -1253,14 +1253,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thd->profiling.set_query_source(beginning_of_next_stmt, length);
|
||||
#endif
|
||||
|
||||
MYSQL_QUERY_START(thd->query, thd->thread_id,
|
||||
MYSQL_QUERY_START(beginning_of_next_stmt, thd->thread_id,
|
||||
(char *) (thd->db ? thd->db : ""),
|
||||
thd->security_ctx->priv_user,
|
||||
(char *) thd->security_ctx->host_or_ip);
|
||||
|
||||
thd->set_query(beginning_of_next_stmt, length);
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query_length= length;
|
||||
thd->query= beginning_of_next_stmt;
|
||||
/*
|
||||
Count each statement from the client.
|
||||
*/
|
||||
@ -1313,9 +1312,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
table_list.schema_table= schema_table;
|
||||
}
|
||||
|
||||
thd->query_length= (uint) (packet_end - packet); // Don't count end \0
|
||||
if (!(thd->query=fields= (char*) thd->memdup(packet,thd->query_length+1)))
|
||||
uint query_length= (uint) (packet_end - packet); // Don't count end \0
|
||||
if (!(fields= (char *) thd->memdup(packet, query_length + 1)))
|
||||
break;
|
||||
thd->set_query(fields, query_length);
|
||||
general_log_print(thd, command, "%s %s", table_list.table_name, fields);
|
||||
if (lower_case_table_names)
|
||||
my_casedn_str(files_charset_info, table_list.table_name);
|
||||
@ -1608,13 +1608,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
log_slow_statement(thd);
|
||||
|
||||
thd_proc_info(thd, "cleaning up");
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list
|
||||
thd_proc_info(thd, 0);
|
||||
thd->set_query(NULL, 0);
|
||||
thd->command=COM_SLEEP;
|
||||
thd->query=0;
|
||||
thd->query_length=0;
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list
|
||||
thread_running--;
|
||||
VOID(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));
|
||||
|
||||
@ -1818,6 +1817,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
|
||||
|
||||
bool alloc_query(THD *thd, const char *packet, uint packet_length)
|
||||
{
|
||||
char *query;
|
||||
/* Remove garbage at start and end of query */
|
||||
while (packet_length > 0 && my_isspace(thd->charset(), packet[0]))
|
||||
{
|
||||
@ -1832,14 +1832,13 @@ bool alloc_query(THD *thd, const char *packet, uint packet_length)
|
||||
packet_length--;
|
||||
}
|
||||
/* We must allocate some extra memory for query cache */
|
||||
thd->query_length= 0; // Extra safety: Avoid races
|
||||
if (!(thd->query= (char*) thd->memdup_w_gap((uchar*) (packet),
|
||||
packet_length,
|
||||
thd->db_length+ 1 +
|
||||
QUERY_CACHE_FLAGS_SIZE)))
|
||||
return TRUE;
|
||||
thd->query[packet_length]=0;
|
||||
thd->query_length= packet_length;
|
||||
if (! (query= (char*) thd->memdup_w_gap(packet,
|
||||
packet_length,
|
||||
1 + thd->db_length +
|
||||
QUERY_CACHE_FLAGS_SIZE)))
|
||||
return TRUE;
|
||||
query[packet_length]= '\0';
|
||||
thd->set_query(query, packet_length);
|
||||
|
||||
/* Reclaim some memory */
|
||||
thd->packet.shrink(thd->variables.net_buffer_length);
|
||||
@ -7022,7 +7021,7 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query)
|
||||
continue;
|
||||
if (tmp->thread_id == id)
|
||||
{
|
||||
pthread_mutex_lock(&tmp->LOCK_delete); // Lock from delete
|
||||
pthread_mutex_lock(&tmp->LOCK_thd_data); // Lock from delete
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -7055,7 +7054,7 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query)
|
||||
}
|
||||
else
|
||||
error=ER_KILL_DENIED_ERROR;
|
||||
pthread_mutex_unlock(&tmp->LOCK_delete);
|
||||
pthread_mutex_unlock(&tmp->LOCK_thd_data);
|
||||
}
|
||||
DBUG_PRINT("exit", ("%d", error));
|
||||
DBUG_RETURN(error);
|
||||
|
Reference in New Issue
Block a user