mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Manual merge from mysql-5.1-bugteam into mysql-trunk-merge.
Conflicts: Text conflict in .bzr-mysql/default.conf Text conflict in mysql-test/suite/rpl/r/rpl_loaddata_fatal.result Text conflict in mysql-test/suite/rpl/r/rpl_stm_log.result Text conflict in mysql-test/t/mysqlbinlog.test Text conflict in sql/sql_acl.cc Text conflict in sql/sql_servers.cc Text conflict in sql/sql_update.cc Text conflict in support-files/mysql.spec.sh
This commit is contained in:
@@ -19,7 +19,7 @@ ERROR 70100: Query execution was interrupted
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, b) ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, `b`) ;file_id=#
|
||||
select
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
|
||||
@@ -929,7 +929,7 @@ master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Intvar # # INSERT_ID=10
|
||||
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, @b) SET b=((@b) + `bug27417`(2)) ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`=((@b) + `bug27417`(2)) ;file_id=#
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
drop trigger trg_del_t2;
|
||||
drop table t1,t2,t3,t4,t5;
|
||||
|
||||
@@ -127,7 +127,7 @@ master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; create table t2 (a varchar(200)) engine=blackhole
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=581
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a) ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`) ;file_id=#
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; alter table t1 add b int
|
||||
master-bin.000001 # Query # # use `test`; alter table t1 drop b
|
||||
|
||||
@@ -628,7 +628,7 @@ master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=10
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Intvar # # INSERT_ID=10
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, @b) SET b=((@b) + `bug27417`(2)) ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`=((@b) + `bug27417`(2)) ;file_id=#
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
/* the output must denote there is the query */;
|
||||
drop trigger trg_del_t2;
|
||||
@@ -866,7 +866,7 @@ master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Intvar # # INSERT_ID=10
|
||||
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, @b) SET b=((@b) + `bug27417`(2)) ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`=((@b) + `bug27417`(2)) ;file_id=#
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
drop trigger trg_del_t2;
|
||||
drop table t1,t2,t3,t4,t5;
|
||||
|
||||
@@ -352,6 +352,9 @@ Note 1592 Statement may not be safe to log in statement format.
|
||||
INSERT INTO t1 VALUES (VERSION());
|
||||
Warnings:
|
||||
Note 1592 Statement may not be safe to log in statement format.
|
||||
INSERT INTO t1 VALUES (RAND());
|
||||
Warnings:
|
||||
Note 1592 Statement may not be safe to log in statement format.
|
||||
DELETE FROM t1;
|
||||
SET TIMESTAMP=1000000;
|
||||
INSERT INTO t1 VALUES
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
# BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed
|
||||
# BUG#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0
|
||||
# BUG#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode)
|
||||
# BUG#47995: Mark user functions as unsafe
|
||||
# BUG#49222: Mare RAND() unsafe
|
||||
#
|
||||
# ==== Related test cases ====
|
||||
#
|
||||
@@ -391,6 +393,7 @@ SET @@SESSION.SQL_MODE = @save_sql_mode;
|
||||
|
||||
#
|
||||
# BUG#47995: Mark user functions as unsafe
|
||||
# BUG#49222: Mare RAND() unsafe
|
||||
#
|
||||
# Test that the system functions that are supposed to be marked unsafe
|
||||
# generate a warning. Each INSERT statement below should generate a
|
||||
@@ -400,27 +403,28 @@ SET @@SESSION.SQL_MODE = @save_sql_mode;
|
||||
CREATE TABLE t1 (a VARCHAR(1000));
|
||||
INSERT INTO t1 VALUES (CURRENT_USER()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (FOUND_ROWS()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (GET_LOCK('tmp', 1));
|
||||
INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp'));
|
||||
INSERT INTO t1 VALUES (IS_USED_LOCK('tmp'));
|
||||
INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat')); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (GET_LOCK('tmp', 1)); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp')); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (IS_USED_LOCK('tmp')); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat')); #marked unsafe in BUG#39701
|
||||
INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
|
||||
INSERT INTO t1 VALUES (RELEASE_LOCK('tmp'));
|
||||
INSERT INTO t1 VALUES (RELEASE_LOCK('tmp')); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (ROW_COUNT()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (SESSION_USER()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (SLEEP(1));
|
||||
INSERT INTO t1 VALUES (SYSDATE());
|
||||
INSERT INTO t1 VALUES (SLEEP(1)); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (SYSDATE()); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (SYSTEM_USER()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (USER()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (UUID()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (UUID_SHORT()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (VERSION());
|
||||
INSERT INTO t1 VALUES (VERSION()); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (RAND()); #marked unsafe in BUG#49222
|
||||
DELETE FROM t1;
|
||||
|
||||
# Since we replicate the TIMESTAMP variable, functions affected by the
|
||||
# TIMESTAMP variable are safe to replicate. So we check that the
|
||||
# following following functions depend on the TIMESTAMP variable and
|
||||
# don't generate a warning.
|
||||
# following following functions that depend on the TIMESTAMP variable
|
||||
# are not unsafe and don't generate a warning.
|
||||
|
||||
SET TIMESTAMP=1000000;
|
||||
INSERT INTO t1 VALUES
|
||||
|
||||
@@ -12,3 +12,17 @@ show status like 'Slave_open_temp_tables';
|
||||
Variable_name Value
|
||||
Slave_open_temp_tables 0
|
||||
drop database mysqltest;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'tmp1'
|
||||
CREATE TEMPORARY TABLE t1 ( a int );
|
||||
DROP TEMPORARY TABLE t1, t2;
|
||||
ERROR 42S02: Unknown table 't2'
|
||||
DROP TEMPORARY TABLE tmp2;
|
||||
ERROR 42S02: Unknown table 'tmp2'
|
||||
stop slave;
|
||||
**** On Master ****
|
||||
CREATE TEMPORARY TABLE tmp3 (a int);
|
||||
DROP TEMPORARY TABLE tmp3;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
|
||||
START SLAVE;
|
||||
|
||||
18
mysql-test/suite/rpl/r/rpl_geometry.result
Normal file
18
mysql-test/suite/rpl/r/rpl_geometry.result
Normal file
@@ -0,0 +1,18 @@
|
||||
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;
|
||||
create table t1(a varchar(100),
|
||||
b multipoint not null,
|
||||
c varchar(256));
|
||||
insert into t1 set
|
||||
a='hello',
|
||||
b=geomfromtext('multipoint(1 1)'),
|
||||
c='geometry';
|
||||
create table t2 (a int(11) not null auto_increment primary key,
|
||||
b geometrycollection default null,
|
||||
c decimal(10,0));
|
||||
insert into t2(c) values (null);
|
||||
drop table t1, t2;
|
||||
@@ -885,7 +885,7 @@ master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
|
||||
master-bin.000001 # Xid 1 # #
|
||||
master-bin.000001 # Query 1 # BEGIN
|
||||
master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE `t1` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, b) ;file_id=#
|
||||
master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE `t1` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, `b`) ;file_id=#
|
||||
master-bin.000001 # Xid 1 # #
|
||||
master-bin.000001 # Query 1 # BEGIN
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
|
||||
|
||||
@@ -115,3 +115,20 @@ use b48297_db1;
|
||||
Comparing tables master:b48297_db1.t1 and slave:b48297_db1.t1
|
||||
DROP DATABASE b48297_db1;
|
||||
DROP DATABASE b42897_db2;
|
||||
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;
|
||||
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;
|
||||
|
||||
@@ -5,9 +5,9 @@ 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 # 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=#
|
||||
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;
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
@@ -126,3 +126,20 @@ use b48297_db1;
|
||||
Comparing tables master:b48297_db1.t1 and slave:b48297_db1.t1
|
||||
DROP DATABASE b48297_db1;
|
||||
DROP DATABASE b42897_db2;
|
||||
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;
|
||||
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;
|
||||
|
||||
@@ -55,7 +55,7 @@ Master_User root
|
||||
Master_Port MASTER_PORT
|
||||
Connect_Retry 1
|
||||
Master_Log_File master-bin.000001
|
||||
Read_Master_Log_Pos 557
|
||||
Read_Master_Log_Pos 561
|
||||
Relay_Log_File #
|
||||
Relay_Log_Pos #
|
||||
Relay_Master_Log_File master-bin.000001
|
||||
|
||||
@@ -20,7 +20,7 @@ master-bin.000001 # Query # # use `test`; create table t2 (id int not null prima
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Append_block # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Append_block # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (id) ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`id`) ;file_id=#
|
||||
==== Verify results on slave ====
|
||||
[on slave]
|
||||
select count(*) from t2 /* 5 000 */;
|
||||
|
||||
25
mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
Normal file
25
mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
Normal file
@@ -0,0 +1,25 @@
|
||||
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;
|
||||
FLUSH LOGS;
|
||||
CREATE TABLE t1(c1 INT);
|
||||
FLUSH LOGS;
|
||||
call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log');
|
||||
Last_IO_Error
|
||||
Got fatal error 1236 from master when reading data from binary log: 'could not find next log'
|
||||
CREATE TABLE t2(c1 INT);
|
||||
FLUSH LOGS;
|
||||
CREATE TABLE t3(c1 INT);
|
||||
FLUSH LOGS;
|
||||
CREATE TABLE t4(c1 INT);
|
||||
START SLAVE IO_THREAD;
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
t1
|
||||
t2
|
||||
t3
|
||||
t4
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
@@ -4,6 +4,7 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
|
||||
create table t1(id int, i int, r1 int, r2 int, p varchar(100));
|
||||
insert into t1 values(1, connection_id(), 0, 0, "");
|
||||
insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
|
||||
|
||||
24
mysql-test/suite/rpl/r/rpl_myisam_null_values.result
Normal file
24
mysql-test/suite/rpl/r/rpl_myisam_null_values.result
Normal file
@@ -0,0 +1,24 @@
|
||||
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;
|
||||
CREATE TABLE t1 (c1 BIT, c2 INT);
|
||||
INSERT INTO `t1` VALUES ( 1, 1 );
|
||||
UPDATE t1 SET c1=NULL where c2=1;
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
DELETE FROM t1 WHERE c2=1 LIMIT 1;
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 CHAR);
|
||||
INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ;
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
w
|
||||
# should trigger switch to row due to LIMIT
|
||||
UPDATE t1 SET c1=NULL WHERE c1='w' LIMIT 2;
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
DELETE FROM t1 LIMIT 2;
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
DROP TABLE t1;
|
||||
@@ -4,6 +4,7 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
|
||||
CREATE TABLE t1 (a VARCHAR(1000));
|
||||
INSERT INTO t1 VALUES (CONNECTION_ID());
|
||||
INSERT INTO t1 VALUES (CONNECTION_ID());
|
||||
|
||||
@@ -4,6 +4,7 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
|
||||
create table t1 (a int not null auto_increment primary key, b int, key(b));
|
||||
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
|
||||
@@ -4,6 +4,7 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
|
||||
DROP FUNCTION IF EXISTS test.f1;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=INNODB;
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
RESET MASTER;
|
||||
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;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
### TABLE with field_metadata_size == 290
|
||||
CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`c2` varchar(30) NOT NULL,
|
||||
@@ -150,7 +156,51 @@ CREATE TABLE `t1` (
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES ('1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1');
|
||||
DROP TABLE `t1`;
|
||||
INSERT INTO `t1`(c2) VALUES ('1');
|
||||
FLUSH LOGS;
|
||||
### assertion: the slave replicated event successfully and tables match
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
DROP TABLE `t1`;
|
||||
=== Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail.
|
||||
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;
|
||||
### action: generating several tables with different metadata
|
||||
### sizes (resorting to perl)
|
||||
### testing table with 249 field metadata size.
|
||||
### testing table with 250 field metadata size.
|
||||
### testing table with 251 field metadata size.
|
||||
### testing table with 252 field metadata size.
|
||||
### testing table with 253 field metadata size.
|
||||
### testing table with 254 field metadata size.
|
||||
### testing table with 255 field metadata size.
|
||||
### testing table with 256 field metadata size.
|
||||
### testing table with 257 field metadata size.
|
||||
### testing table with 258 field metadata size.
|
||||
FLUSH LOGS;
|
||||
### assertion: the slave replicated event successfully and tables match for t10
|
||||
Comparing tables master:test.t10 and slave:test.t10
|
||||
### assertion: the slave replicated event successfully and tables match for t9
|
||||
Comparing tables master:test.t9 and slave:test.t9
|
||||
### assertion: the slave replicated event successfully and tables match for t8
|
||||
Comparing tables master:test.t8 and slave:test.t8
|
||||
### assertion: the slave replicated event successfully and tables match for t7
|
||||
Comparing tables master:test.t7 and slave:test.t7
|
||||
### assertion: the slave replicated event successfully and tables match for t6
|
||||
Comparing tables master:test.t6 and slave:test.t6
|
||||
### assertion: the slave replicated event successfully and tables match for t5
|
||||
Comparing tables master:test.t5 and slave:test.t5
|
||||
### assertion: the slave replicated event successfully and tables match for t4
|
||||
Comparing tables master:test.t4 and slave:test.t4
|
||||
### assertion: the slave replicated event successfully and tables match for t3
|
||||
Comparing tables master:test.t3 and slave:test.t3
|
||||
### assertion: the slave replicated event successfully and tables match for t2
|
||||
Comparing tables master:test.t2 and slave:test.t2
|
||||
### assertion: the slave replicated event successfully and tables match for t1
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
### assertion: check that binlog is not corrupt. Using mysqlbinlog to
|
||||
### detect failure. Before the patch mysqlbinlog would find
|
||||
### a corrupted event, thence would fail.
|
||||
@@ -25,7 +25,7 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
|
||||
master-bin.000001 # Query 1 # use `test`; drop table t1
|
||||
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
||||
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
|
||||
master-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (word) ;file_id=1
|
||||
master-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (`word`) ;file_id=1
|
||||
show binlog events from 107 limit 1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
||||
@@ -193,7 +193,7 @@ master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
|
||||
master-bin.000001 # Query # # use `test`; drop table t1
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
||||
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' IGNORE 1 LINES (word) ;file_id=#
|
||||
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' IGNORE 1 LINES (`word`) ;file_id=#
|
||||
master-bin.000001 # Rotate # # master-bin.000002;pos=4
|
||||
show binlog events in 'master-bin.000002';
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
@@ -218,7 +218,7 @@ slave-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
|
||||
slave-bin.000001 # Query 1 # use `test`; drop table t1
|
||||
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
||||
slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
|
||||
slave-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (word) ;file_id=1
|
||||
slave-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (`word`) ;file_id=1
|
||||
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
|
||||
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
|
||||
show binlog events in 'slave-bin.000002' from 4;
|
||||
|
||||
@@ -34,4 +34,36 @@ connection master;
|
||||
drop database mysqltest;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Bug#49137
|
||||
# This test verifies if DROP MULTI TEMPORARY TABLE
|
||||
# will cause different errors on master and slave,
|
||||
# when one or more of these tables do not exist.
|
||||
#
|
||||
|
||||
connection master;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp1;
|
||||
CREATE TEMPORARY TABLE t1 ( a int );
|
||||
--error 1051
|
||||
DROP TEMPORARY TABLE t1, t2;
|
||||
--error 1051
|
||||
DROP TEMPORARY TABLE tmp2;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
stop slave;
|
||||
wait_for_slave_to_stop;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
CREATE TEMPORARY TABLE tmp3 (a int);
|
||||
DROP TEMPORARY TABLE tmp3;
|
||||
|
||||
connection slave;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
|
||||
START SLAVE;
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
26
mysql-test/suite/rpl/t/rpl_geometry.test
Normal file
26
mysql-test/suite/rpl/t/rpl_geometry.test
Normal file
@@ -0,0 +1,26 @@
|
||||
source include/master-slave.inc;
|
||||
source include/have_binlog_format_row.inc;
|
||||
|
||||
#
|
||||
# Bug#48776, Bug#43784
|
||||
#
|
||||
create table t1(a varchar(100),
|
||||
b multipoint not null,
|
||||
c varchar(256));
|
||||
|
||||
insert into t1 set
|
||||
a='hello',
|
||||
b=geomfromtext('multipoint(1 1)'),
|
||||
c='geometry';
|
||||
|
||||
create table t2 (a int(11) not null auto_increment primary key,
|
||||
b geometrycollection default null,
|
||||
c decimal(10,0));
|
||||
|
||||
insert into t2(c) values (null);
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
drop table t1, t2;
|
||||
source include/master-slave-end.inc;
|
||||
106
mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
Normal file
106
mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
Normal file
@@ -0,0 +1,106 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
#
|
||||
# BUG#28421 Infinite loop on slave relay logs
|
||||
#
|
||||
# That, manually deleteing one or more entries from 'master-bin.index', will
|
||||
# cause master infinitely loop to send one binlog file.
|
||||
#
|
||||
# Manually changing index file is a illegal action, so when this happen, we
|
||||
# send a fatal error to slave and close the dump session.
|
||||
|
||||
FLUSH LOGS;
|
||||
# Now, 2 entries in index file.
|
||||
# ./master-bin.000001
|
||||
# ./master-bin.000002
|
||||
|
||||
CREATE TABLE t1(c1 INT);
|
||||
# Now, the current dump file(master-bin.000002) is the second line of index
|
||||
# file
|
||||
sync_slave_with_master;
|
||||
# Now, all events has been replicate to slave. As current dump file
|
||||
# (master-bin.000002) is the last binlog file, so master is waiting for new
|
||||
# events.
|
||||
|
||||
connection master;
|
||||
# Delete './master-bin.000001' from index file.
|
||||
let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
|
||||
let $file= $MYSQLD_DATADIR/master-bin.index;
|
||||
source include/truncate_file.inc;
|
||||
|
||||
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
|
||||
{
|
||||
append_file $MYSQLD_DATADIR/master-bin.index;
|
||||
./master-bin.000002
|
||||
EOF
|
||||
sleep 0.00000001;
|
||||
}
|
||||
|
||||
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
|
||||
{
|
||||
append_file $MYSQLD_DATADIR/master-bin.index;
|
||||
.\master-bin.000002
|
||||
EOF
|
||||
sleep 0.00000001;
|
||||
}
|
||||
|
||||
# Now, only 1 entry in index file. ./master-bin.000002
|
||||
|
||||
# Generate master-bin.000003, but it is in the second line.
|
||||
FLUSH LOGS;
|
||||
# Now, 2 entries in index file.
|
||||
# ./master-bin.000002
|
||||
# ./master-bin.000003
|
||||
|
||||
# Now, master know that new binlog file(master-bin.000003) has been generated.
|
||||
# It expects that the new binlog file is in third line of index file, but
|
||||
# there is no third line in index file. It is so strange that master sends an
|
||||
# error to slave.
|
||||
call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log');
|
||||
connection slave;
|
||||
source include/wait_for_slave_io_to_stop.inc;
|
||||
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
|
||||
echo Last_IO_Error;
|
||||
echo $last_error;
|
||||
|
||||
connection master;
|
||||
|
||||
source include/truncate_file.inc;
|
||||
|
||||
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
|
||||
{
|
||||
append_file $MYSQLD_DATADIR/master-bin.index;
|
||||
./master-bin.000001
|
||||
./master-bin.000002
|
||||
./master-bin.000003
|
||||
EOF
|
||||
sleep 0.00000001;
|
||||
}
|
||||
|
||||
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
|
||||
{
|
||||
append_file $MYSQLD_DATADIR/master-bin.index;
|
||||
.\master-bin.000001
|
||||
.\master-bin.000002
|
||||
.\master-bin.000003
|
||||
EOF
|
||||
sleep 0.00000001;
|
||||
}
|
||||
|
||||
CREATE TABLE t2(c1 INT);
|
||||
FLUSH LOGS;
|
||||
CREATE TABLE t3(c1 INT);
|
||||
FLUSH LOGS;
|
||||
CREATE TABLE t4(c1 INT);
|
||||
|
||||
connection slave;
|
||||
START SLAVE IO_THREAD;
|
||||
source include/wait_for_slave_io_to_start.inc;
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
SHOW TABLES;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
source include/master-slave-end.inc;
|
||||
@@ -3,12 +3,16 @@
|
||||
#
|
||||
source include/master-slave.inc;
|
||||
|
||||
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
|
||||
|
||||
create table t1(id int, i int, r1 int, r2 int, p varchar(100));
|
||||
insert into t1 values(1, connection_id(), 0, 0, "");
|
||||
# don't put rand and password in the same query, to see if they replicate
|
||||
# independently
|
||||
# Pure rand test
|
||||
--disable_warnings
|
||||
insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
|
||||
--enable_warnings
|
||||
# change the rand suite on the master (we do this because otherwise password()
|
||||
# benefits from the fact that the above rand() is well replicated :
|
||||
# it picks the same sequence element, which hides a possible bug in password() replication.
|
||||
@@ -19,7 +23,9 @@ set sql_log_bin=1;
|
||||
# Pure password test
|
||||
insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
|
||||
# "altogether now"
|
||||
--disable_warnings
|
||||
insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
|
||||
--enable_warnings
|
||||
select * into outfile 'rpl_misc_functions.outfile' from t1;
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
sync_slave_with_master;
|
||||
@@ -73,11 +79,13 @@ DELIMITER ;|
|
||||
|
||||
# Exercise the functions and procedures then compare the results on
|
||||
# the master to those on the slave.
|
||||
--disable_warnings
|
||||
CALL test_replication_sp1();
|
||||
CALL test_replication_sp2();
|
||||
INSERT INTO t1 (col_a) VALUES (test_replication_sf());
|
||||
INSERT INTO t1 (col_a) VALUES (test_replication_sf());
|
||||
INSERT INTO t1 (col_a) VALUES (test_replication_sf());
|
||||
--enable_warnings
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
|
||||
53
mysql-test/suite/rpl/t/rpl_myisam_null_values.test
Normal file
53
mysql-test/suite/rpl/t/rpl_myisam_null_values.test
Normal file
@@ -0,0 +1,53 @@
|
||||
# BUG#49481: RBR: MyISAM and bit fields may cause slave to stop on delete cant find record
|
||||
# BUG#49482: RBR: Replication may break on deletes when MyISAM tables + char field are used
|
||||
|
||||
-- source include/master-slave.inc
|
||||
-- source include/have_binlog_format_mixed_or_row.inc
|
||||
|
||||
-- connection master
|
||||
CREATE TABLE t1 (c1 BIT, c2 INT);
|
||||
INSERT INTO `t1` VALUES ( 1, 1 );
|
||||
UPDATE t1 SET c1=NULL where c2=1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_table_1=master:test.t1
|
||||
-- let $diff_table_2=slave:test.t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
-- connection master
|
||||
DELETE FROM t1 WHERE c2=1 LIMIT 1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_table_1=master:test.t1
|
||||
-- let $diff_table_2=slave:test.t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
-- connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- connection master
|
||||
|
||||
CREATE TABLE t1 (c1 CHAR);
|
||||
|
||||
INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ;
|
||||
SELECT * FROM t1;
|
||||
-- echo # should trigger switch to row due to LIMIT
|
||||
UPDATE t1 SET c1=NULL WHERE c1='w' LIMIT 2;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_table_1=master:test.t1
|
||||
-- let $diff_table_2=slave:test.t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
-- connection master
|
||||
DELETE FROM t1 LIMIT 2;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_table_1=master:test.t1
|
||||
-- let $diff_table_2=slave:test.t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
-- connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
--source include/master-slave.inc
|
||||
|
||||
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(1000));
|
||||
|
||||
# We replicate the connection_id in the query_log_event
|
||||
@@ -41,7 +43,9 @@ INSERT INTO t1 VALUES
|
||||
(UTC_TIMESTAMP());
|
||||
|
||||
# We replicate the random seed in a rand_log_event
|
||||
--disable_warnings
|
||||
INSERT INTO t1 VALUES (RAND());
|
||||
--enable_warnings
|
||||
# We replicate the last_insert_id in an intvar_log_event
|
||||
INSERT INTO t1 VALUES (LAST_INSERT_ID());
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
|
||||
|
||||
create table t1 (a int not null auto_increment primary key, b int, key(b));
|
||||
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
@@ -30,8 +32,8 @@ INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
save_master_pos;
|
||||
# a few updates to force OPTIMIZE to do something
|
||||
update t1 set b=(a/2*rand());
|
||||
--disable_warnings
|
||||
update t1 set b=(a/2*rand());
|
||||
delete from t1 order by b limit 10000;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
@@ -2,38 +2,39 @@
|
||||
# BUG#42749: infinite loop writing to row based binlog - processlist shows
|
||||
# "freeing items"
|
||||
#
|
||||
#
|
||||
# WHY
|
||||
# ===
|
||||
#
|
||||
# This bug would make table map event to report data_written one byte less
|
||||
# than what would actually be written in its body. This would cause one byte shorter
|
||||
# event end_log_pos. The ultimate impact was that it would make fixing the
|
||||
# position in MYSQL_BIN_LOG::write_cache bogus or end up in an infinite loop.
|
||||
#
|
||||
# This bug would make table map event to report data_written one
|
||||
# byte less than what would actually be written in its body. This
|
||||
# would cause one byte shorter event end_log_pos. The ultimate
|
||||
# impact was that it would make fixing the position in
|
||||
# MYSQL_BIN_LOG::write_cache bogus or end up in an infinite loop.
|
||||
#
|
||||
# HOW
|
||||
# ===
|
||||
#
|
||||
# Checking that the patch fixes the problem is done as follows:
|
||||
# i) a table with several fields is created;
|
||||
#
|
||||
# i) one table with m_field_metadata sized at 290
|
||||
# ii) an insert is performed;
|
||||
# iii) the logs are flushed;
|
||||
# iv) mysqlbinlog is used to check if it succeeds.
|
||||
#
|
||||
# In step iv), before the bug was fixed, the test case would fail with
|
||||
# mysqlbinlog reporting that it was unable to succeed in reading the event.
|
||||
#
|
||||
# In step iv), before the bug was fixed, the test case would fail
|
||||
# with mysqlbinlog reporting that it was unable to succeed in
|
||||
# reading the event.
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
-- source include/master-slave.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- connection default
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
-- disable_warnings
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
-- enable_warnings
|
||||
|
||||
-- echo ### TABLE with field_metadata_size == 290
|
||||
CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`c2` varchar(30) NOT NULL,
|
||||
@@ -185,15 +186,155 @@ CREATE TABLE `t1` (
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1`(c2) VALUES ('1');
|
||||
FLUSH LOGS;
|
||||
|
||||
INSERT INTO `t1` VALUES ('1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1');
|
||||
-- sync_slave_with_master
|
||||
-- connection master
|
||||
|
||||
-- echo ### assertion: the slave replicated event successfully and tables match
|
||||
-- let $diff_table_1=master:test.t1
|
||||
-- let $diff_table_2=slave:test.t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
DROP TABLE `t1`;
|
||||
|
||||
FLUSH LOGS;
|
||||
-- connection master
|
||||
-- sync_slave_with_master
|
||||
-- connection master
|
||||
|
||||
-- echo === Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail.
|
||||
|
||||
-- let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||
-- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog
|
||||
-- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog
|
||||
|
||||
#############################################################
|
||||
# BUG#50018: binlog corruption when table has many columns
|
||||
#
|
||||
# Same test from BUG#42749, but now we generate some SQL which
|
||||
# creates and inserts into tables with metadata size from 249
|
||||
# to 258.
|
||||
#
|
||||
# The test works as follows:
|
||||
# 1. SQL for several CREATE TABLE and INSERTS are generated
|
||||
# into a file.
|
||||
# 2. This file is then "sourced"
|
||||
# 3. The slave is synchronized with the master
|
||||
# 4. FLUSH LOGS on master
|
||||
# 5. Compare tables on master and slave.
|
||||
# 6. run mysqlbinlog on master's binary log
|
||||
#
|
||||
# Steps #5 and #6 assert that binary log is not corrupted
|
||||
# in both cases: when slave is replaying events and when
|
||||
# mysqlbinlog is used to read the binary log
|
||||
|
||||
-- source include/master-slave-reset.inc
|
||||
-- connection master
|
||||
|
||||
# Create several tables with field_metadata_size ranging
|
||||
# from 249 to 258 (so that we cover 251 and 255 range).
|
||||
# This should exercise the switch between using 1 or 3
|
||||
# bytes to pack m_field_metadata_size.
|
||||
#
|
||||
# Each varchar field takes up to 2 metadata bytes, see:
|
||||
#
|
||||
# Field_varstring::do_save_field_metadata (field.cc)
|
||||
#
|
||||
# The float field takes 1 byte, see:
|
||||
#
|
||||
# Field_float::do_save_field_metadata (field.cc)
|
||||
#
|
||||
|
||||
-- let $generated_sql= $MYSQLTEST_VARDIR/tmp/b50018.sql
|
||||
-- let B50018_FILE= $generated_sql
|
||||
|
||||
-- echo ### action: generating several tables with different metadata
|
||||
-- echo ### sizes (resorting to perl)
|
||||
-- perl
|
||||
my $file= $ENV{'B50018_FILE'};
|
||||
open(FILE, ">", "$file") or die "Unable to open bug 50018 generated SQL file: $!" ;
|
||||
|
||||
my $tables= "";
|
||||
my $ntables= 10;
|
||||
my $base_ncols= 124;
|
||||
|
||||
for my $i (1..$ntables)
|
||||
{
|
||||
my $ncols= $base_ncols + $i;
|
||||
my $metadata_size= $ncols_variable * 2 + 1;
|
||||
|
||||
print FILE "-- echo ### testing table with " . ($base_ncols*2 + $i) . " field metadata size.\n";
|
||||
print FILE "CREATE TABLE t$i (\n";
|
||||
for my $n (1..$base_ncols)
|
||||
{
|
||||
print FILE "c$n VARCHAR(30) NOT NULL DEFAULT 'BUG#50018',\n";
|
||||
}
|
||||
|
||||
for my $n (1..$i)
|
||||
{
|
||||
print FILE "c" . ($base_ncols+$n) . " FLOAT NOT NULL DEFAULT 0";
|
||||
if ($n < $i)
|
||||
{
|
||||
print FILE ",\n";
|
||||
}
|
||||
}
|
||||
|
||||
print FILE ") Engine=InnoDB;\n";
|
||||
|
||||
$tables.= " t$i WRITE";
|
||||
if ($i < $ntables)
|
||||
{
|
||||
$tables .=",";
|
||||
}
|
||||
|
||||
print FILE "LOCK TABLES t$i WRITE;\n";
|
||||
print FILE "INSERT INTO t$i(c". ($base_ncols+1) . ") VALUES (50018);\n";
|
||||
print FILE "UNLOCK TABLES;";
|
||||
}
|
||||
|
||||
close(FILE);
|
||||
|
||||
EOF
|
||||
|
||||
## we don't need this in the result file
|
||||
## however, for debugging purposes you
|
||||
## may want to reactivate query logging
|
||||
-- disable_query_log
|
||||
-- source $generated_sql
|
||||
-- enable_query_log
|
||||
|
||||
-- sync_slave_with_master
|
||||
-- connection master
|
||||
|
||||
FLUSH LOGS;
|
||||
|
||||
-- let $ntables=10
|
||||
while($ntables)
|
||||
{
|
||||
-- echo ### assertion: the slave replicated event successfully and tables match for t$ntables
|
||||
-- let $diff_table_1=master:test.t$ntables
|
||||
-- let $diff_table_2=slave:test.t$ntables
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
-- connection master
|
||||
-- disable_query_log
|
||||
-- eval DROP TABLE t$ntables
|
||||
-- enable_query_log
|
||||
-- sync_slave_with_master
|
||||
-- connection master
|
||||
|
||||
-- dec $ntables
|
||||
}
|
||||
|
||||
-- echo ### assertion: check that binlog is not corrupt. Using mysqlbinlog to
|
||||
-- echo ### detect failure. Before the patch mysqlbinlog would find
|
||||
-- echo ### a corrupted event, thence would fail.
|
||||
-- let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||
-- exec $MYSQL_BINLOG -v --hex $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog
|
||||
|
||||
## clean up
|
||||
## For debugging purposes you might want not to remove these
|
||||
-- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog
|
||||
-- remove_file $generated_sql
|
||||
-- source include/master-slave-end.inc
|
||||
@@ -40,10 +40,12 @@ insert into t3 values(100,"log",0,0,0);
|
||||
SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186;
|
||||
|
||||
# Emulate that we have rows 2-9 deleted on the slave
|
||||
--disable_warnings
|
||||
insert into t1 values(1,1,rand()),(NULL,2,rand());
|
||||
insert into t2 (b) values(last_insert_id());
|
||||
insert into t2 values(3,0),(NULL,0);
|
||||
insert into t2 values(NULL,0),(500,0);
|
||||
--enable_warnings
|
||||
|
||||
select a,b, truncate(rand_value,4) from t1;
|
||||
select * from t2;
|
||||
|
||||
@@ -4,6 +4,7 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
|
||||
DROP FUNCTION IF EXISTS test.f1;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=NDB;
|
||||
|
||||
Reference in New Issue
Block a user