From 0680eeae05295c2a343ef3d239a7e5983499643b Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Wed, 13 Aug 2014 11:29:13 -0400 Subject: [PATCH] Test modifications * Added a basic test for wsrep_sync_wait system variable. * Separate innodb_load_xa tests for wsrep and non-wsrep builds. * Updated file_contents.test with correct file location * Some coding style related changes. --- mysql-test/r/innodb_load_xa_with_wsrep.result | 19 +++++++ mysql-test/r/mysqld--help.result | 10 +++- .../sys_vars/r/wsrep_sync_wait_basic.result | 56 +++++++++++++++++++ .../sys_vars/t/wsrep_sync_wait_basic.test | 47 ++++++++++++++++ mysql-test/t/file_contents.test | 2 +- mysql-test/t/innodb_load_xa.test | 1 + mysql-test/t/innodb_load_xa_with_wsrep.opt | 1 + mysql-test/t/innodb_load_xa_with_wsrep.test | 19 +++++++ sql/sys_vars.cc | 17 +++--- 9 files changed, 161 insertions(+), 11 deletions(-) create mode 100644 mysql-test/r/innodb_load_xa_with_wsrep.result create mode 100644 mysql-test/suite/sys_vars/r/wsrep_sync_wait_basic.result create mode 100644 mysql-test/suite/sys_vars/t/wsrep_sync_wait_basic.test create mode 100644 mysql-test/t/innodb_load_xa_with_wsrep.opt create mode 100644 mysql-test/t/innodb_load_xa_with_wsrep.test diff --git a/mysql-test/r/innodb_load_xa_with_wsrep.result b/mysql-test/r/innodb_load_xa_with_wsrep.result new file mode 100644 index 00000000000..90faf766145 --- /dev/null +++ b/mysql-test/r/innodb_load_xa_with_wsrep.result @@ -0,0 +1,19 @@ +install plugin innodb soname 'ha_innodb'; +select engine,support,transactions,xa from information_schema.engines where engine='innodb'; +engine support transactions xa +InnoDB YES YES YES +create table t1 (a int) engine=innodb; +start transaction; +insert t1 values (1); +insert t1 values (2); +commit; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000001 # Gtid # # GTID #-#-# +mysqld-bin.000001 # Query # # use `test`; create table t1 (a int) engine=innodb +mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-# +mysqld-bin.000001 # Query # # use `test`; insert t1 values (1) +mysqld-bin.000001 # Query # # use `test`; insert t1 values (2) +mysqld-bin.000001 # Xid # # COMMIT /* XID */ +drop table t1; +uninstall plugin innodb; diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 99e1a86aa68..3f1e26822c1 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1058,8 +1058,8 @@ The following options may be given as the first argument: variables (Defaults to on; use --skip-wsrep-auto-increment-control to disable.) --wsrep-causal-reads - Enable "strictly synchronous" semantics for read - operations + (DEPRECATED) Setting this variable is equivalent to + setting wsrep_sync_wait READ flag --wsrep-certify-nonPK Certify tables with no primary key (Defaults to on; use --skip-wsrep-certify-nonPK to disable.) @@ -1133,6 +1133,11 @@ The following options may be given as the first argument: Address where node is waiting for SST contact --wsrep-start-position=name global transaction position to start from + --wsrep-sync-wait[=#] + Ensure "synchronous" read view before executing an + operation of the type specified by bitmask: 1 - + READ(includes SELECT, SHOW and BEGIN/START TRANSACTION); + 2 - UPDATE and DELETE; 4 - INSERT and REPLACE Variables (--variable-name=value) allow-suspicious-udfs FALSE @@ -1468,6 +1473,7 @@ wsrep-sst-donor-rejects-queries FALSE wsrep-sst-method rsync wsrep-sst-receive-address AUTO wsrep-start-position 00000000-0000-0000-0000-000000000000:-1 +wsrep-sync-wait 0 To see what values a running MySQL server is using, type 'mysqladmin variables' instead of 'mysqld --verbose --help'. diff --git a/mysql-test/suite/sys_vars/r/wsrep_sync_wait_basic.result b/mysql-test/suite/sys_vars/r/wsrep_sync_wait_basic.result new file mode 100644 index 00000000000..1e7b9364570 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/wsrep_sync_wait_basic.result @@ -0,0 +1,56 @@ +# +# wsrep_sync_wait +# +# save the initial values +SET @wsrep_sync_wait_global_saved = @@global.wsrep_sync_wait; +SET @wsrep_sync_wait_session_saved = @@session.wsrep_sync_wait; +# default +SELECT @@global.wsrep_sync_wait; +@@global.wsrep_sync_wait +0 +SELECT @@session.wsrep_sync_wait; +@@session.wsrep_sync_wait +0 + +# scope and valid values +SET @@global.wsrep_sync_wait=0; +SELECT @@global.wsrep_sync_wait; +@@global.wsrep_sync_wait +0 +SET @@global.wsrep_sync_wait=7; +SELECT @@global.wsrep_sync_wait; +@@global.wsrep_sync_wait +7 +SET @@session.wsrep_sync_wait=0; +SELECT @@session.wsrep_sync_wait; +@@session.wsrep_sync_wait +0 +SET @@session.wsrep_sync_wait=7; +SELECT @@session.wsrep_sync_wait; +@@session.wsrep_sync_wait +7 +SET @@session.wsrep_sync_wait=default; +SELECT @@session.wsrep_sync_wait; +@@session.wsrep_sync_wait +7 +SET @@session.wsrep_sync_wait=8; +Warnings: +Warning 1292 Truncated incorrect wsrep_sync_wait value: '8' +SELECT @@session.wsrep_sync_wait; +@@session.wsrep_sync_wait +7 + +# invalid values +SET @@global.wsrep_sync_wait=NULL; +ERROR 42000: Incorrect argument type to variable 'wsrep_sync_wait' +SET @@global.wsrep_sync_wait='junk'; +ERROR 42000: Incorrect argument type to variable 'wsrep_sync_wait' +SET @@session.wsrep_sync_wait=NULL; +ERROR 42000: Incorrect argument type to variable 'wsrep_sync_wait' +SET @@session.wsrep_sync_wait='junk'; +ERROR 42000: Incorrect argument type to variable 'wsrep_sync_wait' + +# restore the initial values +SET @@global.wsrep_sync_wait = @wsrep_sync_wait_global_saved; +SET @@session.wsrep_sync_wait = @wsrep_sync_wait_session_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_sync_wait_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sync_wait_basic.test new file mode 100644 index 00000000000..cd0d545f80e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/wsrep_sync_wait_basic.test @@ -0,0 +1,47 @@ +--source include/have_wsrep.inc + +--echo # +--echo # wsrep_sync_wait +--echo # + +--echo # save the initial values +SET @wsrep_sync_wait_global_saved = @@global.wsrep_sync_wait; +SET @wsrep_sync_wait_session_saved = @@session.wsrep_sync_wait; + +--echo # default +SELECT @@global.wsrep_sync_wait; +SELECT @@session.wsrep_sync_wait; + +--echo +--echo # scope and valid values +SET @@global.wsrep_sync_wait=0; +SELECT @@global.wsrep_sync_wait; +SET @@global.wsrep_sync_wait=7; +SELECT @@global.wsrep_sync_wait; + +SET @@session.wsrep_sync_wait=0; +SELECT @@session.wsrep_sync_wait; +SET @@session.wsrep_sync_wait=7; +SELECT @@session.wsrep_sync_wait; +SET @@session.wsrep_sync_wait=default; +SELECT @@session.wsrep_sync_wait; +SET @@session.wsrep_sync_wait=8; +SELECT @@session.wsrep_sync_wait; + +--echo +--echo # invalid values +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_sync_wait=NULL; +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.wsrep_sync_wait='junk'; +--error ER_WRONG_TYPE_FOR_VAR +SET @@session.wsrep_sync_wait=NULL; +--error ER_WRONG_TYPE_FOR_VAR +SET @@session.wsrep_sync_wait='junk'; + +--echo +--echo # restore the initial values +SET @@global.wsrep_sync_wait = @wsrep_sync_wait_global_saved; +SET @@session.wsrep_sync_wait = @wsrep_sync_wait_session_saved; + +--echo # End of test diff --git a/mysql-test/t/file_contents.test b/mysql-test/t/file_contents.test index f52f0a93c82..c62b70b312b 100644 --- a/mysql-test/t/file_contents.test +++ b/mysql-test/t/file_contents.test @@ -30,7 +30,7 @@ if ($dir_bin eq '/usr/') { $dir_docs = glob "$dir_docs/packages/MySQL-server*"; } else { # RedHat/Debian: version number in directory name - $dir_docs = glob "$dir_docs/mariadb-server-*"; + $dir_docs = glob "$dir_docs/mariadb-galera-server-*"; $dir_docs = glob "$dir_docs/MySQL-server*" unless -d $dir_docs; } # Slackware diff --git a/mysql-test/t/innodb_load_xa.test b/mysql-test/t/innodb_load_xa.test index 52862151b22..7eac20441ca 100644 --- a/mysql-test/t/innodb_load_xa.test +++ b/mysql-test/t/innodb_load_xa.test @@ -2,6 +2,7 @@ # MDEV-6082 Assertion `0' fails in TC_LOG_DUMMY::log_and_order on DML after installing TokuDB at runtime on server with disabled InnoDB # --source include/not_embedded.inc +--source include/not_wsrep.inc if (!$HA_INNODB_SO) { --skip Need InnoDB plugin diff --git a/mysql-test/t/innodb_load_xa_with_wsrep.opt b/mysql-test/t/innodb_load_xa_with_wsrep.opt new file mode 100644 index 00000000000..4ff27e659ce --- /dev/null +++ b/mysql-test/t/innodb_load_xa_with_wsrep.opt @@ -0,0 +1 @@ +--ignore-builtin-innodb --loose-innodb --log-bin diff --git a/mysql-test/t/innodb_load_xa_with_wsrep.test b/mysql-test/t/innodb_load_xa_with_wsrep.test new file mode 100644 index 00000000000..413faf54864 --- /dev/null +++ b/mysql-test/t/innodb_load_xa_with_wsrep.test @@ -0,0 +1,19 @@ +# +# MDEV-6082 Assertion `0' fails in TC_LOG_DUMMY::log_and_order on DML after installing TokuDB at runtime on server with disabled InnoDB +# +--source include/not_embedded.inc +--source include/have_wsrep.inc + +if (!$HA_INNODB_SO) { + --skip Need InnoDB plugin +} +install plugin innodb soname 'ha_innodb'; +select engine,support,transactions,xa from information_schema.engines where engine='innodb'; +create table t1 (a int) engine=innodb; +start transaction; +insert t1 values (1); +insert t1 values (2); +commit; +--source include/show_binlog_events.inc +drop table t1; +uninstall plugin innodb; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 895e4b2a002..71ef76bd82c 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -4664,19 +4664,20 @@ static Sys_var_mybool Sys_wsrep_certify_nonPK( CMD_LINE(OPT_ARG), DEFAULT(TRUE)); static Sys_var_mybool Sys_wsrep_causal_reads( - "wsrep_causal_reads", "(DEPRECATED) setting this variable is equivalent to setting wsrep_sync_wait READ flag", - SESSION_VAR(wsrep_causal_reads), - CMD_LINE(OPT_ARG), DEFAULT(FALSE), + "wsrep_causal_reads", "(DEPRECATED) Setting this variable is equivalent " + "to setting wsrep_sync_wait READ flag", + SESSION_VAR(wsrep_causal_reads), CMD_LINE(OPT_ARG), DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(wsrep_causal_reads_update)); static Sys_var_uint Sys_wsrep_sync_wait( - "wsrep_sync_wait", "Ensure \"synchronous\" read view before executing an operation of the type specified by bitmask: 1 - READ(includes SELECT, SHOW and BEGIN/START TRANSACTION); 2 - UPDATE and DELETE; 4 - INSERT and REPLACE", - SESSION_VAR(wsrep_sync_wait), - CMD_LINE(OPT_ARG), + "wsrep_sync_wait", "Ensure \"synchronous\" read view before executing " + "an operation of the type specified by bitmask: 1 - READ(includes " + "SELECT, SHOW and BEGIN/START TRANSACTION); 2 - UPDATE and DELETE; 4 - " + "INSERT and REPLACE", + SESSION_VAR(wsrep_sync_wait), CMD_LINE(OPT_ARG), VALID_RANGE(WSREP_SYNC_WAIT_NONE, WSREP_SYNC_WAIT_MAX), - DEFAULT(WSREP_SYNC_WAIT_NONE), - BLOCK_SIZE(1), + DEFAULT(WSREP_SYNC_WAIT_NONE), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(wsrep_sync_wait_update));