diff --git a/mysql-test/include/have_innodb.inc b/mysql-test/include/have_innodb.inc index cbffe6a2574..8944cc46f3e 100644 --- a/mysql-test/include/have_innodb.inc +++ b/mysql-test/include/have_innodb.inc @@ -1,4 +1,4 @@ disable_query_log; --require r/true.require -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'innodb'; +select (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` from information_schema.engines where engine = 'innodb'; enable_query_log; diff --git a/mysql-test/include/have_multi_ndb.inc b/mysql-test/include/have_multi_ndb.inc index 1ea951676b3..8b1c39825bc 100644 --- a/mysql-test/include/have_multi_ndb.inc +++ b/mysql-test/include/have_multi_ndb.inc @@ -4,18 +4,26 @@ connect (server2,127.0.0.1,root,,test,$MASTER_MYPORT1,); # Check that server1 has NDB support connection server1; +let $engines_table= query_get_value(SHOW TABLES FROM information_schema LIKE 'engines', Tables_in_information_schema (engines), 1); disable_query_log; +if (`SELECT 1 FROM dual WHERE '$engines_table' = 'engines'`) +{ --require r/true.require -select (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` from information_schema.engines where engine = 'ndbcluster'; +SELECT (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; --source include/ndb_not_readonly.inc +} enable_query_log; # Check that server2 has NDB support connection server2; +let $engines_table= query_get_value(SHOW TABLES FROM information_schema LIKE 'engines', Tables_in_information_schema (engines), 1); disable_query_log; +if (`SELECT 1 FROM dual WHERE '$engines_table' = 'engines'`) +{ --require r/true.require -select (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` from information_schema.engines where engine = 'ndbcluster'; +SELECT (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; --source include/ndb_not_readonly.inc +} enable_query_log; # cleanup diff --git a/mysql-test/r/rpl_drop_view.result b/mysql-test/r/rpl_drop_view.result deleted file mode 100644 index ef625464881..00000000000 --- a/mysql-test/r/rpl_drop_view.result +++ /dev/null @@ -1,27 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -drop table if exists t1, t2; -drop view if exists v1, v2, v3, not_exist_view; -create table t1 (a int); -create table t2 (b int); -create table t3 (c int); -create view v1 as select * from t1; -create view v2 as select * from t2; -create view v3 as select * from t3; -drop view not_exist_view; -ERROR 42S02: Unknown table 'not_exist_view' -drop view v1, not_exist_view; -ERROR 42S02: Unknown table 'not_exist_view' -select * from v1; -ERROR 42S02: Table 'test.v1' doesn't exist -drop view v2, v3; -select * from v1; -ERROR 42S02: Table 'test.v1' doesn't exist -select * from v2; -ERROR 42S02: Table 'test.v2' doesn't exist -select * from v3; -ERROR 42S02: Table 'test.v3' doesn't exist diff --git a/mysql-test/suite/rpl/r/rpl_create_database.result b/mysql-test/suite/rpl/r/rpl_create_database.result index 0cfd44bc58c..9780b65f334 100644 --- a/mysql-test/suite/rpl/r/rpl_create_database.result +++ b/mysql-test/suite/rpl/r/rpl_create_database.result @@ -20,21 +20,17 @@ INSERT INTO t2 VALUES(2); ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1; USE mysqltest_sisyfos; ALTER DATABASE mysqltest_bob CHARACTER SET latin1; -SHOW DATABASES; -Database -information_schema +SHOW DATABASES LIKE 'mysql%'; +Database (mysql%) mysql mysqltest_bob mysqltest_prometheus mysqltest_sisyfos -test -SHOW DATABASES; -Database -information_schema +SHOW DATABASES LIKE 'mysql%'; +Database (mysql%) mysql mysqltest_prometheus mysqltest_sisyfos -test DROP DATABASE IF EXISTS mysqltest_sisyfos; USE mysqltest_prometheus; CREATE TABLE t1 (a INT); @@ -42,21 +38,17 @@ INSERT INTO t1 VALUES (1); CREATE DATABASE mysqltest_sisyfos; USE mysqltest_sisyfos; CREATE TABLE t2 (a INT); -SHOW DATABASES; -Database -information_schema +SHOW DATABASES LIKE 'mysql%'; +Database (mysql%) mysql mysqltest_bob mysqltest_prometheus mysqltest_sisyfos -test -SHOW DATABASES; -Database -information_schema +SHOW DATABASES LIKE 'mysql%'; +Database (mysql%) mysql mysqltest_prometheus mysqltest_sisyfos -test USE mysqltest_prometheus; SHOW TABLES; Tables_in_mysqltest_prometheus diff --git a/mysql-test/suite/rpl/r/rpl_load_from_master.result b/mysql-test/suite/rpl/r/rpl_load_from_master.result index 08b45ec1db0..e1c2ecb35be 100644 --- a/mysql-test/suite/rpl/r/rpl_load_from_master.result +++ b/mysql-test/suite/rpl/r/rpl_load_from_master.result @@ -30,13 +30,11 @@ drop database mysqltest2; set sql_log_bin = 0; create database mysqltest2; create database mysqltest; -show databases; -Database -information_schema +show databases like 'mysql%'; +Database (mysql%) mysql mysqltest mysqltest2 -test create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM; create table mysqltest2.t2(n int, s text)ENGINE=MyISAM; insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three'); @@ -47,11 +45,9 @@ insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three tes insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'), (13, 'thirteen test'); set sql_log_bin = 1; -show databases; -Database -information_schema +show databases like 'mysql%'; +Database (mysql%) mysql -test create database mysqltest2; create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM; insert into mysqltest2.t1 values (1, 'original foo.t1'); @@ -66,14 +62,12 @@ insert into mysqltest.t1 values (1, 'original bar.t1'); create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM; insert into mysqltest.t3 values (1, 'original bar.t3'); load data from master; -show databases; -Database -information_schema +show databases like 'mysql%'; +Database (mysql%) mysql mysqltest mysqltest2 mysqltest3 -test use mysqltest2; show tables; Tables_in_mysqltest2 diff --git a/mysql-test/suite/rpl/r/rpl_server_id.result b/mysql-test/suite/rpl/r/rpl_server_id.result new file mode 100644 index 00000000000..1e74394c122 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_server_id.result @@ -0,0 +1,34 @@ +set global server_id=1; +reset master; +drop table if exists t1,t2,t3; +create table t1 (a int); +select @@server_id; +@@server_id +1 +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; drop table if exists t1,t2,t3 +master-bin.000001 # Query 1 # use `test`; create table t1 (a int) +set global server_id=2; +create table t2 (b int); +select @@server_id; +@@server_id +2 +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; drop table if exists t1,t2,t3 +master-bin.000001 # Query 1 # use `test`; create table t1 (a int) +master-bin.000001 # Query 2 # use `test`; create table t2 (b int) +set global server_id=3; +create table t3 (c int); +select @@server_id; +@@server_id +3 +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; drop table if exists t1,t2,t3 +master-bin.000001 # Query 1 # use `test`; create table t1 (a int) +master-bin.000001 # Query 2 # use `test`; create table t2 (b int) +master-bin.000001 # Query 3 # use `test`; create table t3 (c int) +set global server_id=1; +drop table t1,t2,t3; diff --git a/mysql-test/suite/rpl/t/rpl_create_database.test b/mysql-test/suite/rpl/t/rpl_create_database.test index 70cff8daca2..e3e2e637594 100644 --- a/mysql-test/suite/rpl/t/rpl_create_database.test +++ b/mysql-test/suite/rpl/t/rpl_create_database.test @@ -42,9 +42,9 @@ USE mysqltest_sisyfos; # The following should *not* be replicated ALTER DATABASE mysqltest_bob CHARACTER SET latin1; -SHOW DATABASES; +SHOW DATABASES LIKE 'mysql%'; sync_slave_with_master; -SHOW DATABASES; +SHOW DATABASES LIKE 'mysql%'; connection master; DROP DATABASE IF EXISTS mysqltest_sisyfos; @@ -55,9 +55,9 @@ CREATE DATABASE mysqltest_sisyfos; USE mysqltest_sisyfos; CREATE TABLE t2 (a INT); let $VERSION=`select version()`; -SHOW DATABASES; +SHOW DATABASES LIKE 'mysql%'; sync_slave_with_master; -SHOW DATABASES; +SHOW DATABASES LIKE 'mysql%'; USE mysqltest_prometheus; SHOW TABLES; USE mysqltest_sisyfos; diff --git a/mysql-test/suite/rpl/t/rpl_load_from_master.test b/mysql-test/suite/rpl/t/rpl_load_from_master.test index 9bab7d5696e..b04d8a44226 100644 --- a/mysql-test/suite/rpl/t/rpl_load_from_master.test +++ b/mysql-test/suite/rpl/t/rpl_load_from_master.test @@ -54,7 +54,7 @@ connection master; set sql_log_bin = 0; create database mysqltest2; create database mysqltest; -show databases; +show databases like 'mysql%'; create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM; create table mysqltest2.t2(n int, s text)ENGINE=MyISAM; insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three'); @@ -71,7 +71,7 @@ connection slave; sync_with_master; # This should show that the slave is empty at this point -show databases; +show databases like 'mysql%'; # Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM # MASTER will neither touch database mysqltest nor mysqltest3 create database mysqltest2; @@ -95,7 +95,7 @@ insert into mysqltest.t3 values (1, 'original bar.t3'); load data from master; # Now let's check if we have the right tables and the right data in them -show databases; +show databases like 'mysql%'; use mysqltest2; # LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which diff --git a/mysql-test/suite/rpl/t/rpl_server_id.test b/mysql-test/suite/rpl/t/rpl_server_id.test new file mode 100644 index 00000000000..6e98ec6ee6d --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_server_id.test @@ -0,0 +1,29 @@ +# Test for BUG#28908 Replication: set global server_id is not setting the session server_id + +-- source include/have_log_bin.inc + +let $saved_server_id=`select @@server_id`; +set global server_id=1; +reset master; + +-- disable_warnings +drop table if exists t1,t2,t3; +-- enable_warnings + +create table t1 (a int); +select @@server_id; +source include/show_binlog_events2.inc; + +set global server_id=2; +create table t2 (b int); +select @@server_id; +source include/show_binlog_events2.inc; + +set global server_id=3; +create table t3 (c int); +select @@server_id; +source include/show_binlog_events2.inc; + +# cleanup +eval set global server_id=$saved_server_id; +drop table t1,t2,t3; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result index c758e05d6c2..94ba40478e0 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result @@ -94,46 +94,21 @@ a 1 --- on slave --- STOP SLAVE; -SHOW SLAVE STATUS; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port MASTER_PORT -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running No -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table # -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 0 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno # -Last_IO_Error # -Last_SQL_Errno 0 -Last_SQL_Error +SELECT "" AS Slave_IO_State; +Slave_IO_State + +SELECT "" AS Last_SQL_Error; +Last_SQL_Error + +SELECT "" AS Last_IO_Error; +Last_IO_Error + SELECT * FROM tinnodb ORDER BY a; a -DROP TABLE tmyisam, tinnodb, tndb; -DROP TABLE tmyisam, tinnodb, tndb; +DROP TABLE tmyisam; +DROP TABLE tinnodb; +DROP TABLE tndb; +--- on master --- +DROP TABLE tmyisam; +DROP TABLE tinnodb; +DROP TABLE tndb; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test index 4811acf2fe1..8e9daa04914 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test @@ -81,10 +81,10 @@ SELECT * FROM tmyisam ORDER BY a; # the statement, and slave should roll back later when master is # restarted. -# However, we the master to be alive so that we are sure it replicates -# the statement to the slave. So in the test case, we must therefore -# not crash the master. Instead, we fake the crash by just not writing -# the XID event to the binlog. This is done by the +# However, we want the master to be alive so that we are sure it +# replicates the statement to the slave. So in the test case, we must +# therefore not crash the master. Instead, we fake the crash by just +# not writing the XID event to the binlog. This is done by the # --debug=d,do_not_write_xid flag in the .opt file. # So, unlike if the master had crashed, the master *will* execute the @@ -110,13 +110,23 @@ SELECT * FROM tinnodb ORDER BY a; --connection slave --sleep 3 STOP SLAVE; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # -query_vertical SHOW SLAVE STATUS; -# the following statement should show that nothing has been replicated +source include/wait_for_slave_to_stop.inc; +let $tmp= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1); +eval SELECT "$tmp" AS Slave_IO_State; +let $tmp= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); +eval SELECT "$tmp" AS Last_SQL_Error; +let $tmp= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1); +eval SELECT "$tmp" AS Last_IO_Error; SELECT * FROM tinnodb ORDER BY a; -# clean up +# Clean up. We cannot do it on master and replicate over, because +# master binlog is in a bad state after last test. So we do it both on +# master and on slave. +DROP TABLE tmyisam; +DROP TABLE tinnodb; +DROP TABLE tndb; +--echo --- on master --- +connection master; connection master; DROP TABLE tmyisam, tinnodb, tndb; diff --git a/mysql-test/t/rpl_drop_view.test b/mysql-test/t/rpl_drop_view.test deleted file mode 100644 index 8d826b8214d..00000000000 --- a/mysql-test/t/rpl_drop_view.test +++ /dev/null @@ -1,31 +0,0 @@ -# test case for bug#30998 -# Drop View breaks replication if view does not exist -# - -source include/master-slave.inc; ---disable_warnings -drop table if exists t1, t2; -drop view if exists v1, v2, v3, not_exist_view; ---enable_warnings -create table t1 (a int); -create table t2 (b int); -create table t3 (c int); -create view v1 as select * from t1; -create view v2 as select * from t2; -create view v3 as select * from t3; ---error 1051 -drop view not_exist_view; ---error 1051 -drop view v1, not_exist_view; ---error 1146 -select * from v1; -drop view v2, v3; -save_master_pos; -connection slave; -sync_with_master; ---error 1146 -select * from v1; ---error 1146 -select * from v2; ---error 1146 -select * from v3; diff --git a/sql/set_var.cc b/sql/set_var.cc index d24cf70afe0..0f3e99a137b 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1191,6 +1191,7 @@ static void fix_trans_mem_root(THD *thd, enum_var_type type) static void fix_server_id(THD *thd, enum_var_type type) { server_id_supplied = 1; + thd->server_id= server_id; }