Commit 63387829 authored by unknown's avatar unknown

WL#3247,#3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES

 tables to INFORMATION_SCHEMA.


mysql-test/r/information_schema.result:
  WL#3247,#3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
   tables to INFORMATION_SCHEMA.
   Fixed test cases result (changes are due to the new tables added).
mysql-test/r/information_schema_db.result:
  WL#3247,#3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
   tables to INFORMATION_SCHEMA.
   Fixed test cases result (changes are due to the new tables added).
mysql-test/r/status.result:
  WL#3247,#3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
   tables to INFORMATION_SCHEMA.
   Fixed results for added testcases.
mysql-test/r/variables.result:
  WL#3247,#3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
   tables to INFORMATION_SCHEMA.
   Fixed results for added test cases.
mysql-test/t/status.test:
  WL#3247,#3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
   tables to INFORMATION_SCHEMA.
   Added test cases.
mysql-test/t/variables.test:
  WL#3247,#3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
   tables to INFORMATION_SCHEMA.
   Added test cases.
sql/sql_show.cc:
  WL#3247,#3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
   tables to INFORMATION_SCHEMA.
   Implementation of the new I_S tables.
   Also, show_status_array(): argument 'ucase_names' is added (true means that
   all variable names are to be converted to upper case).
sql/table.h:
  WL#3247,#3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
   tables to INFORMATION_SCHEMA.
   Implementation of the new I_S tables.
parent 76fa1d43
......@@ -46,6 +46,8 @@ COLUMN_PRIVILEGES
ENGINES
EVENTS
FILES
GLOBAL_STATUS
GLOBAL_VARIABLES
KEY_COLUMN_USAGE
PARTITIONS
PLUGINS
......@@ -54,6 +56,8 @@ REFERENTIAL_CONSTRAINTS
ROUTINES
SCHEMATA
SCHEMA_PRIVILEGES
SESSION_STATUS
SESSION_VARIABLES
STATISTICS
TABLES
TABLE_CONSTRAINTS
......@@ -758,6 +762,7 @@ table_schema table_name column_name
information_schema COLUMNS COLUMN_TYPE
information_schema EVENTS EVENT_DEFINITION
information_schema EVENTS SQL_MODE
information_schema GLOBAL_VARIABLES VARIABLE_VALUE
information_schema PARTITIONS PARTITION_EXPRESSION
information_schema PARTITIONS SUBPARTITION_EXPRESSION
information_schema PARTITIONS PARTITION_DESCRIPTION
......@@ -765,6 +770,7 @@ information_schema PLUGINS PLUGIN_DESCRIPTION
information_schema PROCESSLIST INFO
information_schema ROUTINES ROUTINE_DEFINITION
information_schema ROUTINES SQL_MODE
information_schema SESSION_VARIABLES VARIABLE_VALUE
information_schema TRIGGERS ACTION_CONDITION
information_schema TRIGGERS ACTION_STATEMENT
information_schema TRIGGERS SQL_MODE
......@@ -847,7 +853,7 @@ delete from mysql.db where user='mysqltest_4';
flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES where TABLE_SCHEMA!='cluster' GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 23
information_schema 27
mysql 21
create table t1 (i int, j int);
create trigger trg1 before insert on t1 for each row
......@@ -1240,6 +1246,8 @@ COLUMN_PRIVILEGES TABLE_SCHEMA
ENGINES ENGINE
EVENTS EVENT_SCHEMA
FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
......@@ -1248,6 +1256,8 @@ REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
ROUTINES ROUTINE_SCHEMA
SCHEMATA SCHEMA_NAME
SCHEMA_PRIVILEGES TABLE_SCHEMA
SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
......@@ -1278,6 +1288,8 @@ COLUMN_PRIVILEGES TABLE_SCHEMA
ENGINES ENGINE
EVENTS EVENT_SCHEMA
FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
......@@ -1286,6 +1298,8 @@ REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
ROUTINES ROUTINE_SCHEMA
SCHEMATA SCHEMA_NAME
SCHEMA_PRIVILEGES TABLE_SCHEMA
SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
......
......@@ -13,6 +13,8 @@ COLUMN_PRIVILEGES
ENGINES
EVENTS
FILES
GLOBAL_STATUS
GLOBAL_VARIABLES
KEY_COLUMN_USAGE
PARTITIONS
PLUGINS
......@@ -21,6 +23,8 @@ REFERENTIAL_CONSTRAINTS
ROUTINES
SCHEMATA
SCHEMA_PRIVILEGES
SESSION_STATUS
SESSION_VARIABLES
STATISTICS
TABLES
TABLE_CONSTRAINTS
......
......@@ -3,6 +3,10 @@ show status like 'Table_lock%';
Variable_name Value
Table_locks_immediate 0
Table_locks_waited 0
select * from information_schema.session_status where variable_name like 'Table_lock%';
VARIABLE_NAME VARIABLE_VALUE
TABLE_LOCKS_IMMEDIATE 0.0000000
TABLE_LOCKS_WAITED 0.0000000
SET SQL_LOG_BIN=0;
drop table if exists t1;
create table t1(n int) engine=myisam;
......@@ -16,6 +20,10 @@ show status like 'Table_lock%';
Variable_name Value
Table_locks_immediate 3
Table_locks_waited 1
select * from information_schema.session_status where variable_name like 'Table_lock%';
VARIABLE_NAME VARIABLE_VALUE
TABLE_LOCKS_IMMEDIATE 3.0000000
TABLE_LOCKS_WAITED 1.0000000
drop table t1;
select 1;
1
......@@ -53,21 +61,36 @@ FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 2
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 2.0000000
SET @save_thread_cache_size=@@thread_cache_size;
SET GLOBAL thread_cache_size=3;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 4
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 4.0000000
FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 3
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 3.0000000
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 4
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 4.0000000
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 5
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 5.0000000
SET GLOBAL thread_cache_size=@save_thread_cache_size;
show status like 'com_show_status';
Variable_name Value
......
This diff is collapsed.
......@@ -13,6 +13,7 @@ connect (con2,localhost,root,,);
flush status;
show status like 'Table_lock%';
select * from information_schema.session_status where variable_name like 'Table_lock%';
connection con1;
SET SQL_LOG_BIN=0;
--disable_warnings
......@@ -34,6 +35,7 @@ unlock tables;
connection con1;
reap;
show status like 'Table_lock%';
select * from information_schema.session_status where variable_name like 'Table_lock%';
drop table t1;
disconnect con2;
......@@ -102,6 +104,7 @@ while ($wait_more)
# Prerequisite.
SHOW STATUS LIKE 'max_used_connections';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Save original setting.
SET @save_thread_cache_size=@@thread_cache_size;
......@@ -115,6 +118,7 @@ disconnect con2;
# Check that max_used_connections still reflects maximum value.
SHOW STATUS LIKE 'max_used_connections';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Check that after flush max_used_connections equals to current number
# of connections. First wait for previous disconnect to finish.
......@@ -138,15 +142,18 @@ while ($wait_more)
--enable_result_log
# Check that we don't count disconnected thread any longer.
SHOW STATUS LIKE 'max_used_connections';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Check that max_used_connections is updated when cached thread is
# reused...
connect (con2,localhost,root,,);
SHOW STATUS LIKE 'max_used_connections';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# ...and when new thread is created.
connect (con3,localhost,root,,);
SHOW STATUS LIKE 'max_used_connections';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Restore original setting.
connection default;
......
......@@ -83,16 +83,24 @@ drop table t1;
set GLOBAL max_join_size=10;
set max_join_size=100;
show variables like 'max_join_size';
select * from information_schema.session_variables where variable_name like 'max_join_size';
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show global variables like 'max_join_size';
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
select * from information_schema.global_variables where variable_name like 'max_join_size';
set GLOBAL max_join_size=2000;
show global variables like 'max_join_size';
select * from information_schema.global_variables where variable_name like 'max_join_size';
set max_join_size=DEFAULT;
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show variables like 'max_join_size';
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
select * from information_schema.session_variables where variable_name like 'max_join_size';
set GLOBAL max_join_size=DEFAULT;
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show global variables like 'max_join_size';
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
select * from information_schema.global_variables where variable_name like 'max_join_size';
set @@max_join_size=1000, @@global.max_join_size=2000;
select @@local.max_join_size, @@global.max_join_size;
select @@identity, length(@@version)>0;
......@@ -106,50 +114,68 @@ set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF",
set global concurrent_insert=2;
show variables like 'concurrent_insert';
select * from information_schema.session_variables where variable_name like 'concurrent_insert';
set global concurrent_insert=1;
show variables like 'concurrent_insert';
select * from information_schema.session_variables where variable_name like 'concurrent_insert';
set global concurrent_insert=0;
show variables like 'concurrent_insert';
select * from information_schema.session_variables where variable_name like 'concurrent_insert';
set global concurrent_insert=DEFAULT;
select @@concurrent_insert;
set global timed_mutexes=ON;
show variables like 'timed_mutexes';
select * from information_schema.session_variables where variable_name like 'timed_mutexes';
set global timed_mutexes=0;
show variables like 'timed_mutexes';
select * from information_schema.session_variables where variable_name like 'timed_mutexes';
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
show local variables like 'storage_engine';
select * from information_schema.session_variables where variable_name like 'storage_engine';
show global variables like 'storage_engine';
select * from information_schema.global_variables where variable_name like 'storage_engine';
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
set GLOBAL myisam_max_sort_file_size=default;
--replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
show variables like 'myisam_max_sort_file_size';
--replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
select * from information_schema.session_variables where variable_name like 'myisam_max_sort_file_size';
set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%';
show session variables like 'net_%';
select * from information_schema.session_variables where variable_name like 'net_%';
set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%';
show session variables like 'net_%';
select * from information_schema.session_variables where variable_name like 'net_%';
set net_buffer_length=1;
show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length';
set net_buffer_length=2000000000;
show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length';
set character set cp1251_koi8;
show variables like "character_set_client";
select * from information_schema.session_variables where variable_name like 'character_set_client';
select @@timestamp>0;
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select ROUND(RAND(),5);
show variables like '%alloc%';
select * from information_schema.session_variables where variable_name like '%alloc%';
set @@range_alloc_block_size=1024*16;
set @@query_alloc_block_size=1024*17+2;
set @@query_prealloc_size=1024*18;
......@@ -157,10 +183,12 @@ set @@transaction_alloc_block_size=1024*20-1;
set @@transaction_prealloc_size=1024*21-1;
select @@query_alloc_block_size;
show variables like '%alloc%';
select * from information_schema.session_variables where variable_name like '%alloc%';
set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
show variables like '%alloc%';
select * from information_schema.session_variables where variable_name like '%alloc%';
#
# Bug #10904 Illegal mix of collations between
......@@ -363,6 +391,8 @@ set global ft_boolean_syntax = @@init_connect;
set global myisam_max_sort_file_size=4294967296;
--replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
show global variables like 'myisam_max_sort_file_size';
--replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
set global myisam_max_sort_file_size=default;
#
......@@ -398,12 +428,16 @@ SELECT @@global.local.key_buffer_size;
# BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0)
set @tstlw = @@log_warnings;
show global variables like 'log_warnings';
select * from information_schema.global_variables where variable_name like 'log_warnings';
set global log_warnings = 0;
show global variables like 'log_warnings';
select * from information_schema.global_variables where variable_name like 'log_warnings';
set global log_warnings = 42;
show global variables like 'log_warnings';
select * from information_schema.global_variables where variable_name like 'log_warnings';
set global log_warnings = @tstlw;
show global variables like 'log_warnings';
select * from information_schema.global_variables where variable_name like 'log_warnings';
#
# BUG#4788 show create table provides incorrect statement
......@@ -435,6 +469,7 @@ drop table t1;
SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'MYISAM_DATA_POINTER_SIZE';
#
# Bug #6958: negative arguments to integer options wrap around
......@@ -442,6 +477,7 @@ SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
SET GLOBAL table_open_cache=-1;
SHOW VARIABLES LIKE 'table_open_cache';
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache';
SET GLOBAL table_open_cache=DEFAULT;
#
......@@ -527,6 +563,7 @@ select @@global.character_set_filesystem;
set @old_sql_big_selects = @@sql_big_selects;
set @@sql_big_selects = 1;
show variables like 'sql_big_selects';
select * from information_schema.session_variables where variable_name like 'sql_big_selects';
set @@sql_big_selects = @old_sql_big_selects;
#
......@@ -535,10 +572,14 @@ set @@sql_big_selects = @old_sql_big_selects;
#
set @@sql_notes = 0, @@sql_warnings = 0;
show variables like 'sql_notes';
select * from information_schema.session_variables where variable_name like 'sql_notes';
show variables like 'sql_warnings';
select * from information_schema.session_variables where variable_name like 'sql_warnings';
set @@sql_notes = 1, @@sql_warnings = 1;
show variables like 'sql_notes';
select * from information_schema.session_variables where variable_name like 'sql_notes';
show variables like 'sql_warnings';
select * from information_schema.session_variables where variable_name like 'sql_warnings';
#
# Bug #12792: @@system_time_zone is not SELECTable.
......@@ -565,9 +606,15 @@ select @@basedir, @@datadir, @@tmpdir;
--replace_column 2 #
show variables like 'basedir';
--replace_column 2 #
select * from information_schema.session_variables where variable_name like 'basedir';
--replace_column 2 #
show variables like 'datadir';
--replace_column 2 #
select * from information_schema.session_variables where variable_name like 'datadir';
--replace_column 2 #
show variables like 'tmpdir';
--replace_column 2 #
select * from information_schema.session_variables where variable_name like 'tmpdir';
#
# Bug #19606: make ssl settings available via SHOW VARIABLES and @@variables
......@@ -577,6 +624,8 @@ show variables like 'tmpdir';
select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
--replace_column 2 #
show variables like 'ssl%';
--replace_column 2 #
select * from information_schema.session_variables where variable_name like 'ssl%';
#
# Bug #19616: make log_queries_not_using_indexes available in SHOW VARIABLES
......@@ -584,6 +633,7 @@ show variables like 'ssl%';
#
select @@log_queries_not_using_indexes;
show variables like 'log_queries_not_using_indexes';
select * from information_schema.session_variables where variable_name like 'log_queries_not_using_indexes';
--echo End of 5.0 tests
......
This diff is collapsed.
......@@ -474,6 +474,8 @@ enum enum_schema_tables
SCH_ENGINES,
SCH_EVENTS,
SCH_FILES,
SCH_GLOBAL_STATUS,
SCH_GLOBAL_VARIABLES,
SCH_KEY_COLUMN_USAGE,
SCH_OPEN_TABLES,
SCH_PARTITIONS,
......@@ -483,6 +485,8 @@ enum enum_schema_tables
SCH_PROCEDURES,
SCH_SCHEMATA,
SCH_SCHEMA_PRIVILEGES,
SCH_SESSION_STATUS,
SCH_SESSION_VARIABLES,
SCH_STATISTICS,
SCH_STATUS,
SCH_TABLES,
......
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