diff options
author | Igor Babaev <igor@askmonty.org> | 2016-08-31 10:34:21 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2016-08-31 10:34:21 -0700 |
commit | f11e892b572ef62db2375599d4bc4fd88527bede (patch) | |
tree | 7a7929016da14bd31b2b6c922591777bafdd0743 /mysql-test | |
parent | 2250e9ea261f661cb73c147a28f4d30655d7483d (diff) | |
parent | 1eb58ff3b8569d7dad1f5c180a5e55683e53d205 (diff) | |
download | mariadb-git-f11e892b572ef62db2375599d4bc4fd88527bede.tar.gz |
Merge branch '10.2' of github.com:MariaDB/server into bb-10.2-mdev9864
Diffstat (limited to 'mysql-test')
5 files changed, 380 insertions, 7 deletions
diff --git a/mysql-test/r/mysqld--help,win.rdiff b/mysql-test/r/mysqld--help,win.rdiff index aff42e2fa2d..5393af1dc99 100644 --- a/mysql-test/r/mysqld--help,win.rdiff +++ b/mysql-test/r/mysqld--help,win.rdiff @@ -23,9 +23,9 @@ + --shared-memory Enable the shared memory + --shared-memory-base-name=name + Base name of shared memory - --show-slave-auth-info - Show user and password in SHOW SLAVE HOSTS on this - master. + --session-track-schema + Track changes to the default schema. + (Defaults to on; use --skip-session-track-schema to disable.) @@ -1015,6 +1018,10 @@ Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other @@ -103,12 +103,12 @@ @@ -1387,6 +1381,8 @@ secure-auth TRUE secure-file-priv (No default value) - server-id 0 + server-id 1 +shared-memory FALSE +shared-memory-base-name MYSQL - show-slave-auth-info FALSE - silent-startup FALSE - skip-grant-tables TRUE + session-track-schema TRUE + session-track-state-change FALSE + session-track-system-variables @@ -1411,6 +1407,7 @@ slave-type-conversions slow-launch-time 2 diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 0cb8fcaff1c..0d3a1f07225 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -906,6 +906,26 @@ The following options may be given as the first argument: files within specified directory --server-id=# Uniquely identifies the server instance in the community of replication partners + --session-track-schema + Track changes to the default schema. + (Defaults to on; use --skip-session-track-schema to disable.) + --session-track-state-change + Track changes to the session state. + --session-track-system-variables=name + Track changes in registered system variables. For + compatibility with MySQL defaults this variable should be + set to "autocommit, character_set_client, + character_set_connection, character_set_results, + time_zone" + --session-track-transaction-info=name + Track changes to the transaction attributes. OFF to + disable; STATE to track just transaction state (Is there + an active transaction? Does it have any data? etc.); + CHARACTERISTICS to track transaction state and report all + statements needed to start a transaction withthe same + characteristics (isolation level, read only/read + write,snapshot - but not any work done / data modified + within the transaction). --show-slave-auth-info Show user and password in SHOW SLAVE HOSTS on this master. @@ -1392,6 +1412,10 @@ safe-user-create FALSE secure-auth TRUE secure-file-priv (No default value) server-id 1 +session-track-schema TRUE +session-track-state-change FALSE +session-track-system-variables +session-track-transaction-info OFF show-slave-auth-info FALSE silent-startup FALSE skip-grant-tables TRUE diff --git a/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result b/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result new file mode 100644 index 00000000000..7162e40ef6b --- /dev/null +++ b/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result @@ -0,0 +1,164 @@ +# +# Variable name : session_track_system_variables +# Scope : Global & Session +# +# Global - default +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables + +# Session - default +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables + + +# via INFORMATION_SCHEMA.GLOBAL_VARIABLES +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track%' ORDER BY VARIABLE_NAME; +VARIABLE_NAME VARIABLE_VALUE +SESSION_TRACK_SCHEMA ON +SESSION_TRACK_STATE_CHANGE OFF +SESSION_TRACK_SYSTEM_VARIABLES +SESSION_TRACK_TRANSACTION_INFO OFF +# via INFORMATION_SCHEMA.SESSION_VARIABLES +SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track%' ORDER BY VARIABLE_NAME; +VARIABLE_NAME VARIABLE_VALUE +SESSION_TRACK_SCHEMA ON +SESSION_TRACK_STATE_CHANGE OFF +SESSION_TRACK_SYSTEM_VARIABLES +SESSION_TRACK_TRANSACTION_INFO OFF +SET @global_saved_tmp = @@global.session_track_system_variables; + +# Altering global variable's value +SET @@global.session_track_system_variables='autocommit'; +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables +autocommit +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables + + +# Altering session variable's value +SET @@session.session_track_system_variables='autocommit'; +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables +autocommit +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables +autocommit + +# Variables' values in a new session. +connect con1,"127.0.0.1",root,,test,$MASTER_MYPORT,; +# Global - expect "autocommit" +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables +autocommit + +# Session - expect "autocommit" +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables +autocommit + +# Switching to the default connection. +connection default; +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables +autocommit +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables +autocommit + +# Test if DEFAULT is working as expected. +SET @@global.session_track_system_variables = DEFAULT; +SET @@session.session_track_system_variables = DEFAULT; + +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables + +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables + + +# Variables' values in a new session (con2). +connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables + +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables + + +# Altering session should not affect global. +SET @@session.session_track_system_variables = 'sql_mode'; +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables + +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables +sql_mode + +# Variables' values in a new session (con3). +connect con3,"127.0.0.1",root,,test,$MASTER_MYPORT,; +# Altering global should not affect session. +SET @@global.session_track_system_variables = 'sql_mode'; +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables +sql_mode +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables + + +# Switching to the default connection. +connection default; +# Testing NULL +SET @@global.session_track_system_variables = NULL; +SET @@session.session_track_system_variables = NULL; +# Global - expect "" instead of NULL +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables +NULL +# Session - expect "" instead of NULL +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables + +# testing with duplicate entries. +SET @@global.session_track_system_variables= "time_zone"; +SET @@session.session_track_system_variables= "time_zone"; +SET @@global.session_track_system_variables= "sql_mode,sql_mode"; +SET @@session.session_track_system_variables= "sql_mode,sql_mode"; +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables +sql_mode +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables +sql_mode + +# testing ordering +SET @@global.session_track_system_variables= "time_zone,sql_mode"; +SET @@session.session_track_system_variables= "time_zone,sql_mode"; +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables +sql_mode,time_zone +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables +sql_mode,time_zone + +# special values +SET @@global.session_track_system_variables= "*"; +SET @@session.session_track_system_variables= "*"; +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables +* +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables +* +SET @@global.session_track_system_variables= ""; +SET @@session.session_track_system_variables= ""; +SELECT @@global.session_track_system_variables; +@@global.session_track_system_variables + +SELECT @@session.session_track_system_variables; +@@session.session_track_system_variables + + +# Restoring the original values. +SET @@global.session_track_system_variables = @global_saved_tmp; +# End of tests. diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 2dbb1db5bda..bf2e14700a7 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -3803,6 +3803,62 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME SESSION_TRACK_SCHEMA +SESSION_VALUE ON +GLOBAL_VALUE ON +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE ON +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Track changes to the default schema. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME SESSION_TRACK_STATE_CHANGE +SESSION_VALUE OFF +GLOBAL_VALUE OFF +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE OFF +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Track changes to the session state. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME SESSION_TRACK_SYSTEM_VARIABLES +SESSION_VALUE +GLOBAL_VALUE +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE +VARIABLE_SCOPE SESSION +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT Track changes in registered system variables. For compatibility with MySQL defaults this variable should be set to "autocommit, character_set_client, character_set_connection, character_set_results, time_zone" +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME SESSION_TRACK_TRANSACTION_INFO +SESSION_VALUE OFF +GLOBAL_VALUE OFF +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE OFF +VARIABLE_SCOPE SESSION +VARIABLE_TYPE ENUM +VARIABLE_COMMENT Track changes to the transaction attributes. OFF to disable; STATE to track just transaction state (Is there an active transaction? Does it have any data? etc.); CHARACTERISTICS to track transaction state and report all statements needed to start a transaction withthe same characteristics (isolation level, read only/read write,snapshot - but not any work done / data modified within the transaction). +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,STATE,CHARACTERISTICS +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SKIP_EXTERNAL_LOCKING SESSION_VALUE NULL GLOBAL_VALUE ON diff --git a/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test b/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test new file mode 100644 index 00000000000..90e6052947c --- /dev/null +++ b/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test @@ -0,0 +1,129 @@ +--source include/not_embedded.inc + +--echo # +--echo # Variable name : session_track_system_variables +--echo # Scope : Global & Session +--echo # + +--echo # Global - default +SELECT @@global.session_track_system_variables; +--echo # Session - default +SELECT @@session.session_track_system_variables; +--echo + +--echo # via INFORMATION_SCHEMA.GLOBAL_VARIABLES +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track%' ORDER BY VARIABLE_NAME; + +--echo # via INFORMATION_SCHEMA.SESSION_VARIABLES +SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track%' ORDER BY VARIABLE_NAME; + +# Save the global value to be used to restore the original value. +SET @global_saved_tmp = @@global.session_track_system_variables; +--echo + +--echo # Altering global variable's value +SET @@global.session_track_system_variables='autocommit'; +SELECT @@global.session_track_system_variables; +SELECT @@session.session_track_system_variables; +--echo + +--echo # Altering session variable's value +SET @@session.session_track_system_variables='autocommit'; +SELECT @@global.session_track_system_variables; +SELECT @@session.session_track_system_variables; +--echo + +--echo # Variables' values in a new session. +connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,); + +--echo # Global - expect "autocommit" +SELECT @@global.session_track_system_variables; +--echo +--echo # Session - expect "autocommit" +SELECT @@session.session_track_system_variables; +--echo + +--echo # Switching to the default connection. +connection default; + +SELECT @@global.session_track_system_variables; +SELECT @@session.session_track_system_variables; +--echo + +--echo # Test if DEFAULT is working as expected. +SET @@global.session_track_system_variables = DEFAULT; +SET @@session.session_track_system_variables = DEFAULT; +--echo + +SELECT @@global.session_track_system_variables; +SELECT @@session.session_track_system_variables; +--echo + +--echo # Variables' values in a new session (con2). +connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); + +SELECT @@global.session_track_system_variables; +SELECT @@session.session_track_system_variables; +--echo + +--echo # Altering session should not affect global. +SET @@session.session_track_system_variables = 'sql_mode'; +SELECT @@global.session_track_system_variables; +SELECT @@session.session_track_system_variables; +--echo + +--echo # Variables' values in a new session (con3). +connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); + +--echo # Altering global should not affect session. +SET @@global.session_track_system_variables = 'sql_mode'; +SELECT @@global.session_track_system_variables; +SELECT @@session.session_track_system_variables; +--echo + +--echo # Switching to the default connection. +connection default; + +--echo # Testing NULL +SET @@global.session_track_system_variables = NULL; +SET @@session.session_track_system_variables = NULL; + +--echo # Global - expect "" instead of NULL +SELECT @@global.session_track_system_variables; +--echo # Session - expect "" instead of NULL +SELECT @@session.session_track_system_variables; + +--echo # testing with duplicate entries. +# Lets first set it to some valid value. +SET @@global.session_track_system_variables= "time_zone"; +SET @@session.session_track_system_variables= "time_zone"; +# Now set with duplicate entries (must pass) +SET @@global.session_track_system_variables= "sql_mode,sql_mode"; +SET @@session.session_track_system_variables= "sql_mode,sql_mode"; +SELECT @@global.session_track_system_variables; +SELECT @@session.session_track_system_variables; +--echo + +--echo # testing ordering +SET @@global.session_track_system_variables= "time_zone,sql_mode"; +SET @@session.session_track_system_variables= "time_zone,sql_mode"; +SELECT @@global.session_track_system_variables; +SELECT @@session.session_track_system_variables; +--echo + +--echo # special values +SET @@global.session_track_system_variables= "*"; +SET @@session.session_track_system_variables= "*"; +SELECT @@global.session_track_system_variables; +SELECT @@session.session_track_system_variables; +SET @@global.session_track_system_variables= ""; +SET @@session.session_track_system_variables= ""; +SELECT @@global.session_track_system_variables; +SELECT @@session.session_track_system_variables; +--echo + + +--echo # Restoring the original values. +SET @@global.session_track_system_variables = @global_saved_tmp; + +--echo # End of tests. |