Commit 6a4f8a8d authored by Georgi Kodinov's avatar Georgi Kodinov

Fixed the parts testsuite to work with mtr2

parent 299339d4
......@@ -36,7 +36,7 @@ let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`;
# the corresponding SELECT on the INFORMATION_SCHEMA
# - SHOW CREATE TABLE .. cannot write its out put into a file like SELECT
let $show_file= $MYSQLD_DATADIR/test/tmp1;
--exec echo "SHOW CREATE TABLE t1;" | $MYSQL_TEST > $show_file 2>&1 || true
--exec echo "SHOW CREATE TABLE t1; exit; " | $MYSQL_TEST > $show_file 2>&1
if ($do_file_tests)
{
# List the files belonging to the table t1
......
......@@ -30,7 +30,7 @@ let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`;
# Dump the current definition of the table t1 to tmp1
let $show_file= $MYSQLD_DATADIR/test/tmp1;
--exec echo "SHOW CREATE TABLE t1;" | $MYSQL_TEST > $show_file 2>&1 || true
--exec echo "SHOW CREATE TABLE t1; exit; " | $MYSQL_TEST > $show_file 2>&1
if ($do_file_tests)
{
......
......@@ -4,6 +4,8 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
set @old_global_binlog_format= @@global.binlog_format;
set @old_session_binlog_format= @@session.binlog_format;
SET GLOBAL binlog_format = 'ROW';
SET SESSION binlog_format = 'ROW';
select @@global.binlog_format, @@session.binlog_format;
......@@ -121,21 +123,21 @@ Create Table CREATE TABLE `t3` (
`fkid` mediumint(9) DEFAULT NULL,
`filler` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1
) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (id)
SUBPARTITION BY HASH (id)
SUBPARTITIONS 2
(PARTITION pa1 VALUES LESS THAN (10) ENGINE = MyISAM,
PARTITION pa2 VALUES LESS THAN (20) ENGINE = MyISAM,
PARTITION pa3 VALUES LESS THAN (30) ENGINE = MyISAM,
PARTITION pa4 VALUES LESS THAN (40) ENGINE = MyISAM,
PARTITION pa5 VALUES LESS THAN (50) ENGINE = MyISAM,
PARTITION pa6 VALUES LESS THAN (60) ENGINE = MyISAM,
PARTITION pa7 VALUES LESS THAN (70) ENGINE = MyISAM,
PARTITION pa8 VALUES LESS THAN (80) ENGINE = MyISAM,
PARTITION pa9 VALUES LESS THAN (90) ENGINE = MyISAM,
PARTITION pa10 VALUES LESS THAN (100) ENGINE = MyISAM,
PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
(PARTITION pa1 VALUES LESS THAN (10) ENGINE = InnoDB,
PARTITION pa2 VALUES LESS THAN (20) ENGINE = InnoDB,
PARTITION pa3 VALUES LESS THAN (30) ENGINE = InnoDB,
PARTITION pa4 VALUES LESS THAN (40) ENGINE = InnoDB,
PARTITION pa5 VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION pa6 VALUES LESS THAN (60) ENGINE = InnoDB,
PARTITION pa7 VALUES LESS THAN (70) ENGINE = InnoDB,
PARTITION pa8 VALUES LESS THAN (80) ENGINE = InnoDB,
PARTITION pa9 VALUES LESS THAN (90) ENGINE = InnoDB,
PARTITION pa10 VALUES LESS THAN (100) ENGINE = InnoDB,
PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
show slave status;
Slave_IO_State #
Master_Host 127.0.0.1
......@@ -181,6 +183,8 @@ SELECT count(*) "Slave bykey" FROM t2;
Slave bykey 500
SELECT count(*) "Slave byrange" FROM t3;
Slave byrange 500
set @@global.binlog_format= @old_global_binlog_format;
set @@session.binlog_format= @old_session_binlog_format;
DROP TABLE t1, t2, t3;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
......
......@@ -10,8 +10,10 @@ drop table if exists t1_will_crash;
CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM;
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
FLUSH TABLES;
--echo # replacing t1.MYI with a corrupt + unclosed one created by doing:
--echo # 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI
let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/test/t1_will_crash.MYI
--copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/test/t1_will_crash.MYI
SELECT * FROM t1_will_crash;
......
......@@ -8,14 +8,16 @@ drop table if exists t1_will_crash;
--echo # REPAIR USE_FRM is not implemented for partitioned tables.
let $MYSQLD_DATADIR= `select @@datadir`;
--echo # test of non partitioned myisam for reference
CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM;
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
FLUSH TABLES;
--echo # replacing t1.MYI with a corrupt + unclosed one created by doing:
--echo # 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash.MYI
--copy_file std_data/corrupt_t1.MYI $MYSQLTEST_VARDIR/master-data/test/t1_will_crash.MYI
--remove_file $MYSQLD_DATADIR/test/t1_will_crash.MYI
--copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/test/t1_will_crash.MYI
CHECK TABLE t1_will_crash;
REPAIR TABLE t1_will_crash;
SELECT * FROM t1_will_crash;
......@@ -32,16 +34,16 @@ FLUSH TABLES;
--echo # replacing t1#P#p1.MYI with a corrupt + unclosed one created by doing:
--echo # 'create table t1 (a int key(a)) partition by hash (a) partitions 3'
--echo # head -c1024 t1#P#p1.MYI > corrupt_t1#P#p1.MYI
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1.MYI
--copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1.MYI
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI
--copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI
CHECK TABLE t1_will_crash;
REPAIR TABLE t1_will_crash;
SELECT * FROM t1_will_crash;
FLUSH TABLES;
--echo # test with ALTER TABLE ... CHECK/REPAIR PARTITION
--echo # replacing t1_will_crash#P#p1.MYI with a corrupt + unclosed one
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1.MYI
--copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1.MYI
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI
--copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI
ALTER TABLE t1_will_crash CHECK PARTITION p0, p2;
ALTER TABLE t1_will_crash CHECK PARTITION p0, p1;
ALTER TABLE t1_will_crash CHECK PARTITION p1, p2;
......@@ -63,16 +65,16 @@ SELECT * FROM t1_will_crash;
FLUSH TABLES;
--echo # test with CHECK/REPAIR TABLE
--echo # replacing t1_will_crash#P#p1#SP#p1sp0.MYI with a corrupt + unclosed one
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1#SP#p1sp0.MYI
--copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1#SP#p1sp0.MYI
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p1#SP#p1sp0.MYI
--copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLD_DATADIR/test/t1_will_crash#P#p1#SP#p1sp0.MYI
CHECK TABLE t1_will_crash;
REPAIR TABLE t1_will_crash;
SELECT * FROM t1_will_crash;
FLUSH TABLES;
--echo # test with ALTER TABLE ... CHECK/REPAIR PARTITION
--echo # replacing t1_will_crash#P#p1#SP#p1sp0.MYI with a corrupt + unclosed one
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1#SP#p1sp0.MYI
--copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1#SP#p1sp0.MYI
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p1#SP#p1sp0.MYI
--copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLD_DATADIR/test/t1_will_crash#P#p1#SP#p1sp0.MYI
ALTER TABLE t1_will_crash CHECK PARTITION p0;
ALTER TABLE t1_will_crash CHECK PARTITION all;
ALTER TABLE t1_will_crash CHECK PARTITION p1;
......@@ -94,7 +96,7 @@ PARTITIONS 7;
# creating a longer string for for filling the records
let $i= 3;
let $lt= longtext;
while ($i>0)
while ($i)
{
let $lt= $lt$lt;
dec $i;
......@@ -152,22 +154,22 @@ SELECT (b % 7) AS partition, b, a, length(c) FROM t1_will_crash ORDER BY partiti
FLUSH TABLES;
# testing p0, p1, p3, p6(1)
--echo # truncating p0 to simulate an empty datafile (not recovered!)
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p0.MYD
--write_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p0.MYD
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p0.MYD
--write_file $MYSQLD_DATADIR/test/t1_will_crash#P#p0.MYD
EOF
--echo # replacing p1 with only the first 1024 bytes (not recovered!)
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1.MYD
--copy_file std_data/parts/t1_will_crash#P#p1_first_1024.MYD $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1.MYD
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYD
--copy_file std_data/parts/t1_will_crash#P#p1_first_1024.MYD $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYD
--echo # replacing p3 with a crashed one at the last row in first insert
--echo # (crashed right after *share->write_record())
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p3.MYI
--copy_file std_data/parts/t1_will_crash#P#p3.MYI $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p3.MYI
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p3.MYI
--copy_file std_data/parts/t1_will_crash#P#p3.MYI $MYSQLD_DATADIR/test/t1_will_crash#P#p3.MYI
--echo # replacing p6 with a crashed MYD file (1) (splitted dynamic record)
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p6.MYD
--copy_file std_data/parts/t1_will_crash#P#p6.MYD $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p6.MYD
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p6.MYD
--copy_file std_data/parts/t1_will_crash#P#p6.MYD $MYSQLD_DATADIR/test/t1_will_crash#P#p6.MYD
ANALYZE TABLE t1_will_crash;
OPTIMIZE TABLE t1_will_crash;
CHECK TABLE t1_will_crash;
......@@ -180,10 +182,10 @@ FLUSH TABLES;
# testing p2, p4, p6(2, 3)
--echo #
--echo # replacing p2 with crashed files (after _mi_mark_changed)
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p2.MYI
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p2.MYD
--copy_file std_data/parts/t1_will_crash#P#p2.MYI $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p2.MYI
--copy_file std_data/parts/t1_will_crash#P#p2.MYD $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p2.MYD
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p2.MYI
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p2.MYD
--copy_file std_data/parts/t1_will_crash#P#p2.MYI $MYSQLD_DATADIR/test/t1_will_crash#P#p2.MYI
--copy_file std_data/parts/t1_will_crash#P#p2.MYD $MYSQLD_DATADIR/test/t1_will_crash#P#p2.MYD
ALTER TABLE t1_will_crash CHECK PARTITION p2;
--echo # crash was when index only marked as opened, no real corruption
ALTER TABLE t1_will_crash CHECK PARTITION p2;
......@@ -191,8 +193,8 @@ FLUSH TABLES;
--echo #
--echo # replacing p4 with updated but not closed index file
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p4.MYI
--copy_file std_data/parts/t1_will_crash#P#p4.MYI $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p4.MYI
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p4.MYI
--copy_file std_data/parts/t1_will_crash#P#p4.MYI $MYSQLD_DATADIR/test/t1_will_crash#P#p4.MYI
#SHOW TABLE STATUS like 't1_will_crash';
#ALTER TABLE t1_will_crash ANALYZE PARTITION p4;
#SHOW TABLE STATUS like 't1_will_crash';
......@@ -206,8 +208,8 @@ FLUSH TABLES;
--echo #
--echo # replacing p6 with a crashed MYD file (2) (splitted dynamic record)
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p6.MYD
--copy_file std_data/parts/t1_will_crash#P#p6_2.MYD $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p6.MYD
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p6.MYD
--copy_file std_data/parts/t1_will_crash#P#p6_2.MYD $MYSQLD_DATADIR/test/t1_will_crash#P#p6.MYD
#ALTER TABLE t1_will_crash OPTIMIZE PARTITION p6;
ALTER TABLE t1_will_crash CHECK PARTITION p6;
ALTER TABLE t1_will_crash REPAIR PARTITION p6;
......@@ -218,8 +220,8 @@ FLUSH TABLES;
--echo #
--echo # replacing p6 with a crashed MYD file (3) (splitted dynamic record)
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p6.MYD
--copy_file std_data/parts/t1_will_crash#P#p6_3.MYD $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p6.MYD
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p6.MYD
--copy_file std_data/parts/t1_will_crash#P#p6_3.MYD $MYSQLD_DATADIR/test/t1_will_crash#P#p6.MYD
--echo # Different results from the corrupt table, which can lead to dropping
--echo # of the not completely written rows when using REBUILD on a corrupt
--echo # table, depending if one reads via index or direct on datafile.
......
......@@ -6,6 +6,8 @@
let $engine_type= 'innodb';
set @old_global_binlog_format= @@global.binlog_format;
set @old_session_binlog_format= @@session.binlog_format;
SET GLOBAL binlog_format = 'ROW';
SET SESSION binlog_format = 'ROW';
select @@global.binlog_format, @@session.binlog_format;
......@@ -150,6 +152,8 @@ SELECT count(*) "Slave bykey" FROM t2;
SELECT count(*) "Slave byrange" FROM t3;
connection master;
set @@global.binlog_format= @old_global_binlog_format;
set @@session.binlog_format= @old_session_binlog_format;
DROP TABLE t1, t2, t3;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment