mirror of
https://github.com/MariaDB/server.git
synced 2025-08-27 13:04:36 +03:00
Major replication test framework cleanup. This does the following: - Ensure that all tests clean up the replication state when they finish, by making check-testcase check the output of SHOW SLAVE STATUS. This implies: - Slave must not be running after test finished. This is good because it removes the risk for sporadic errors in subsequent tests when a test forgets to sync correctly. - Slave SQL and IO errors must be cleared when test ends. This is good because we will notice if a test gets an unexpected error in the slave threads near the end. - We no longer have to clean up before a test starts. - Ensure that all tests that wait for an error in one of the slave threads waits for a specific error. It is no longer possible to source wait_for_slave_[sql|io]_to_stop.inc when there is an error in one of the slave threads. This is good because: - If a test expects an error but there is a bug that causes another error to happen, or if it stops the slave thread without an error, then we will notice. - When developing tests, wait_for_*_to_[start|stop].inc will fail immediately if there is an error in the relevant slave thread. Before this patch, we had to wait for the timeout. - Remove duplicated and repeated code for setting up unusual replication topologies. Now, there is a single file that is capable of setting up arbitrary topologies (include/rpl_init.inc, but include/master-slave.inc is still available for the most common topology). Tests can now end with include/rpl_end.inc, which will clean up correctly no matter what topology is used. The topology can be changed with include/rpl_change_topology.inc. - Improved debug information when tests fail. This includes: - debug info is printed on all servers configured by include/rpl_init.inc - User can set $rpl_debug=1, which makes auxiliary replication files print relevant debug info. - Improved documentation for all auxiliary replication files. Now they describe purpose, usage, parameters, and side effects. - Many small code cleanups: - Made have_innodb.inc output a sensible error message. - Moved contents of rpl000017-slave.sh into rpl000017.test - Added mysqltest variables that expose the current state of disable_warnings/enable_warnings and friends. - Too many to list here: see per-file comments for details.
129 lines
5.2 KiB
Plaintext
129 lines
5.2 KiB
Plaintext
CREATE TABLE t1 (c1 char(50));
|
||
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||
LOAD DATA CONCURRENT INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||
show binlog events from <binlog_start>;
|
||
Log_name Pos Event_type Server_id End_log_pos Info
|
||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (c1 char(50))
|
||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`c1`) ;file_id=#
|
||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA CONCURRENT INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`c1`) ;file_id=#
|
||
DROP TABLE t1;
|
||
include/master-slave.inc
|
||
[connection master]
|
||
select last_insert_id();
|
||
last_insert_id()
|
||
0
|
||
create table t1(a int not null auto_increment, b int, primary key(a) );
|
||
load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||
select last_insert_id();
|
||
last_insert_id()
|
||
1
|
||
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
|
||
load data CONCURRENT infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
|
||
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
|
||
insert into t3 select * from t2;
|
||
select * from t1;
|
||
a b
|
||
1 10
|
||
2 15
|
||
select * from t3;
|
||
day id category name
|
||
2003-02-22 2461 b a a a @ % ' " a
|
||
2003-03-22 2161 c asdf
|
||
2003-03-22 2416 a bbbbb
|
||
drop table t1;
|
||
drop table t2;
|
||
drop table t3;
|
||
create table t1(a int, b int, unique(b));
|
||
insert into t1 values(1,10);
|
||
load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||
include/wait_for_slave_sql_error_and_skip.inc [errno=1062]
|
||
include/check_slave_no_error.inc
|
||
set sql_log_bin=0;
|
||
delete from t1;
|
||
set sql_log_bin=1;
|
||
load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||
include/wait_for_slave_sql_error.inc [errno=1062]
|
||
include/stop_slave_io.inc
|
||
change master to master_user='test';
|
||
change master to master_user='root';
|
||
include/check_slave_no_error.inc
|
||
set global sql_slave_skip_counter=1;
|
||
start slave;
|
||
set sql_log_bin=0;
|
||
delete from t1;
|
||
set sql_log_bin=1;
|
||
load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||
include/wait_for_slave_sql_error.inc [errno=1062]
|
||
stop slave;
|
||
reset slave;
|
||
include/check_slave_no_error.inc
|
||
reset master;
|
||
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
|
||
unique(day)) engine=MyISAM;
|
||
load data CONCURRENT infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
|
||
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
|
||
'\n##\n' starting by '>' ignore 1 lines;
|
||
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
|
||
select * from t2;
|
||
day id category name
|
||
2003-02-22 2461 b a a a @ % ' " a
|
||
2003-03-22 2161 c asdf
|
||
start slave;
|
||
select * from t2;
|
||
day id category name
|
||
2003-02-22 2461 b a a a @ % ' " a
|
||
2003-03-22 2161 c asdf
|
||
alter table t2 drop key day;
|
||
delete from t2;
|
||
load data CONCURRENT infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
|
||
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
|
||
'\n##\n' starting by '>' ignore 1 lines;
|
||
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
|
||
include/wait_for_slave_sql_to_stop.inc
|
||
drop table t1, t2;
|
||
include/stop_slave_io.inc
|
||
drop table t1, t2;
|
||
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
|
||
LOAD DATA CONCURRENT INFILE "../../std_data/words.dat" INTO TABLE t1;
|
||
ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY'
|
||
DROP TABLE IF EXISTS t1;
|
||
include/rpl_reset.inc
|
||
drop database if exists b48297_db1;
|
||
drop database if exists b42897_db2;
|
||
create database b48297_db1;
|
||
create database b42897_db2;
|
||
use b48297_db1;
|
||
CREATE TABLE t1 (c1 VARCHAR(256)) engine=MyISAM;;
|
||
use b42897_db2;
|
||
### assertion: works with cross-referenced database
|
||
LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
|
||
use b48297_db1;
|
||
### assertion: works with fully qualified name on current database
|
||
LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
|
||
### assertion: works without fully qualified name on current database
|
||
LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1;
|
||
### create connection without default database
|
||
### connect (conn2,localhost,root,,*NO-ONE*);
|
||
### assertion: works without stating the default database
|
||
LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
|
||
### disconnect and switch back to master connection
|
||
use b48297_db1;
|
||
include/diff_tables.inc [master:b48297_db1.t1, slave:b48297_db1.t1]
|
||
DROP DATABASE b48297_db1;
|
||
DROP DATABASE b42897_db2;
|
||
include/rpl_reset.inc
|
||
use test;
|
||
CREATE TABLE t1 (`key` TEXT, `text` TEXT);
|
||
LOAD DATA INFILE '../../std_data/loaddata2.dat' REPLACE INTO TABLE `t1` FIELDS TERMINATED BY ',';
|
||
SELECT * FROM t1;
|
||
key text
|
||
Field A 'Field B'
|
||
Field 1 'Field 2'
|
||
Field 3 'Field 4'
|
||
'Field 5' 'Field 6'
|
||
Field 6 'Field 7'
|
||
DROP TABLE t1;
|
||
include/rpl_end.inc
|