From cbd3334701960d6acd84cd296baa9819655185a4 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Apr 2005 00:16:02 -0500 Subject: [PATCH 1/4] Bug #9665 After registering MySQL service and starting with shared mem, cannot stop The shared memory connect event was not being set in kill_server. This caused the thread that is handling shared memory connections to never exit. sql/mysqld.cc: Added code to set the shared memory connect event upon server termination --- sql/mysqld.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 0590333a20f..aa22f9bb2e4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -835,6 +835,18 @@ static void __cdecl kill_server(int sig_ptr) else sql_print_error(ER(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */ +#if defined(HAVE_SMEM) && defined(__WIN__) + /* + Send event to smem_event_connect_request for aborting + */ + if (!SetEvent(smem_event_connect_request)) + { + DBUG_PRINT("error", + ("Got error: %ld from SetEvent of smem_event_connect_request", + GetLastError())); + } +#endif + #if defined(__NETWARE__) || (defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__) && !defined(OS2)) my_thread_init(); // If this is a new thread #endif From c88d49bd7610fbc5fd111bb354f9213be506ad23 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Apr 2005 09:17:19 -0500 Subject: [PATCH 2/4] Bug #9665 After registering MySQL service and starting with shared mem, cannot stop Removed the extra set of the shared memory connect event from kill_mysql since it is also being set in kill_server sql/mysqld.cc: removed the code that set the shared memory connect event since this also being done in kill_server --- sql/mysqld.cc | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index aa22f9bb2e4..22a4e0dd4d0 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -773,15 +773,6 @@ void kill_mysql(void) CloseHandle(hEvent); */ } -#ifdef HAVE_SMEM - /* - Send event to smem_event_connect_request for aborting - */ - if (!SetEvent(smem_event_connect_request)) - { - DBUG_PRINT("error",("Got error: %ld from SetEvent of smem_event_connect_request",GetLastError())); - } -#endif #endif #elif defined(OS2) pthread_cond_signal( &eventShutdown); // post semaphore From 3e0a62636725b4bfa958d1416d80a12d269b1b94 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Apr 2005 00:30:23 +0400 Subject: [PATCH 3/4] Fix for bug #9796 "Query Cache caches queries with CURRENT_USER() function". We should not cache queries using CURRENT_USER() function as we do it for some other functions, e.g. USER() function. mysql-test/r/query_cache.result: Let us test that queries with CURRENT_USER() function are not cached. mysql-test/t/query_cache.test: Let us test that queries with CURRENT_USER() function are not cached. sql/item_create.cc: create_func_current_user(): We should not cache queries which use CURRENT_USER() function. --- mysql-test/r/query_cache.result | 2 ++ mysql-test/t/query_cache.test | 1 + sql/item_create.cc | 1 + 3 files changed, 4 insertions(+) diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 85fe77b1f10..a472a1b75c0 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -299,6 +299,8 @@ select UNIX_TIMESTAMP() from t1; UNIX_TIMESTAMP() select USER() from t1; USER() +select CURRENT_USER() from t1; +CURRENT_USER() select benchmark(1,1) from t1; benchmark(1,1) show status like "Qcache_queries_in_cache"; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 61fbadde1e1..89a9707a237 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -182,6 +182,7 @@ select LAST_INSERT_ID() from t1; select RAND() from t1; select UNIX_TIMESTAMP() from t1; select USER() from t1; +select CURRENT_USER() from t1; select benchmark(1,1) from t1; show status like "Qcache_queries_in_cache"; # diff --git a/sql/item_create.cc b/sql/item_create.cc index 6809d6892b0..877e63047d6 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -297,6 +297,7 @@ Item *create_func_current_user() char buff[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; uint length; + thd->safe_to_cache_query= 0; length= (uint) (strxmov(buff, thd->priv_user, "@", thd->priv_host, NullS) - buff); return new Item_string(NullS, thd->memdup(buff, length), length); From 93b4fbea9247aad1ad469a252ef1b67fc8e87bdf Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Apr 2005 10:44:48 +0400 Subject: [PATCH 4/4] Merging fix for bug #9796 "Query Cache caches queries with CURRENT_USER() function" into 4.1 tree. --- sql/item_create.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/item_create.cc b/sql/item_create.cc index 4b313d49466..2b12a1310b9 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -306,7 +306,7 @@ Item *create_func_current_user() char buff[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; uint length; - thd->safe_to_cache_query= 0; + thd->lex->safe_to_cache_query= 0; length= (uint) (strxmov(buff, thd->priv_user, "@", thd->priv_host, NullS) - buff); return new Item_string(NullS, thd->memdup(buff, length), length,