List:Commits« Previous MessageNext Message »
From:Alexey Botchkov Date:September 5 2008 7:20am
Subject:bzr commit into mysql-5.1 branch (holyfoot:2728) Bug#34517
View as plain text  
#At file:///home/hf/work/mysql_common/51mrg/

 2728 Alexey Botchkov	2008-09-05
      Bug#34517 SHOW GLOBAL STATUS does not work properly in embedded server.
        
        GLOBAL STATUS is calculated by studying the list of threads. In the
        embedded server threads were not linked to the internal list, so the
        calculation always returns 0. Fixed by 'linking' the embedded-server
        threads to the same list
      
      per-file comments
      
      libmysqld/lib_sql.cc
          Bug#34517 SHOW GLOBAL STATUS does not work properly in embedded server.
          
          Add newly created 'threads' to the internal thread list.
          Remove them from the list as they're freed.
      
      mysql-test/r/information_schema.result
              test result
      
      mysql-test/t/information_schema.test
              test case
modified:
  libmysqld/lib_sql.cc
  mysql-test/r/information_schema.result
  mysql-test/t/information_schema.test

=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc	2008-08-13 18:50:08 +0000
+++ b/libmysqld/lib_sql.cc	2008-09-05 07:18:29 +0000
@@ -384,6 +384,7 @@ static void emb_free_embedded_thd(MYSQL 
   thd->clear_data_list();
   thread_count--;
   thd->store_globals();
+  thd->unlink();
   delete thd;
   mysql->thd=0;
 }
@@ -592,7 +593,7 @@ void init_embedded_mysql(MYSQL *mysql, i
 */
 void *create_embedded_thd(int client_flag)
 {
-  THD * thd= new THD;
+  THD *thd= new THD;
   thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
 
   thd->thread_stack= (char*) &thd;
@@ -627,6 +628,7 @@ void *create_embedded_thd(int client_fla
   bzero((char*) &thd->net, sizeof(thd->net));
 
   thread_count++;
+  threads.append(thd);
   return thd;
 err:
   delete(thd);

=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result	2008-03-27 11:54:45 +0000
+++ b/mysql-test/r/information_schema.result	2008-09-05 07:18:29 +0000
@@ -1646,4 +1646,12 @@ drop table t1;
 drop function f1;
 select * from information_schema.tables where 1=sleep(100000);
 select * from information_schema.columns where 1=sleep(100000);
+create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT';
+SELECT 1;
+1
+1
+select a.VARIABLE_VALUE - b.VARIABLE_VALUE from t0 b, information_schema.global_status a where a.VARIABLE_NAME = b.VARIABLE_NAME;
+a.VARIABLE_VALUE - b.VARIABLE_VALUE
+2
+drop table t0;
 End of 5.1 tests.

=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test	2008-03-27 11:54:45 +0000
+++ b/mysql-test/t/information_schema.test	2008-09-05 07:18:29 +0000
@@ -1338,4 +1338,15 @@ where state='User sleep' and
 info='select * from information_schema.columns where 1=sleep(100000)';
 --source include/wait_condition.inc
 
+#
+# Bug #34517 SHOW GLOBAL STATUS does not work properly in embedded server.
+#
+
+create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT';
+SELECT 1;
+select a.VARIABLE_VALUE - b.VARIABLE_VALUE from t0 b, information_schema.global_status a where a.VARIABLE_NAME = b.VARIABLE_NAME;
+
+drop table t0;
+
+
 --echo End of 5.1 tests.

Thread
bzr commit into mysql-5.1 branch (holyfoot:2728) Bug#34517Alexey Botchkov5 Sep