diff options
Diffstat (limited to 'mysql-test/include')
27 files changed, 247 insertions, 54 deletions
diff --git a/mysql-test/include/have_archive.inc b/mysql-test/include/have_archive.inc index 9f0038db97a..82399ca4c6c 100644 --- a/mysql-test/include/have_archive.inc +++ b/mysql-test/include/have_archive.inc @@ -1,4 +1,4 @@ --disable_query_log --require r/true.require -select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'archive'; +select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'archive'; --enable_query_log diff --git a/mysql-test/include/have_binlog_format_mixed.inc b/mysql-test/include/have_binlog_format_mixed.inc index fc5ca61c5a0..fc1dc8324c6 100644 --- a/mysql-test/include/have_binlog_format_mixed.inc +++ b/mysql-test/include/have_binlog_format_mixed.inc @@ -1,3 +1,5 @@ +--source include/have_log_bin.inc + -- require r/have_binlog_format_mixed.require disable_query_log; show variables like "binlog_format"; diff --git a/mysql-test/include/have_binlog_format_mixed_or_row.inc b/mysql-test/include/have_binlog_format_mixed_or_row.inc index c38b8f3d601..fcba9eef883 100644 --- a/mysql-test/include/have_binlog_format_mixed_or_row.inc +++ b/mysql-test/include/have_binlog_format_mixed_or_row.inc @@ -1,3 +1,5 @@ +--source include/have_log_bin.inc + --require r/have_binlog_format_row.require --disable_query_log --replace_result MIXED ROW diff --git a/mysql-test/include/have_binlog_format_mixed_or_statement.inc b/mysql-test/include/have_binlog_format_mixed_or_statement.inc index 8ee6f2cc030..700b58a77fb 100644 --- a/mysql-test/include/have_binlog_format_mixed_or_statement.inc +++ b/mysql-test/include/have_binlog_format_mixed_or_statement.inc @@ -1,3 +1,6 @@ +source include/have_log_bin.inc; + + --require r/have_binlog_format_statement.require --disable_query_log --replace_result MIXED STATEMENT diff --git a/mysql-test/include/have_binlog_format_row.inc b/mysql-test/include/have_binlog_format_row.inc index 2992b8e0f32..f24bca52b5a 100644 --- a/mysql-test/include/have_binlog_format_row.inc +++ b/mysql-test/include/have_binlog_format_row.inc @@ -1,3 +1,5 @@ +--source include/have_log_bin.inc + -- require r/have_binlog_format_row.require disable_query_log; show variables like "binlog_format"; diff --git a/mysql-test/include/have_binlog_format_statement.inc b/mysql-test/include/have_binlog_format_statement.inc index c99297c10e5..ca863293d1d 100644 --- a/mysql-test/include/have_binlog_format_statement.inc +++ b/mysql-test/include/have_binlog_format_statement.inc @@ -1,3 +1,5 @@ +--source include/have_log_bin.inc + -- require r/have_binlog_format_statement.require disable_query_log; show variables like "binlog_format"; diff --git a/mysql-test/include/have_blackhole.inc b/mysql-test/include/have_blackhole.inc index e13cff52094..6c4da01d61d 100644 --- a/mysql-test/include/have_blackhole.inc +++ b/mysql-test/include/have_blackhole.inc @@ -1,4 +1,4 @@ disable_query_log; --require r/true.require -select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'blackhole'; +select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'blackhole'; enable_query_log; diff --git a/mysql-test/include/have_csv.inc b/mysql-test/include/have_csv.inc index 3175fc16fe7..410caa95285 100644 --- a/mysql-test/include/have_csv.inc +++ b/mysql-test/include/have_csv.inc @@ -1,4 +1,4 @@ disable_query_log; --require r/true.require -select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'csv'; +select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'csv'; enable_query_log; diff --git a/mysql-test/include/have_exampledb.inc b/mysql-test/include/have_exampledb.inc index e3fd068b485..db3985e3c7c 100644 --- a/mysql-test/include/have_exampledb.inc +++ b/mysql-test/include/have_exampledb.inc @@ -1,4 +1,4 @@ disable_query_log; --require r/true.require -select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'example'; +select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'example'; enable_query_log; diff --git a/mysql-test/include/have_federated_db.inc b/mysql-test/include/have_federated_db.inc index abef5a64d30..041a29f460b 100644 --- a/mysql-test/include/have_federated_db.inc +++ b/mysql-test/include/have_federated_db.inc @@ -1,4 +1,4 @@ disable_query_log; --require r/true.require -select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'federated'; +select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'federated'; enable_query_log; diff --git a/mysql-test/include/have_innodb.inc b/mysql-test/include/have_innodb.inc index be8850725e5..cbffe6a2574 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 = 'Enabled' as `TRUE` from information_schema.engines where engine = 'innodb'; +select (support = 'YES' or support = 'DEFAULT') 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 819518b2674..e9baf7d56e5 100644 --- a/mysql-test/include/have_multi_ndb.inc +++ b/mysql-test/include/have_multi_ndb.inc @@ -10,7 +10,7 @@ drop table if exists t1, t2; --enable_warnings flush tables; --require r/true.require -select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; +select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster'; enable_query_log; # Check that server2 has NDB support @@ -21,7 +21,7 @@ drop table if exists t1, t2; --enable_warnings flush tables; --require r/true.require -select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; +select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster'; enable_query_log; # Check should be here as well... diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc index c9603634508..638a88f3956 100644 --- a/mysql-test/include/have_ndb.inc +++ b/mysql-test/include/have_ndb.inc @@ -1,7 +1,7 @@ # Check that server is compiled and started with support for NDB disable_query_log; --require r/true.require -select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; +select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster'; enable_query_log; diff --git a/mysql-test/include/is_debug_build.inc b/mysql-test/include/is_debug_build.inc deleted file mode 100644 index 23a2814e2bb..00000000000 --- a/mysql-test/include/is_debug_build.inc +++ /dev/null @@ -1,4 +0,0 @@ --- require r/is_debug_build.require ---disable_query_log -select instr(version(), "debug") > 0; ---enable_query_log diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index fe1dacb433e..e0eb87f02f7 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -1,3 +1,6 @@ +# Replication tests need binlog +source include/have_log_bin.inc; + connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc index 3c6628091ec..cc2f0e0588e 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -641,6 +641,37 @@ alter table t1 comment '123'; show create table t1; drop table t1; +# +# Bug #25866: Getting "#HY000 Can't find record in..." on and INSERT +# +CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8; +INSERT INTO t1 VALUES ('uk'),('bg'); +SELECT * FROM t1 WHERE a = 'uk'; +DELETE FROM t1 WHERE a = 'uk'; +SELECT * FROM t1 WHERE a = 'uk'; +UPDATE t1 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t1 WHERE a = 'uk'; + +CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB; +INSERT INTO t2 VALUES ('uk'),('bg'); +SELECT * FROM t2 WHERE a = 'uk'; +DELETE FROM t2 WHERE a = 'uk'; +SELECT * FROM t2 WHERE a = 'uk'; +INSERT INTO t2 VALUES ('uk'); +UPDATE t2 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t2 WHERE a = 'uk'; + +CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM; +INSERT INTO t3 VALUES ('uk'),('bg'); +SELECT * FROM t3 WHERE a = 'uk'; +DELETE FROM t3 WHERE a = 'uk'; +SELECT * FROM t3 WHERE a = 'uk'; +INSERT INTO t3 VALUES ('uk'); +UPDATE t3 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t3 WHERE a = 'uk'; + +DROP TABLE t1,t2,t3; + --echo End of 5.0 tests # @@ -649,24 +680,24 @@ drop table t1; CREATE TABLE t1 (a int, b int); insert into t1 values (1,1),(1,2); ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY CREATE TABLE t2 (primary key (a)) select * from t1; # This should give warning drop table if exists t2; ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1; # This should give warning drop table if exists t2; CREATE TABLE t2 (a int, b int, primary key (a)); BEGIN; INSERT INTO t2 values(100,100); ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; SELECT * from t2; ROLLBACK; SELECT * from t2; TRUNCATE table t2; ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY INSERT INTO t2 select * from t1; SELECT * from t2; drop table t2; @@ -674,19 +705,19 @@ drop table t2; CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)); BEGIN; INSERT INTO t2 values(100,100); ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; SELECT * from t2; COMMIT; BEGIN; INSERT INTO t2 values(101,101); ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; SELECT * from t2; ROLLBACK; SELECT * from t2; TRUNCATE table t2; ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY INSERT INTO t2 select * from t1; SELECT * from t2; drop table t1,t2; diff --git a/mysql-test/include/mix2.inc b/mysql-test/include/mix2.inc index 76666cb7bc0..b4c4a9b8836 100644 --- a/mysql-test/include/mix2.inc +++ b/mysql-test/include/mix2.inc @@ -96,7 +96,7 @@ INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2), update t1 set parent_id=parent_id+100; select * from t1 where parent_id=102; update t1 set id=id+1000; --- error ER_DUP_ENTRY_WITH_KEY_NAME,1022 +-- error ER_DUP_ENTRY,1022 update t1 set id=1024 where id=1009; select * from t1; update ignore t1 set id=id+1; # This will change all rows @@ -179,13 +179,13 @@ commit; select n, "after commit" from t1; commit; insert into t1 values (5); --- error ER_DUP_ENTRY_WITH_KEY_NAME +-- error ER_DUP_ENTRY insert into t1 values (4); commit; select n, "after commit" from t1; set autocommit=1; insert into t1 values (6); --- error ER_DUP_ENTRY_WITH_KEY_NAME +-- error ER_DUP_ENTRY insert into t1 values (4); select n from t1; set autocommit=0; @@ -259,7 +259,7 @@ drop table t1; eval CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=$engine_type; insert into t1 values ('pippo', 12); --- error ER_DUP_ENTRY_WITH_KEY_NAME +-- error ER_DUP_ENTRY insert into t1 values ('pippo', 12); # Gives error delete from t1; delete from t1 where id = 'pippo'; @@ -390,9 +390,9 @@ eval CREATE TABLE t1 ( insert into t1 (ggid,passwd) values ('test1','xxx'); insert into t1 (ggid,passwd) values ('test2','yyy'); --- error ER_DUP_ENTRY_WITH_KEY_NAME +-- error ER_DUP_ENTRY insert into t1 (ggid,passwd) values ('test2','this will fail'); --- error ER_DUP_ENTRY_WITH_KEY_NAME +-- error ER_DUP_ENTRY insert into t1 (ggid,id) values ('this will fail',1); select * from t1 where ggid='test1'; @@ -401,7 +401,7 @@ select * from t1 where id=2; replace into t1 (ggid,id) values ('this will work',1); replace into t1 (ggid,passwd) values ('test2','this will work'); --- error ER_DUP_ENTRY_WITH_KEY_NAME +-- error ER_DUP_ENTRY update t1 set id=100,ggid='test2' where id=1; select * from t1; select * from t1 where id=1; @@ -572,7 +572,7 @@ drop table t1; eval create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=$engine_type; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); LOCK TABLES t1 WRITE; ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY insert into t1 values (99,1,2,'D'),(1,1,2,'D'); select id from t1; select id from t1; @@ -583,7 +583,7 @@ eval create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 c insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); LOCK TABLES t1 WRITE; begin; ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY insert into t1 values (99,1,2,'D'),(1,1,2,'D'); select id from t1; insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); @@ -1513,7 +1513,7 @@ eval create table t1 (rowid int not null auto_increment, val int not null,primar key (rowid), unique(val)) engine=$engine_type; replace into t1 (val) values ('1'),('2'); replace into t1 (val) values ('1'),('2'); ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY insert into t1 (val) values ('1'),('2'); select * from t1; drop table t1; @@ -1528,7 +1528,7 @@ eval create table t1 (a int not null auto_increment primary key, val int) engine insert into t1 (val) values (1); update t1 set a=2 where a=1; # We should get the following error because InnoDB does not update the counter ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY insert into t1 (val) values (1); select * from t1; drop table t1; @@ -1894,13 +1894,13 @@ eval create table t3 (s1 varchar(2) binary,primary key (s1)) engine=$engine_type eval create table t4 (s1 char(2) binary,primary key (s1)) engine=$engine_type; insert into t1 values (0x41),(0x4120),(0x4100); --- error ER_DUP_ENTRY_WITH_KEY_NAME +-- error ER_DUP_ENTRY insert into t2 values (0x41),(0x4120),(0x4100); insert into t2 values (0x41),(0x4120); --- error ER_DUP_ENTRY_WITH_KEY_NAME +-- error ER_DUP_ENTRY insert into t3 values (0x41),(0x4120),(0x4100); insert into t3 values (0x41),(0x4100); --- error ER_DUP_ENTRY_WITH_KEY_NAME +-- error ER_DUP_ENTRY insert into t4 values (0x41),(0x4120),(0x4100); insert into t4 values (0x41),(0x4100); select hex(s1) from t1; diff --git a/mysql-test/include/ps_modify.inc b/mysql-test/include/ps_modify.inc index 9e38671263f..f66f888261d 100644 --- a/mysql-test/include/ps_modify.inc +++ b/mysql-test/include/ps_modify.inc @@ -193,7 +193,7 @@ prepare stmt1 from 'insert into t1 values(6, ? )'; execute stmt1 using @arg00; select a,b from t1 where b = @arg00; # the second insert fails, because the first column is primary key ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY execute stmt1 using @arg00; set @arg00=NULL ; prepare stmt1 from 'insert into t1 values(0, ? )'; @@ -272,7 +272,7 @@ execute stmt1 using @arg00, @arg01; select * from t1 order by a; set @arg00=81 ; set @arg01=1 ; ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY execute stmt1 using @arg00, @arg01; ## insert, autoincrement column and ' SELECT LAST_INSERT_ID() ' diff --git a/mysql-test/include/query_cache.inc b/mysql-test/include/query_cache.inc index b54976886bd..fdd6bc50eae 100644 --- a/mysql-test/include/query_cache.inc +++ b/mysql-test/include/query_cache.inc @@ -90,7 +90,7 @@ delete from t3 where t1_id = 1 and t2_id = 1; select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc; begin; insert into t3 VALUES ( NULL, 1, 1, 2 ); --- error ER_DUP_ENTRY_WITH_KEY_NAME +-- error ER_DUP_ENTRY insert into t3 VALUES ( NULL, 1, 1, 2 ); commit; select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc; diff --git a/mysql-test/include/rpl_events.inc b/mysql-test/include/rpl_events.inc index 04885f31997..bbe52d3628b 100644 --- a/mysql-test/include/rpl_events.inc +++ b/mysql-test/include/rpl_events.inc @@ -29,6 +29,9 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name # wait 3 seconds, so the event can trigger --real_sleep 3 +let $wait_condition= + SELECT count(*) = 1 FROM t1 WHERE c = 'from justonce'; +--source include/wait_condition.inc # check that table t1 contains something --echo "in the master" diff --git a/mysql-test/include/unsafe_binlog.inc b/mysql-test/include/unsafe_binlog.inc index 6fbbdcb6d6c..2fc2ad77bc9 100644 --- a/mysql-test/include/unsafe_binlog.inc +++ b/mysql-test/include/unsafe_binlog.inc @@ -23,7 +23,7 @@ # --disable_warnings -drop table if exists t1,t2; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; --enable_warnings eval create table t1 (id int not null, f_id int not null, f int not null, primary key(f_id, id)) engine = $engine_type; @@ -59,7 +59,7 @@ set autocommit = 0; # # S-lock to records (2,2),(4,2), and (6,2) should not be released in a update # ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT select * from t1 where a = 2 and b = 2 for update; connection a; commit; @@ -213,39 +213,39 @@ set autocommit = 0; create table t10(a int not null, b int, primary key(a)) select * from t2 for update; connection b; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection c; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection d; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection e; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection f; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection g; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection h; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection i; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection j; ---error 1205 +--error ER_LOCK_WAIT_TIMEOUT reap; connection a; diff --git a/mysql-test/include/uses_vardir.inc b/mysql-test/include/uses_vardir.inc new file mode 100644 index 00000000000..950de698a43 --- /dev/null +++ b/mysql-test/include/uses_vardir.inc @@ -0,0 +1,14 @@ +# +# Some tests uses LOAD DATA with a relative path +# and need to see for example ../std_data +# +# Also if an absolute path was used, the server might be started +# with --secure-file-priv and wouldn't be allowed to LOAD a file +# outside of it's vardir anyway +# + + +if (`select LOCATE('$MYSQLTEST_VARDIR', REPLACE(@@datadir, '\\\\', '/')) != 1`) +{ + skip Need mysqld in MYSQLTEST_VARDIR; +} diff --git a/mysql-test/include/varchar.inc b/mysql-test/include/varchar.inc index 2d683a15030..15306ed8385 100644 --- a/mysql-test/include/varchar.inc +++ b/mysql-test/include/varchar.inc @@ -81,7 +81,7 @@ explain select count(*) from t1 where v between 'a' and 'a '; --replace_column 9 # explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY alter table t1 add unique(v); alter table t1 add key(v); select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; @@ -179,17 +179,17 @@ drop table t1; create table t1 (a char(10), unique (a)); insert into t1 values ('a '); ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY insert into t1 values ('a '); alter table t1 modify a varchar(10); ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY insert into t1 values ('a '),('a '),('a '),('a '); ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY insert into t1 values ('a '); ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY insert into t1 values ('a '); ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY insert into t1 values ('a '); update t1 set a='a ' where a like 'a%'; select concat(a,'.') from t1; diff --git a/mysql-test/include/wait_for_slave_io_to_stop.inc b/mysql-test/include/wait_for_slave_io_to_stop.inc new file mode 100644 index 00000000000..004f8bbbd8d --- /dev/null +++ b/mysql-test/include/wait_for_slave_io_to_stop.inc @@ -0,0 +1,33 @@ +################################################### +#Author: Jeb +#Date: 2007-06-11 +#Purpose: used for io errors on the slave. If Slave gets an io +# error, the io trhead should stop +#Details: +# 1) Fill in and setup variables +# 2) loop through looking for +# sql threads to stop +# 3) If loops too long die. +#################################################### +connection slave; +let $my_show= SHOW SLAVE STATUS; +let $sql_running= Slave_IO_Running; +let $row_number= 1; +let $run= 1; +let $counter= 300; + +while ($run) +{ + let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); + if (`SELECT '$io_result' = 'No'`){ + let $run= 0; + } + sleep 0.1; + if (!$counter){ + --echo "Failed while waiting for slave IO thread to stop" + SHOW SLAVE STATUS; + exit; + } + dec $counter; +} + diff --git a/mysql-test/include/wait_for_slave_sql_to_stop.inc b/mysql-test/include/wait_for_slave_sql_to_stop.inc new file mode 100644 index 00000000000..ee765c81f6a --- /dev/null +++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc @@ -0,0 +1,30 @@ +################################################### +#Author: Jeb +#Date: 2007-06-11 +#Purpose: used for SQL errors on the slave. If Slave gets a sql +# error, the SQL trhead should stop +#Details: +# 1) Fill in and setup variables +# 2) loop through looking for +# sql threads to stop +# 3) If loops too long die. +#################################################### +connection slave; +let $row_number= 1; +let $run= 1; +let $counter= 300; + +while ($run) +{ + let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); + if (`SELECT '$sql_result' = 'No'`){ + let $run= 0; + } + sleep 0.1; + if (!$counter){ + --echo "Failed while waiting for slave SQL thread to stop" + SHOW SLAVE STATUS; + exit; + } + dec $counter; +} diff --git a/mysql-test/include/wait_for_slave_to_start.inc b/mysql-test/include/wait_for_slave_to_start.inc new file mode 100644 index 00000000000..84e1d646efe --- /dev/null +++ b/mysql-test/include/wait_for_slave_to_start.inc @@ -0,0 +1,35 @@ +################################################### +#Author: Jeb +#Date: 2007-06-11 +#Purpose: To wait a brief time for slave to start +#Details: +# 1) Fill in and setup variables +# 2) loop through looking for both +# io and sql threads to start +# 3) If loops too long die. +#################################################### +connection slave; +let $row_number= 1; +let $run= 1; +let $counter= 300; + +while ($run) +{ + let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); + if (`SELECT '$io_result' = 'Yes'`){ + + let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); + if (`SELECT '$sql_result' = 'Yes'`){ + let $run= 0; + } + } + sleep 0.1; + if (!$counter){ + --echo "Failed while waiting for slave to start" + SHOW SLAVE STATUS; + exit; + } + dec $counter; +} + + diff --git a/mysql-test/include/wait_for_slave_to_stop.inc b/mysql-test/include/wait_for_slave_to_stop.inc new file mode 100644 index 00000000000..13acbecb835 --- /dev/null +++ b/mysql-test/include/wait_for_slave_to_stop.inc @@ -0,0 +1,37 @@ +################################################### +#Author: Jeb +#Date: 2007-06-11 +#Purpose: To replace the mysqltest.c executable +# wait_for_slave_to_stop function and +# return this to the test language. +#Details: +# 1) Fill in and setup variables +# 2) loop through looking for both +# io and sql threads to stop +# 3) If loops too long die. +#################################################### +connection slave; +let $row_number= 1; +let $run= 1; +let $counter= 300; + +while ($run) +{ + let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); + if (`SELECT '$io_result' = 'No'`){ + + let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); + if (`SELECT '$sql_result' = 'No'`){ + let $run= 0; + } + } + sleep 0.1; + if (!$counter){ + --echo "Failed while waiting for slave to stop" + SHOW SLAVE STATUS; + exit; + } + dec $counter; +} + + |