Commit 1199dfcb authored by Alexey Botchkov's avatar Alexey Botchkov

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
Bug#34517 SHOW GLOBAL STATUS does not work properly in embedded server.
    test result

  mysql-test/t/information_schema.test
Bug#34517 SHOW GLOBAL STATUS does not work properly in embedded server.
    test case added
parent ed77f02a
...@@ -384,6 +384,7 @@ static void emb_free_embedded_thd(MYSQL *mysql) ...@@ -384,6 +384,7 @@ static void emb_free_embedded_thd(MYSQL *mysql)
thd->clear_data_list(); thd->clear_data_list();
thread_count--; thread_count--;
thd->store_globals(); thd->store_globals();
thd->unlink();
delete thd; delete thd;
mysql->thd=0; mysql->thd=0;
} }
...@@ -627,6 +628,7 @@ void *create_embedded_thd(int client_flag) ...@@ -627,6 +628,7 @@ void *create_embedded_thd(int client_flag)
bzero((char*) &thd->net, sizeof(thd->net)); bzero((char*) &thd->net, sizeof(thd->net));
thread_count++; thread_count++;
threads.append(thd);
return thd; return thd;
err: err:
delete(thd); delete(thd);
......
...@@ -1698,4 +1698,13 @@ drop table if exists t1;drop table if exists ...@@ -1698,4 +1698,13 @@ drop table if exists t1;drop table if exists
Warnings: Warnings:
Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row 1 Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row 1
set global init_connect=""; set global init_connect="";
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. End of 5.1 tests.
...@@ -1373,4 +1373,14 @@ drop table if exists t1;drop table if exists t1;"; ...@@ -1373,4 +1373,14 @@ drop table if exists t1;drop table if exists t1;";
select * from information_schema.global_variables where variable_name='init_connect'; select * from information_schema.global_variables where variable_name='init_connect';
set global init_connect=""; set global init_connect="";
#
# 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. --echo End of 5.1 tests.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment