mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into narttu.mysql.fi:/my/mysql-4.1
This commit is contained in:
@ -429,9 +429,14 @@ if [ x$SOURCE_DIST = x1 ] ; then
|
||||
MYSQL_TEST="$BASEDIR/client/mysqltest"
|
||||
fi
|
||||
if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
|
||||
MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump --no-defaults -uroot --socket=$MASTER_MYSOCK"
|
||||
MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
|
||||
else
|
||||
MYSQL_DUMP="$BASEDIR/client/mysqldump --no-defaults -uroot --socket=$MASTER_MYSOCK"
|
||||
MYSQL_DUMP="$BASEDIR/client/mysqldump"
|
||||
fi
|
||||
if [ -f "$BASEDIR/client/.libs/mysqlbinlog" ] ; then
|
||||
MYSQL_BINLOG="$BASEDIR/client/.libs/mysqlbinlog"
|
||||
else
|
||||
MYSQL_BINLOG="$BASEDIR/client/mysqlbinlog"
|
||||
fi
|
||||
if [ -n "$STRACE_CLIENT" ]; then
|
||||
MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST"
|
||||
@ -454,7 +459,8 @@ else
|
||||
MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
|
||||
fi
|
||||
MYSQL_TEST="$BASEDIR/bin/mysqltest"
|
||||
MYSQL_DUMP="$BASEDIR/bin/mysqldump --no-defaults -uroot --socket=$MASTER_MYSOCK"
|
||||
MYSQL_DUMP="$BASEDIR/bin/mysqldump"
|
||||
MYSQL_BINLOG="$BASEDIR/bin/mysqlbinlog"
|
||||
MYSQLADMIN="$BASEDIR/bin/mysqladmin"
|
||||
WAIT_PID="$BASEDIR/bin/mysql_waitpid"
|
||||
MYSQL_MANAGER="$BASEDIR/bin/mysqlmanager"
|
||||
@ -472,7 +478,10 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK"
|
||||
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR"
|
||||
export MYSQL_DUMP
|
||||
export MYSQL_BINLOG
|
||||
|
||||
if [ -z "$MASTER_MYSQLD" ]
|
||||
then
|
||||
@ -1034,8 +1043,8 @@ EOF
|
||||
|
||||
mysql_start ()
|
||||
{
|
||||
# We should not start the deamon here as we don't know the argumens
|
||||
# for the test. Better to let the test start the deamon
|
||||
# We should not start the daemon here as we don't know the arguments
|
||||
# for the test. Better to let the test start the daemon
|
||||
|
||||
# $ECHO "Starting MySQL daemon"
|
||||
# start_master
|
||||
@ -1360,7 +1369,7 @@ then
|
||||
mysql_install_db
|
||||
start_manager
|
||||
|
||||
# Do not automagically start deamons if we are in gdb or running only one test
|
||||
# Do not automagically start daemons if we are in gdb or running only one test
|
||||
# case
|
||||
if [ -z "$DO_GDB" ] && [ -z "$DO_DDD" ]
|
||||
then
|
||||
|
@ -1,4 +1,12 @@
|
||||
drop table if exists t1;
|
||||
set sql_mode="MySQL40";
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
NO_FIELD_OPTIONS,MYSQL40
|
||||
set @@sql_mode="ANSI";
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ANSI
|
||||
SELECT 'A' || 'B';
|
||||
'A' || 'B'
|
||||
AB
|
||||
@ -8,11 +16,4 @@ id NULL 1 1.1 a
|
||||
SELECT id FROM t1 GROUP BY id2;
|
||||
ERROR 42000: 'test.t1.id' isn't in GROUP BY
|
||||
drop table t1;
|
||||
set sql_mode="MySQL40";
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
NO_FIELD_OPTIONS,MYSQL40
|
||||
set sql_mode="ANSI";
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ANSI
|
||||
SET @@SQL_MODE="";
|
||||
|
@ -86,7 +86,7 @@ Field Type Null Key Default Extra
|
||||
x varchar(50) YES NULL
|
||||
describe t2;
|
||||
Field Type Null Key Default Extra
|
||||
x char(50) YES NULL
|
||||
x varchar(50) YES NULL
|
||||
drop table t2;
|
||||
create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
|
||||
describe t2;
|
||||
@ -129,6 +129,16 @@ ERROR 42S21: Duplicate column name 'b'
|
||||
drop table if exists t1,t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't2'
|
||||
CREATE TABLE t1 (a int not null);
|
||||
INSERT INTO t1 values (1),(2),(1);
|
||||
CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 1
|
||||
SELECT * from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't2'
|
||||
create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
|
@ -303,9 +303,9 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index id id 8 NULL 1 Using index; Distinct
|
||||
1 SIMPLE t3 index id id 8 NULL 1 Using index; Distinct
|
||||
1 SIMPLE j_lj_t2 index id id 4 NULL 2 Using where; Using index; Distinct
|
||||
1 SIMPLE t2_lj index id id 8 NULL 1 Using where; Using index; Distinct
|
||||
1 SIMPLE t2_lj ref id id 4 test.j_lj_t2.id 1 Using where; Using index; Distinct
|
||||
1 SIMPLE j_lj_t3 index id id 4 NULL 2 Using where; Using index; Distinct
|
||||
1 SIMPLE t3_lj index id id 8 NULL 1 Using where; Using index; Distinct
|
||||
1 SIMPLE t3_lj ref id id 4 test.j_lj_t3.id 1 Using where; Using index; Distinct
|
||||
SELECT DISTINCT
|
||||
t1.id
|
||||
from
|
||||
|
18
mysql-test/r/drop_temp_table.result
Normal file
18
mysql-test/r/drop_temp_table.result
Normal file
@ -0,0 +1,18 @@
|
||||
reset master;
|
||||
create database `drop-temp+table-test`;
|
||||
use `drop-temp+table-test`;
|
||||
create temporary table `table:name` (a int);
|
||||
select get_lock("a",10);
|
||||
get_lock("a",10)
|
||||
1
|
||||
select get_lock("a",10);
|
||||
get_lock("a",10)
|
||||
1
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
|
||||
master-bin.000001 79 Query 1 79 use `test`; create database `drop-temp+table-test`
|
||||
master-bin.000001 152 Query 1 152 use `drop-temp+table-test`; create temporary table `table:name` (a int)
|
||||
master-bin.000001 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE `drop-temp+table-test`.`table:name`
|
||||
master-bin.000001 365 Query 1 365 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
|
||||
drop database `drop-temp+table-test`;
|
@ -1,13 +0,0 @@
|
||||
use test;
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (email varchar(50));
|
||||
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),
|
||||
('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
|
||||
create table t2(id int not null auto_increment primary key,
|
||||
t2 varchar(50), unique(t2));
|
||||
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
|
||||
select * from t2;
|
||||
id t2
|
||||
1 mysql.com
|
||||
2 hotmail.com
|
||||
3 aol.com
|
@ -1,4 +1,4 @@
|
||||
drop table if exists t1;
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (a int not null);
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (a+2);
|
||||
@ -70,9 +70,19 @@ id
|
||||
0
|
||||
2
|
||||
drop table t1;
|
||||
drop database if exists test_$1;
|
||||
create database test_$1;
|
||||
use test_$1;
|
||||
create table t1 (email varchar(50));
|
||||
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
|
||||
create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2));
|
||||
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
|
||||
select * from t2;
|
||||
id t2
|
||||
1 mysql.com
|
||||
2 hotmail.com
|
||||
3 aol.com
|
||||
drop table t1,t2;
|
||||
drop database if exists mysqltest;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
create table t1 (c int);
|
||||
insert into test_$1.t1 set test_$1.t1.c = '1';
|
||||
drop database test_$1;
|
||||
insert into mysqltest.t1 set mysqltest.t1.c = '1';
|
||||
drop database mysqltest;
|
||||
|
@ -75,6 +75,11 @@ ERROR 23000: Duplicate entry '2' for key 1
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
|
||||
master-bin.000001 79 Query 1 79 use `test`; insert into t1 select * from t2
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
drop table t1, t2;
|
||||
create table t1 (a int not null);
|
||||
create table t2 (a int not null);
|
||||
|
@ -614,7 +614,7 @@ INSERT INTO t2 VALUES (1,1);
|
||||
explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE t2 index id id 8 NULL 1 Using where; Using index; Not exists
|
||||
1 SIMPLE t2 ref id id 4 test.t1.id 1 Using where; Using index; Not exists
|
||||
SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
|
||||
id name id idx
|
||||
2 no NULL NULL
|
||||
|
83
mysql-test/r/mysqlbinlog.result
Normal file
83
mysql-test/r/mysqlbinlog.result
Normal file
@ -0,0 +1,83 @@
|
||||
drop table if exists t1,t2;
|
||||
set timestamp=1000000000;
|
||||
create table t1 (word varchar(20));
|
||||
create table t2 (id int auto_increment not null primary key);
|
||||
insert into t1 values ("abirvalg");
|
||||
insert into t2 values ();
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
insert into t1 values ("Alas");
|
||||
flush logs;
|
||||
|
||||
--- Local --
|
||||
use test;
|
||||
SET TIMESTAMP=1000000000;
|
||||
create table t1 (word varchar(20));
|
||||
SET TIMESTAMP=1000000000;
|
||||
create table t2 (id int auto_increment not null primary key);
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t1 values ("abirvalg");
|
||||
SET INSERT_ID=1;
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t2 values ();
|
||||
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-1-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
|
||||
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-2-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
|
||||
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-3-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
|
||||
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-4-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
|
||||
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-5-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
|
||||
|
||||
--- Broken LOAD DATA --
|
||||
use test;
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t1 values ("Alas");
|
||||
|
||||
--- --database --
|
||||
SET INSERT_ID=1;
|
||||
|
||||
--- --position --
|
||||
use test;
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t1 values ("Alas");
|
||||
|
||||
--- Remote --
|
||||
use test;
|
||||
SET TIMESTAMP=1000000000;
|
||||
create table t1 (word varchar(20));
|
||||
SET TIMESTAMP=1000000000;
|
||||
create table t2 (id int auto_increment not null primary key);
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t1 values ("abirvalg");
|
||||
SET INSERT_ID=1;
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t2 values ();
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t1 values ("Alas");
|
||||
|
||||
--- Broken LOAD DATA --
|
||||
use test;
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t1 values ("Alas");
|
||||
|
||||
--- --database --
|
||||
use test;
|
||||
SET TIMESTAMP=1000000000;
|
||||
create table t1 (word varchar(20));
|
||||
SET TIMESTAMP=1000000000;
|
||||
create table t2 (id int auto_increment not null primary key);
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t1 values ("abirvalg");
|
||||
SET INSERT_ID=1;
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t2 values ();
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t1 values ("Alas");
|
||||
|
||||
--- --position --
|
||||
use test;
|
||||
SET TIMESTAMP=1000000000;
|
||||
insert into t1 values ("Alas");
|
||||
drop table t1;
|
@ -153,12 +153,12 @@ a b
|
||||
7 NULL
|
||||
explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a,b a 10 NULL 3 Using where; Using index
|
||||
1 SIMPLE t1 ref_or_null a,b a 5 const 4 Using where; Using index
|
||||
select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
|
||||
a b
|
||||
NULL 7
|
||||
7 NULL
|
||||
7 7
|
||||
NULL 7
|
||||
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref_or_null a a 5 const 5 Using where; Using index
|
||||
|
@ -470,8 +470,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 Using where; Using index
|
||||
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.gid 1 Using where
|
||||
1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where; Using index
|
||||
EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
|
||||
@ -479,8 +479,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 Using where; Using index
|
||||
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.gid 1 Using where
|
||||
1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where; Using index
|
||||
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
|
||||
|
@ -4,9 +4,13 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
drop database if exists mysqltest2;
|
||||
create database mysqltest2;
|
||||
drop database if exists mysqltest;
|
||||
drop database if exists mysqltest2;
|
||||
drop database if exists mysqltest3;
|
||||
drop database if exists mysqltest;
|
||||
drop database if exists mysqltest2;
|
||||
drop database if exists mysqltest3;
|
||||
create database mysqltest2;
|
||||
create database mysqltest;
|
||||
create database mysqltest2;
|
||||
create table mysqltest2.foo (n int);
|
||||
@ -46,24 +50,48 @@ show databases;
|
||||
Database
|
||||
mysql
|
||||
test
|
||||
create database mysqltest2;
|
||||
create table mysqltest2.t1(n int, s char(20));
|
||||
insert into mysqltest2.t1 values (1, 'original foo.t1');
|
||||
create table mysqltest2.t3(n int, s char(20));
|
||||
insert into mysqltest2.t3 values (1, 'original foo.t3');
|
||||
create database mysqltest3;
|
||||
create table mysqltest3.t1(n int, s char(20));
|
||||
insert into mysqltest3.t1 values (1, 'original foo2.t1');
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1(n int, s char(20));
|
||||
insert into mysqltest.t1 values (1, 'original bar.t1');
|
||||
create table mysqltest.t3(n int, s char(20));
|
||||
insert into mysqltest.t3 values (1, 'original bar.t3');
|
||||
load data from master;
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'mysqltest'; database doesn't exist
|
||||
Note 1008 Can't drop database 'mysqltest2'; database doesn't exist
|
||||
show databases;
|
||||
Database
|
||||
mysql
|
||||
mysqltest
|
||||
mysqltest2
|
||||
mysqltest3
|
||||
test
|
||||
use mysqltest2;
|
||||
show tables;
|
||||
Tables_in_mysqltest2
|
||||
t1
|
||||
t3
|
||||
select * from t1;
|
||||
n s
|
||||
1 original foo.t1
|
||||
use mysqltest3;
|
||||
show tables;
|
||||
Tables_in_mysqltest3
|
||||
t1
|
||||
select * from t1;
|
||||
n s
|
||||
1 original foo2.t1
|
||||
use mysqltest;
|
||||
show tables;
|
||||
Tables_in_mysqltest
|
||||
t1
|
||||
t2
|
||||
t3
|
||||
select * from mysqltest.t1;
|
||||
n s
|
||||
1 one test
|
||||
@ -74,6 +102,9 @@ n s
|
||||
11 eleven test
|
||||
12 twelve test
|
||||
13 thirteen test
|
||||
select * from mysqltest.t3;
|
||||
n s
|
||||
1 original bar.t3
|
||||
insert into mysqltest.t1 values (4, 'four test');
|
||||
select * from mysqltest.t1;
|
||||
n s
|
||||
@ -81,5 +112,13 @@ n s
|
||||
2 two test
|
||||
3 three test
|
||||
4 four test
|
||||
load table mysqltest.t1 from master;
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
drop table mysqltest.t1;
|
||||
load table mysqltest.t1 from master;
|
||||
load table bar.t1 from master;
|
||||
ERROR HY000: Error from master: 'Table 'bar.t1' doesn't exist'
|
||||
drop database mysqltest;
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
||||
|
@ -4,18 +4,18 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
drop database if exists test_$1;
|
||||
create database test_$1;
|
||||
create table test_$1.t1 ( n int);
|
||||
alter table test_$1.t1 add m int;
|
||||
insert into test_$1.t1 values (1,2);
|
||||
create table test_$1.t2 (n int);
|
||||
insert into test_$1.t2 values (45);
|
||||
rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2;
|
||||
select * from test_$1.t2;
|
||||
drop database if exists mysqltest;
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1 ( n int);
|
||||
alter table mysqltest.t1 add m int;
|
||||
insert into mysqltest.t1 values (1,2);
|
||||
create table mysqltest.t2 (n int);
|
||||
insert into mysqltest.t2 values (45);
|
||||
rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
|
||||
select * from mysqltest.t2;
|
||||
n m
|
||||
1 2
|
||||
select * from test_$1.t3;
|
||||
select * from mysqltest.t3;
|
||||
n
|
||||
45
|
||||
drop database test_$1;
|
||||
drop database mysqltest;
|
||||
|
@ -19,7 +19,7 @@ select * from t3;
|
||||
day id category name
|
||||
2003-02-22 2461 b a a a @ % ' " a
|
||||
2003-03-22 2161 c asdf
|
||||
2003-04-22 2416 a bbbbb
|
||||
2003-03-22 2416 a bbbbb
|
||||
show master status;
|
||||
File Position Binlog_do_db Binlog_ignore_db
|
||||
slave-bin.000001 964
|
||||
@ -55,3 +55,14 @@ reset slave;
|
||||
show slave status;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
|
||||
127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No
|
||||
reset master;
|
||||
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
|
||||
unique(day));
|
||||
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 1
|
||||
show master status;
|
||||
File Position Binlog_do_db Binlog_ignore_db
|
||||
master-bin.000001 491
|
||||
drop table t2;
|
||||
|
@ -4,11 +4,12 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
drop database if exists mysqltest;
|
||||
reset master;
|
||||
create database test2;
|
||||
create database mysqltest;
|
||||
create table t1(a int, b int, unique(b));
|
||||
use test2;
|
||||
use mysqltest;
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
drop database test2;
|
||||
drop database mysqltest;
|
||||
|
14
mysql-test/r/rpl_trunc_binlog.result
Normal file
14
mysql-test/r/rpl_trunc_binlog.result
Normal file
@ -0,0 +1,14 @@
|
||||
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;
|
||||
stop slave;
|
||||
flush logs;
|
||||
reset slave;
|
||||
start slave;
|
||||
show slave status;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
|
||||
127.0.0.1 root MASTER_PORT 1 master-bin.000002 4 slave-relay-bin.000002 123 master-bin.000001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. Probably cause is that the master died while writing the transaction to it's binary log. 0 79 326 None 0 No
|
||||
reset master;
|
File diff suppressed because it is too large
Load Diff
@ -70,7 +70,7 @@ insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(nu
|
||||
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL b NULL NULL NULL 21
|
||||
1 SIMPLE t2 ALL b NULL NULL NULL 16 Using where
|
||||
1 SIMPLE t2 ref b b 21 test.t1.b 6 Using where
|
||||
set MAX_SEEKS_FOR_KEY=1;
|
||||
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
|
@ -34,6 +34,7 @@ explain select * from t1 where i=@vv1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref i i 4 const 1 Using where
|
||||
drop table t1,t2;
|
||||
set @a=0,@b=0;
|
||||
select @a:=10, @b:=1, @a > @b, @a < @b;
|
||||
@a:=10 @b:=1 @a > @b @a < @b
|
||||
10 1 1 0
|
||||
@ -42,7 +43,61 @@ select @a:="10", @b:="1", @a > @b, @a < @b;
|
||||
10 1 1 0
|
||||
select @a:=10, @b:=2, @a > @b, @a < @b;
|
||||
@a:=10 @b:=2 @a > @b @a < @b
|
||||
10 2 1 0
|
||||
10 2 0 1
|
||||
select @a:="10", @b:="2", @a > @b, @a < @b;
|
||||
@a:="10" @b:="2" @a > @b @a < @b
|
||||
10 2 0 1
|
||||
10 2 1 0
|
||||
select @a:=1;
|
||||
@a:=1
|
||||
1
|
||||
select @a, @a:=1;
|
||||
@a @a:=1
|
||||
1 1
|
||||
create table t1 (id int, d double, c char(10));
|
||||
insert into t1 values (1,2.0, "test");
|
||||
select @c:=0;
|
||||
@c:=0
|
||||
0
|
||||
update t1 SET id=(@c:=@c+1);
|
||||
select @c;
|
||||
@c
|
||||
1
|
||||
select @c:=0;
|
||||
@c:=0
|
||||
0
|
||||
update t1 set id=(@c:=@c+1);
|
||||
select @c;
|
||||
@c
|
||||
1
|
||||
select @c:=0;
|
||||
@c:=0
|
||||
0
|
||||
select @c:=@c+1;
|
||||
@c:=@c+1
|
||||
1
|
||||
select @d,(@d:=id),@d from t1;
|
||||
@d (@d:=id) @d
|
||||
NULL 1 1
|
||||
select @e,(@e:=d),@e from t1;
|
||||
@e (@e:=d) @e
|
||||
NULL 2 2
|
||||
select @f,(@f:=c),@f from t1;
|
||||
@f (@f:=c) @f
|
||||
NULL test test
|
||||
set @g=1;
|
||||
select @g,(@g:=c),@g from t1;
|
||||
@g (@g:=c) @g
|
||||
1 test test
|
||||
select @c, @d, @e, @f;
|
||||
@c @d @e @f
|
||||
1 1 2 test
|
||||
select @d:=id, @e:=id, @f:=id, @g:=@id from t1;
|
||||
@d:=id @e:=id @f:=id @g:=@id
|
||||
1 1 1 NULL
|
||||
select @c, @d, @e, @f, @g;
|
||||
@c @d @e @f @g
|
||||
1 1 1 1 NULL
|
||||
drop table t1;
|
||||
select @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b, @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b;
|
||||
@a:=10 @b:=2 @a>@b @a:="10" @b:="2" @a>@b @a:=10 @b:=2 @a>@b @a:="10" @b:="2" @a>@b
|
||||
10 2 1 10 2 1 10 2 1 10 2 1
|
||||
|
@ -4,5 +4,5 @@
|
||||
##
|
||||
>2003-03-22,2161,%c%,%asdf%
|
||||
##
|
||||
>2003-04-22,2416,%a%,%bbbbb%
|
||||
>2003-03-22,2416,%a%,%bbbbb%
|
||||
##
|
||||
|
BIN
mysql-test/std_data/trunc_binlog.000001
Normal file
BIN
mysql-test/std_data/trunc_binlog.000001
Normal file
Binary file not shown.
@ -1 +0,0 @@
|
||||
--ansi
|
@ -6,6 +6,11 @@
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
set sql_mode="MySQL40";
|
||||
select @@sql_mode;
|
||||
set @@sql_mode="ANSI";
|
||||
select @@sql_mode;
|
||||
|
||||
# Test some functions that works different in ansi mode
|
||||
|
||||
SELECT 'A' || 'B';
|
||||
@ -18,7 +23,4 @@ SELECT id,NULL,1,1.1,'a' FROM t1 GROUP BY id;
|
||||
SELECT id FROM t1 GROUP BY id2;
|
||||
drop table t1;
|
||||
|
||||
set sql_mode="MySQL40";
|
||||
select @@sql_mode;
|
||||
set sql_mode="ANSI";
|
||||
select @@sql_mode;
|
||||
SET @@SQL_MODE="";
|
||||
|
@ -110,6 +110,19 @@ drop table if exists t2;
|
||||
create table t2 (b int) select a as b, a+1 as b from t1;
|
||||
drop table if exists t1,t2;
|
||||
|
||||
#
|
||||
# Test CREATE ... SELECT when insert fails
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int not null);
|
||||
INSERT INTO t1 values (1),(2),(1);
|
||||
--error 1062
|
||||
CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
|
||||
--error 1146
|
||||
SELECT * from t2;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
|
||||
#
|
||||
# Test of primary key with 32 index
|
||||
#
|
||||
|
19
mysql-test/t/drop_temp_table.test
Normal file
19
mysql-test/t/drop_temp_table.test
Normal file
@ -0,0 +1,19 @@
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
connection con1;
|
||||
reset master;
|
||||
create database `drop-temp+table-test`;
|
||||
use `drop-temp+table-test`;
|
||||
create temporary table `table:name` (a int);
|
||||
select get_lock("a",10);
|
||||
disconnect con1;
|
||||
|
||||
connection con2;
|
||||
# We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
|
||||
# guarantee that logging of the terminated con1 has been done yet.
|
||||
# To be sure that logging has been done, we use a user lock.
|
||||
select get_lock("a",10);
|
||||
let $VERSION=`select version()`;
|
||||
--replace_result $VERSION VERSION
|
||||
show binlog events;
|
||||
drop database `drop-temp+table-test`;
|
@ -1,12 +0,0 @@
|
||||
use test;
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (email varchar(50));
|
||||
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),
|
||||
('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
|
||||
create table t2(id int not null auto_increment primary key,
|
||||
t2 varchar(50), unique(t2));
|
||||
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
|
||||
select * from t2;
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int not null);
|
||||
@ -64,15 +64,26 @@ insert into t1 values (1), (NULL), (2);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test if insert ... select distinct
|
||||
#
|
||||
|
||||
create table t1 (email varchar(50));
|
||||
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
|
||||
create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2));
|
||||
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Test of mysqld crash with fully qualified column names
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists test_$1;
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
create database test_$1;
|
||||
use test_$1;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
create table t1 (c int);
|
||||
insert into test_$1.t1 set test_$1.t1.c = '1';
|
||||
drop database test_$1;
|
||||
insert into mysqltest.t1 set mysqltest.t1.c = '1';
|
||||
drop database mysqltest;
|
||||
|
@ -86,6 +86,7 @@ insert into t1 select * from t2;
|
||||
let $VERSION=`select version()`;
|
||||
--replace_result $VERSION VERSION
|
||||
show binlog events;
|
||||
select * from t1;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
|
1
mysql-test/t/mysqlbinlog-master.opt
Normal file
1
mysql-test/t/mysqlbinlog-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--max-binlog-size=4096
|
103
mysql-test/t/mysqlbinlog.test
Normal file
103
mysql-test/t/mysqlbinlog.test
Normal file
@ -0,0 +1,103 @@
|
||||
# We are using .opt file since we need small binlog size
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
# we need this for getting fixed timestamps inside of this test
|
||||
set timestamp=1000000000;
|
||||
|
||||
create table t1 (word varchar(20));
|
||||
create table t2 (id int auto_increment not null primary key);
|
||||
|
||||
# simple test for simple statement and various events
|
||||
insert into t1 values ("abirvalg");
|
||||
insert into t2 values ();
|
||||
# Should be uncommented in 4.1
|
||||
# set @a:=1
|
||||
# insert into t2 values (@a);
|
||||
|
||||
# test for load data and load data distributed among the several
|
||||
# files (we need to fill up first binlog)
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
# simple query to show more in second binlog
|
||||
insert into t1 values ("Alas");
|
||||
flush logs;
|
||||
|
||||
# delimiters are for easier debugging in future
|
||||
--disable_query_log
|
||||
select "--- Local --" as "";
|
||||
--enable_query_log
|
||||
|
||||
#
|
||||
# We should use --short-form everywhere because in other case output will
|
||||
# be time dependend. Better than nothing.
|
||||
#
|
||||
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
|
||||
# this should not fail but shouldn't produce any working statements
|
||||
--disable_query_log
|
||||
select "--- Broken LOAD DATA --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000002
|
||||
|
||||
# this should show almost nothing
|
||||
--disable_query_log
|
||||
select "--- --database --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
|
||||
# this test for position option
|
||||
--disable_query_log
|
||||
select "--- --position --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form --position=27 $MYSQL_TEST_DIR/var/log/master-bin.000002
|
||||
|
||||
# These are tests for remote binlog.
|
||||
# They should return the same as previous test.
|
||||
# But now they are not. V. Vagin should fix this.
|
||||
# We test all the same options second time since code for remote case is
|
||||
# essentially different. If code for both cases will be unified we'll be
|
||||
# able to throw out most of this.
|
||||
|
||||
--disable_query_log
|
||||
select "--- Remote --" as "";
|
||||
--enable_query_log
|
||||
|
||||
# This is broken now
|
||||
# By the way it seems that remote version fetches all events with name >= master-bin.000001
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
|
||||
# This is broken too
|
||||
--disable_query_log
|
||||
select "--- Broken LOAD DATA --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
||||
|
||||
# And this too ! (altough it is documented)
|
||||
--disable_query_log
|
||||
select "--- --database --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001
|
||||
|
||||
# Strangely but this works
|
||||
--disable_query_log
|
||||
select "--- --position --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
||||
|
||||
# clean up
|
||||
drop table t1;
|
@ -3,9 +3,15 @@
|
||||
|
||||
source include/master-slave.inc;
|
||||
--disable_warnings
|
||||
drop database if exists mysqltest2;
|
||||
create database mysqltest2;
|
||||
drop database if exists mysqltest;
|
||||
drop database if exists mysqltest2;
|
||||
drop database if exists mysqltest3;
|
||||
connection slave;
|
||||
drop database if exists mysqltest;
|
||||
drop database if exists mysqltest2;
|
||||
drop database if exists mysqltest3;
|
||||
connection master;
|
||||
create database mysqltest2;
|
||||
create database mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
@ -60,16 +66,49 @@ sync_with_master;
|
||||
|
||||
# This should show that the slave is empty at this point
|
||||
show databases;
|
||||
# Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM
|
||||
# MASTER will neither touch database mysqltest nor mysqltest3
|
||||
create database mysqltest2;
|
||||
create table mysqltest2.t1(n int, s char(20));
|
||||
insert into mysqltest2.t1 values (1, 'original foo.t1');
|
||||
create table mysqltest2.t3(n int, s char(20));
|
||||
insert into mysqltest2.t3 values (1, 'original foo.t3');
|
||||
create database mysqltest3;
|
||||
create table mysqltest3.t1(n int, s char(20));
|
||||
insert into mysqltest3.t1 values (1, 'original foo2.t1');
|
||||
|
||||
# Create mysqltest, and mysqltest.t1, to check that it gets replaced,
|
||||
# and mysqltest.t3 to check that it is not touched (there is no
|
||||
# mysqltest.t3 on master)
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1(n int, s char(20));
|
||||
insert into mysqltest.t1 values (1, 'original bar.t1');
|
||||
create table mysqltest.t3(n int, s char(20));
|
||||
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;
|
||||
use mysqltest2;
|
||||
show tables;
|
||||
|
||||
# LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which
|
||||
# databases have to be copied. So it thinks "mysqltest" has to be
|
||||
# copied. Before 4.0.16 it would first drop "mysqltest", then create
|
||||
# "mysqltest". This "drop" is a bug; in that case t3 would disappear. So
|
||||
# here the effect of this bug (BUG#1248) would be to leave an empty
|
||||
# "mysqltest" on the slave.
|
||||
|
||||
show tables; # should be t1 & t3
|
||||
select * from t1; # should be slave's original
|
||||
use mysqltest3;
|
||||
show tables; # should be t1
|
||||
select * from t1; # should be slave's original
|
||||
use mysqltest;
|
||||
show tables;
|
||||
show tables; # should contain master's copied t1&t2, slave's original t3
|
||||
select * from mysqltest.t1;
|
||||
select * from mysqltest.t2;
|
||||
select * from mysqltest.t3;
|
||||
|
||||
# Now let's see if replication works
|
||||
connection master;
|
||||
@ -79,6 +118,33 @@ connection slave;
|
||||
sync_with_master;
|
||||
select * from mysqltest.t1;
|
||||
|
||||
# Check that LOAD DATA FROM MASTER reports the error if it can't drop a
|
||||
# table to be overwritten.
|
||||
# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
|
||||
# insert into mysqltest.t1 values(10, 'should be there');
|
||||
# flush tables;
|
||||
# system chmod 500 var/slave-data/mysqltest/;
|
||||
# --error 6
|
||||
# load data from master; # should fail (errno 13)
|
||||
# system chmod 700 var/slave-data/mysqltest/;
|
||||
# select * from mysqltest.t1; # should contain the row (10, ...)
|
||||
|
||||
|
||||
# Check that LOAD TABLE FROM MASTER fails if the table exists on slave
|
||||
--error 1050
|
||||
load table mysqltest.t1 from master;
|
||||
drop table mysqltest.t1;
|
||||
load table mysqltest.t1 from master;
|
||||
|
||||
# Check what happens when requestion not existing table
|
||||
#
|
||||
--error 1188
|
||||
load table bar.t1 from master;
|
||||
|
||||
# as LOAD DATA FROM MASTER failed it did not restart slave threads
|
||||
# DISABLED FOR NOW
|
||||
# start slave;
|
||||
|
||||
# Now time for cleanup
|
||||
connection master;
|
||||
drop database mysqltest;
|
||||
@ -86,3 +152,6 @@ drop database mysqltest2;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
# These has to be droped on slave as they are not replicated
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
||||
|
@ -1,22 +1,22 @@
|
||||
source include/master-slave.inc;
|
||||
--disable_warnings
|
||||
drop database if exists test_$1;
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
create database test_$1;
|
||||
create database mysqltest;
|
||||
|
||||
create table test_$1.t1 ( n int);
|
||||
alter table test_$1.t1 add m int;
|
||||
insert into test_$1.t1 values (1,2);
|
||||
create table test_$1.t2 (n int);
|
||||
insert into test_$1.t2 values (45);
|
||||
rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2;
|
||||
create table mysqltest.t1 ( n int);
|
||||
alter table mysqltest.t1 add m int;
|
||||
insert into mysqltest.t1 values (1,2);
|
||||
create table mysqltest.t2 (n int);
|
||||
insert into mysqltest.t2 values (45);
|
||||
rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select * from test_$1.t2;
|
||||
select * from test_$1.t3;
|
||||
select * from mysqltest.t2;
|
||||
select * from mysqltest.t3;
|
||||
connection master;
|
||||
drop database test_$1;
|
||||
drop database mysqltest;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
@ -113,3 +113,18 @@ stop slave;
|
||||
reset slave;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
show slave status;
|
||||
|
||||
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
|
||||
|
||||
connection master;
|
||||
reset master;
|
||||
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
|
||||
unique(day));
|
||||
--error 1062;
|
||||
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;
|
||||
# To test that there is Create_file & Delete_file, we test if the binlog is as
|
||||
# long as expected (can't do SHOW BINLOG EVENTS because of varying file_id).
|
||||
show master status;
|
||||
drop table t2;
|
||||
|
@ -3,6 +3,11 @@
|
||||
# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
connection slave;
|
||||
reset master;
|
||||
|
||||
@ -10,9 +15,9 @@ reset master;
|
||||
|
||||
connection master;
|
||||
# 'test' is the current database
|
||||
create database test2;
|
||||
create database mysqltest;
|
||||
create table t1(a int, b int, unique(b));
|
||||
use test2;
|
||||
use mysqltest;
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
|
||||
show binlog events from 79; # should be nothing
|
||||
drop database test2;
|
||||
drop database mysqltest;
|
||||
|
26
mysql-test/t/rpl_trunc_binlog.test
Normal file
26
mysql-test/t/rpl_trunc_binlog.test
Normal file
@ -0,0 +1,26 @@
|
||||
# We are testing if a binlog which contains BEGIN but not COMMIT (the
|
||||
# master did while writing the transaction to the binlog) triggers an
|
||||
# error on slave. So we use such a truncated binlog and simulate that
|
||||
# the master restarted after this.
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
connection slave;
|
||||
# If we are not supporting transactions in the slave, the unfinished transaction
|
||||
# won't cause any error, so we need to skip the test. In the 4.0 testsuite, the
|
||||
# slave always runs without InnoDB, so we check for BDB.
|
||||
source include/have_bdb.inc;
|
||||
stop slave;
|
||||
connection master;
|
||||
flush logs;
|
||||
system mv -f var/log/master-bin.000001 var/log/master-bin.000002;
|
||||
system cp std_data/trunc_binlog.000001 var/log/master-bin.000001;
|
||||
connection slave;
|
||||
reset slave;
|
||||
start slave;
|
||||
# can't sync_with_master so we must sleep
|
||||
sleep 3;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
show slave status;
|
||||
connection master;
|
||||
reset master;
|
@ -42,6 +42,7 @@ CREATE TABLE t2 (
|
||||
# Populate table
|
||||
#
|
||||
|
||||
--disable_query_log
|
||||
INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat','');
|
||||
INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
|
||||
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
|
||||
@ -1241,6 +1242,7 @@ INSERT INTO t2 VALUES (1190,123304,00,'bruises','Medicare','backer','');
|
||||
INSERT INTO t2 VALUES (1191,068504,00,'bonfire','corresponds','positively','');
|
||||
INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
|
||||
INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
|
||||
--enable_query_log
|
||||
|
||||
#
|
||||
# Search with a key
|
||||
@ -1366,6 +1368,7 @@ create table t3 (
|
||||
key (name)
|
||||
);
|
||||
|
||||
--disable_query_log
|
||||
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1001,"Iranizes",37,5987435,234724);
|
||||
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1002,"violinist",37,28357832,8723648);
|
||||
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1003,"extramarital",37,39654943,235872);
|
||||
@ -1376,6 +1379,7 @@ INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1007,"hand",154,9835
|
||||
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1008,"tucked",311,234298,3275892);
|
||||
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1009,"gems",447,2374834,9872392);
|
||||
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1010,"clinker",512,786542,76234234);
|
||||
--enable_query_log
|
||||
|
||||
create temporary table tmp type = myisam select * from t3;
|
||||
|
||||
@ -1496,6 +1500,7 @@ create table t4 (
|
||||
UNIQUE KEY companyname(companyname)
|
||||
) TYPE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames';
|
||||
|
||||
--disable_query_log
|
||||
INSERT INTO t4 (companynr, companyname) VALUES (29,'company 1');
|
||||
INSERT INTO t4 (companynr, companyname) VALUES (34,'company 2');
|
||||
INSERT INTO t4 (companynr, companyname) VALUES (36,'company 3');
|
||||
@ -1508,6 +1513,7 @@ INSERT INTO t4 (companynr, companyname) VALUES (65,'company 9');
|
||||
INSERT INTO t4 (companynr, companyname) VALUES (68,'company 10');
|
||||
INSERT INTO t4 (companynr, companyname) VALUES (50,'company 11');
|
||||
INSERT INTO t4 (companynr, companyname) VALUES (00,'Unknown');
|
||||
--enable_query_log
|
||||
|
||||
#
|
||||
# Test of stright join to force a full join.
|
||||
|
@ -26,7 +26,37 @@ explain select * from t1 where i=@vv1;
|
||||
drop table t1,t2;
|
||||
|
||||
# Check types of variables
|
||||
set @a=0,@b=0;
|
||||
select @a:=10, @b:=1, @a > @b, @a < @b;
|
||||
# Note that here a and b will be avaluated as number
|
||||
select @a:="10", @b:="1", @a > @b, @a < @b;
|
||||
# Note that here a and b will be avaluated as strings
|
||||
select @a:=10, @b:=2, @a > @b, @a < @b;
|
||||
select @a:="10", @b:="2", @a > @b, @a < @b;
|
||||
|
||||
# Fixed bug #1194
|
||||
select @a:=1;
|
||||
select @a, @a:=1;
|
||||
|
||||
create table t1 (id int, d double, c char(10));
|
||||
insert into t1 values (1,2.0, "test");
|
||||
select @c:=0;
|
||||
update t1 SET id=(@c:=@c+1);
|
||||
select @c;
|
||||
select @c:=0;
|
||||
update t1 set id=(@c:=@c+1);
|
||||
select @c;
|
||||
select @c:=0;
|
||||
select @c:=@c+1;
|
||||
select @d,(@d:=id),@d from t1;
|
||||
select @e,(@e:=d),@e from t1;
|
||||
select @f,(@f:=c),@f from t1;
|
||||
set @g=1;
|
||||
select @g,(@g:=c),@g from t1;
|
||||
select @c, @d, @e, @f;
|
||||
select @d:=id, @e:=id, @f:=id, @g:=@id from t1;
|
||||
select @c, @d, @e, @f, @g;
|
||||
drop table t1;
|
||||
|
||||
# just for fun :)
|
||||
select @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b, @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b;
|
||||
|
Reference in New Issue
Block a user