mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
141 lines
4.8 KiB
Text
141 lines
4.8 KiB
Text
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 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 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;
|
||
connection slave;
|
||
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
|
||
connection master;
|
||
drop table t1;
|
||
drop table t2;
|
||
drop table t3;
|
||
create table t1(a int, b int, unique(b));
|
||
connection slave;
|
||
insert into t1 values(1,10);
|
||
connection master;
|
||
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||
connection slave;
|
||
call mtr.add_suppression("Slave SQL.*Error .Duplicate entry .10. for key .b.. on query.* error.* 1062");
|
||
call mtr.add_suppression("Slave SQL.*Query caused different errors on master and slave.*Error on master:.*error code=1062.*Error on slave:.*error.* 0");
|
||
include/wait_for_slave_sql_error_and_skip.inc [errno=1062]
|
||
include/check_slave_no_error.inc
|
||
connection master;
|
||
set sql_log_bin=0;
|
||
delete from t1;
|
||
set sql_log_bin=1;
|
||
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||
connection slave;
|
||
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;
|
||
connection master;
|
||
set sql_log_bin=0;
|
||
delete from t1;
|
||
set sql_log_bin=1;
|
||
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||
connection slave;
|
||
include/wait_for_slave_sql_error.inc [errno=1062]
|
||
stop slave;
|
||
reset slave;
|
||
include/check_slave_no_error.inc
|
||
connection master;
|
||
reset master;
|
||
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
|
||
unique(day)) engine=MyISAM;
|
||
load data 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
|
||
connection slave;
|
||
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;
|
||
connection master;
|
||
delete from t2;
|
||
load data 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'
|
||
connection slave;
|
||
include/wait_for_slave_sql_error.inc [errno=0]
|
||
drop table t1, t2;
|
||
connection master;
|
||
drop table t1, t2;
|
||
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
|
||
LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
|
||
ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY'
|
||
DROP TABLE t1;
|
||
include/rpl_reset.inc
|
||
connection master;
|
||
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 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 LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
|
||
### assertion: works without fully qualified name on current database
|
||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1;
|
||
### create connection without default database
|
||
connect conn2,localhost,root,,*NO-ONE*;
|
||
connection conn2;
|
||
### assertion: works without stating the default database
|
||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
|
||
disconnect conn2;
|
||
connection master;
|
||
connection slave;
|
||
use b48297_db1;
|
||
include/diff_tables.inc [master:b48297_db1.t1, slave:b48297_db1.t1]
|
||
connection master;
|
||
DROP DATABASE b48297_db1;
|
||
DROP DATABASE b42897_db2;
|
||
connection slave;
|
||
include/rpl_reset.inc
|
||
connection master;
|
||
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'
|
||
connection slave;
|
||
connection master;
|
||
DROP TABLE t1;
|
||
include/rpl_end.inc
|