Commit bf9eb0f0 authored by unknown's avatar unknown

manual merge for bug_29136, bug#29309.


mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test:
  manual merge from 5.0
mysql-test/r/innodb.result:
  results changed
mysql-test/r/multi_update.result:
  results changed
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  manual merge: results re-recorded
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  results changed
mysql-test/suite/manual/r/rpl_replication_delay.result:
  results recorded for 5.1
mysql-test/t/innodb.test:
  removing bug27716 regression test as one exists in binlog suite already.
mysql-test/t/multi_update.test:
  manual merge plus refining for execution in both binlog_format.
sql/log_event.cc:
  bloody manual merge;
  the fact that an event is artificial is encode with setting timestamp argument to zero.
  rli's last_master_timestamp won't be updated in stmt_done in such case.
sql/rpl_rli.cc:
  simulation and the real fixing code.
  Don't update last_master_timestamp with zero.
sql/sql_delete.cc:
  manual merge
parent 1408095a
...@@ -126,7 +126,9 @@ drop table t1,t2; ...@@ -126,7 +126,9 @@ drop table t1,t2;
# #
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique) ENGINE=MyISAM;
CREATE TABLE t4 (a int, PRIMARY KEY (a), b int unique) ENGINE=Innodb;
CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
# #
...@@ -169,7 +171,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); ...@@ -169,7 +171,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique);
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
# #
# UPDATE (multi-update see bug#27716) # UPDATE inc multi-update
# #
# prepare # prepare
...@@ -185,9 +187,48 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); ...@@ -185,9 +187,48 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique);
source include/show_binlog_events.inc; # must be events of the query source include/show_binlog_events.inc; # must be events of the query
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
## multi_update::send_eof() branch
# prepare
delete from t3;
delete from t4;
insert into t3 values (1,1);
insert into t4 values (1,1),(2,2);
reset master;
# execute
--error ER_DUP_ENTRY
UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */;
# check
source include/show_binlog_events.inc; # the offset must denote there is the query
select count(*) from t1 /* must be 4 */;
## send_error() branch of multi_update
# prepare
delete from t1;
delete from t3;
delete from t4;
insert into t3 values (1,1),(2,2);
insert into t4 values (1,1),(2,2);
reset master;
# execute
--error ER_DUP_ENTRY
UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
# check
select count(*) from t1 /* must be 1 */;
# cleanup
drop table t4;
# #
# DELETE (for multi-delete see Bug #29136) # DELETE incl multi-delete
# #
# prepare # prepare
...@@ -203,6 +244,27 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); ...@@ -203,6 +244,27 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique);
# execute # execute
--error ER_DUP_ENTRY --error ER_DUP_ENTRY
delete from t2; delete from t2;
# check
source include/show_binlog_events.inc; # the offset must denote there is the query
select count(*) from t1 /* must be 1 */;
# cleanup
drop trigger trg_del;
# prepare
delete from t1;
delete from t2;
delete from t5;
create trigger trg_del_t2 after delete on t2 for each row
insert into t1 values (1);
insert into t2 values (2),(3);
insert into t5 values (1),(2);
reset master;
# execute
--error ER_DUP_ENTRY
delete t2.* from t2,t5 where t2.a=t5.a + 1;
# check # check
source include/show_binlog_events.inc; # must be events of the query source include/show_binlog_events.inc; # must be events of the query
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
...@@ -229,6 +291,8 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); ...@@ -229,6 +291,8 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique);
# #
# bug#23333 cleanup # bug#23333 cleanup
# #
drop trigger trg_del;
drop table t1,t2,t3,t4;
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
drop function bug27417; drop function bug27417;
...@@ -1086,6 +1086,19 @@ n d ...@@ -1086,6 +1086,19 @@ n d
1 30 1 30
2 20 2 20
drop table t1,t2; drop table t1,t2;
drop table if exists t1, t2;
CREATE TABLE t1 (a int, PRIMARY KEY (a));
CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
create trigger trg_del_t2 after delete on t2 for each row
insert into t1 values (1);
insert into t1 values (1);
insert into t2 values (1),(2);
delete t2 from t2;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select count(*) from t2 /* must be 2 as restored after rollback caused by the error */;
count(*)
2
drop table t1, t2;
create table t1 (a int, b int) engine=innodb; create table t1 (a int, b int) engine=innodb;
insert into t1 values(20,null); insert into t1 values(20,null);
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
...@@ -1751,10 +1764,10 @@ Variable_name Value ...@@ -1751,10 +1764,10 @@ Variable_name Value
Innodb_page_size 16384 Innodb_page_size 16384
show status like "Innodb_rows_deleted"; show status like "Innodb_rows_deleted";
Variable_name Value Variable_name Value
Innodb_rows_deleted 70 Innodb_rows_deleted 71
show status like "Innodb_rows_inserted"; show status like "Innodb_rows_inserted";
Variable_name Value Variable_name Value
Innodb_rows_inserted 1083 Innodb_rows_inserted 1085
show status like "Innodb_rows_updated"; show status like "Innodb_rows_updated";
Variable_name Value Variable_name Value
Innodb_rows_updated 886 Innodb_rows_updated 886
......
...@@ -614,6 +614,7 @@ CREATE TABLE `t2` ( ...@@ -614,6 +614,7 @@ CREATE TABLE `t2` (
`b` int(11) default NULL, `b` int(11) default NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
set @sav_binlog_format= @@session.binlog_format;
set @@session.binlog_format= mixed; set @@session.binlog_format= mixed;
insert into t1 values (1,1),(2,2); insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4); insert into t2 values (1,1),(4,4);
...@@ -626,7 +627,7 @@ a b ...@@ -626,7 +627,7 @@ a b
4 4 4 4
show master status /* there must be the UPDATE query event */; show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 197 master-bin.000001 268
delete from t1; delete from t1;
delete from t2; delete from t2;
insert into t1 values (1,2),(3,4),(4,4); insert into t1 values (1,2),(3,4),(4,4);
...@@ -636,6 +637,24 @@ UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; ...@@ -636,6 +637,24 @@ UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
ERROR 23000: Duplicate entry '4' for key 'PRIMARY' ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
show master status /* there must be the UPDATE query event */; show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 212 master-bin.000001 283
drop table t1, t2; drop table t1, t2;
set @@session.binlog_format= @sav_binlog_format;
drop table if exists t1, t2, t3;
CREATE TABLE t1 (a int, PRIMARY KEY (a));
CREATE TABLE t2 (a int, PRIMARY KEY (a));
CREATE TABLE t3 (a int, PRIMARY KEY (a)) ENGINE=MyISAM;
create trigger trg_del_t3 before delete on t3 for each row insert into t1 values (1);
insert into t2 values (1),(2);
insert into t3 values (1),(2);
reset master;
delete t3.* from t2,t3 where t2.a=t3.a;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select count(*) from t1 /* must be 1 */;
count(*)
1
select count(*) from t3 /* must be 1 */;
count(*)
1
drop table t1, t2, t3;
end of tests end of tests
...@@ -520,7 +520,9 @@ count(*) ...@@ -520,7 +520,9 @@ count(*)
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique) ENGINE=MyISAM;
CREATE TABLE t4 (a int, PRIMARY KEY (a), b int unique) ENGINE=Innodb;
CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
insert into t2 values (1); insert into t2 values (1);
reset master; reset master;
insert into t2 values (bug27417(1)); insert into t2 values (bug27417(1));
...@@ -559,6 +561,33 @@ master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1) ...@@ -559,6 +561,33 @@ master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1)
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
count(*) count(*)
2 2
delete from t3;
delete from t4;
insert into t3 values (1,1);
insert into t4 values (1,1),(2,2);
reset master;
UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=6
master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */
master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from t1 /* must be 4 */;
count(*)
4
delete from t1;
delete from t3;
delete from t4;
insert into t3 values (1,1),(2,2);
insert into t4 values (1,1),(2,2);
reset master;
UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
select count(*) from t1 /* must be 1 */;
count(*)
1
drop table t4;
delete from t1; delete from t1;
delete from t2; delete from t2;
delete from t3; delete from t3;
...@@ -571,12 +600,30 @@ delete from t2; ...@@ -571,12 +600,30 @@ delete from t2;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=6 master-bin.000001 # Intvar # # INSERT_ID=9
master-bin.000001 # Query # # use `test`; delete from t2 master-bin.000001 # Query # # use `test`; delete from t2
master-bin.000001 # Query # # use `test`; ROLLBACK master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
count(*) count(*)
1 1
drop trigger trg_del;
delete from t1;
delete from t2;
delete from t5;
create trigger trg_del_t2 after delete on t2 for each row
insert into t1 values (1);
insert into t2 values (2),(3);
insert into t5 values (1),(2);
reset master;
delete t2.* from t2,t5 where t2.a=t5.a + 1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; delete t2.* from t2,t5 where t2.a=t5.a + 1
master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from t1 /* must be 1 */;
count(*)
1
delete from t1; delete from t1;
create table t4 (a int default 0, b int primary key) engine=innodb; create table t4 (a int default 0, b int primary key) engine=innodb;
insert into t4 values (0, 17); insert into t4 values (0, 17);
...@@ -591,11 +638,11 @@ count(*) ...@@ -591,11 +638,11 @@ count(*)
2 2
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=7 master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12 master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12
master-bin.000001 # Intvar # # INSERT_ID=7 master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1 master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1
master-bin.000001 # Query # # use `test`; ROLLBACK master-bin.000001 # Query # # use `test`; ROLLBACK
drop trigger trg_del; drop trigger trg_del_t2;
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4,t5;
drop function bug27417; drop function bug27417;
...@@ -494,7 +494,9 @@ count(*) ...@@ -494,7 +494,9 @@ count(*)
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique) ENGINE=MyISAM;
CREATE TABLE t4 (a int, PRIMARY KEY (a), b int unique) ENGINE=Innodb;
CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
insert into t2 values (1); insert into t2 values (1);
reset master; reset master;
insert into t2 values (bug27417(1)); insert into t2 values (bug27417(1));
...@@ -533,6 +535,33 @@ master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1) ...@@ -533,6 +535,33 @@ master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1)
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
count(*) count(*)
2 2
delete from t3;
delete from t4;
insert into t3 values (1,1);
insert into t4 values (1,1),(2,2);
reset master;
UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=6
master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */
master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from t1 /* must be 4 */;
count(*)
4
delete from t1;
delete from t3;
delete from t4;
insert into t3 values (1,1),(2,2);
insert into t4 values (1,1),(2,2);
reset master;
UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
select count(*) from t1 /* must be 1 */;
count(*)
1
drop table t4;
delete from t1; delete from t1;
delete from t2; delete from t2;
delete from t3; delete from t3;
...@@ -545,12 +574,30 @@ delete from t2; ...@@ -545,12 +574,30 @@ delete from t2;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=6 master-bin.000001 # Intvar # # INSERT_ID=9
master-bin.000001 # Query # # use `test`; delete from t2 master-bin.000001 # Query # # use `test`; delete from t2
master-bin.000001 # Query # # use `test`; ROLLBACK master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
count(*) count(*)
1 1
drop trigger trg_del;
delete from t1;
delete from t2;
delete from t5;
create trigger trg_del_t2 after delete on t2 for each row
insert into t1 values (1);
insert into t2 values (2),(3);
insert into t5 values (1),(2);
reset master;
delete t2.* from t2,t5 where t2.a=t5.a + 1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; delete t2.* from t2,t5 where t2.a=t5.a + 1
master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from t1 /* must be 1 */;
count(*)
1
delete from t1; delete from t1;
create table t4 (a int default 0, b int primary key) engine=innodb; create table t4 (a int default 0, b int primary key) engine=innodb;
insert into t4 values (0, 17); insert into t4 values (0, 17);
...@@ -565,13 +612,13 @@ count(*) ...@@ -565,13 +612,13 @@ count(*)
2 2
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=7 master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12 master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12
master-bin.000001 # Intvar # # INSERT_ID=7 master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1 master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1
master-bin.000001 # Query # # use `test`; ROLLBACK master-bin.000001 # Query # # use `test`; ROLLBACK
drop trigger trg_del; drop trigger trg_del_t2;
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4,t5;
drop function bug27417; drop function bug27417;
set @@session.binlog_format=@@global.binlog_format; set @@session.binlog_format=@@global.binlog_format;
end of tests end of tests
...@@ -11,7 +11,7 @@ Master_User root ...@@ -11,7 +11,7 @@ Master_User root
Master_Port 9306 Master_Port 9306
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 98 Read_Master_Log_Pos 106
Relay_Log_File # Relay_Log_File #
Relay_Log_Pos # Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
...@@ -26,7 +26,7 @@ Replicate_Wild_Ignore_Table ...@@ -26,7 +26,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0 Last_Errno 0
Last_Error Last_Error
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 98 Exec_Master_Log_Pos 106
Relay_Log_Space # Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
...@@ -38,6 +38,11 @@ Master_SSL_Cert ...@@ -38,6 +38,11 @@ Master_SSL_Cert
Master_SSL_Cipher Master_SSL_Cipher
Master_SSL_Key Master_SSL_Key
Seconds_Behind_Master 0 Seconds_Behind_Master 0
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
drop table if exists t1; drop table if exists t1;
Warnings: Warnings:
Note 1051 Unknown table 't1' Note 1051 Unknown table 't1'
...@@ -52,7 +57,7 @@ Master_User root ...@@ -52,7 +57,7 @@ Master_User root
Master_Port 9306 Master_Port 9306
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 359 Read_Master_Log_Pos 367
Relay_Log_File # Relay_Log_File #
Relay_Log_Pos # Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
...@@ -67,7 +72,7 @@ Replicate_Wild_Ignore_Table ...@@ -67,7 +72,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0 Last_Errno 0
Last_Error Last_Error
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 271 Exec_Master_Log_Pos 279
Relay_Log_Space # Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
...@@ -78,7 +83,12 @@ Master_SSL_CA_Path ...@@ -78,7 +83,12 @@ Master_SSL_CA_Path
Master_SSL_Cert Master_SSL_Cert
Master_SSL_Cipher Master_SSL_Cipher
Master_SSL_Key Master_SSL_Key
Seconds_Behind_Master 10 Seconds_Behind_Master 9
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
unlock tables; unlock tables;
flush logs /* this time rli->last_master_timestamp is not affected */; flush logs /* this time rli->last_master_timestamp is not affected */;
lock table t1 write; lock table t1 write;
...@@ -90,7 +100,7 @@ Master_User root ...@@ -90,7 +100,7 @@ Master_User root
Master_Port 9306 Master_Port 9306
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 447 Read_Master_Log_Pos 455
Relay_Log_File # Relay_Log_File #
Relay_Log_Pos # Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
...@@ -105,7 +115,7 @@ Replicate_Wild_Ignore_Table ...@@ -105,7 +115,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0 Last_Errno 0
Last_Error Last_Error
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 359 Exec_Master_Log_Pos 367
Relay_Log_Space # Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
...@@ -116,6 +126,11 @@ Master_SSL_CA_Path ...@@ -116,6 +126,11 @@ Master_SSL_CA_Path
Master_SSL_Cert Master_SSL_Cert
Master_SSL_Cipher Master_SSL_Cipher
Master_SSL_Key Master_SSL_Key
Seconds_Behind_Master 6 Seconds_Behind_Master 7
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
unlock tables; unlock tables;
drop table t1; drop table t1;
...@@ -753,45 +753,6 @@ select * from t1; ...@@ -753,45 +753,6 @@ select * from t1;
select * from t2; select * from t2;
drop table t1,t2; drop table t1,t2;
#
# Bug#27716 multi-update did partially and has not binlogged
#
CREATE TABLE `t1` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
CREATE TABLE `t2` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
# A. testing multi_update::send_eof() execution branch
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4);
reset master;
--error ER_DUP_ENTRY
UPDATE t2,t1 SET t2.a=t1.a+2;
# check
select * from t2 /* must be (3,1), (4,4) */;
show master status /* there must no UPDATE in binlog */;
# B. testing multi_update::send_error() execution branch
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
insert into t2 values (1,2),(3,4),(4,4);
reset master;
--error ER_DUP_ENTRY
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
show master status /* there must be no UPDATE query event */;
# cleanup bug#27716
drop table t1, t2;
# #
# Bug #29136 erred multi-delete on trans table does not rollback # Bug #29136 erred multi-delete on trans table does not rollback
# #
......
...@@ -588,6 +588,7 @@ CREATE TABLE `t2` ( ...@@ -588,6 +588,7 @@ CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
# as the test is about to see erroed queries in binlog # as the test is about to see erroed queries in binlog
set @sav_binlog_format= @@session.binlog_format;
set @@session.binlog_format= mixed; set @@session.binlog_format= mixed;
...@@ -614,6 +615,7 @@ show master status /* there must be the UPDATE query event */; ...@@ -614,6 +615,7 @@ show master status /* there must be the UPDATE query event */;
# cleanup bug#27716 # cleanup bug#27716
drop table t1, t2; drop table t1, t2;
set @@session.binlog_format= @sav_binlog_format;
# #
# Bug #29136 erred multi-delete on trans table does not rollback # Bug #29136 erred multi-delete on trans table does not rollback
...@@ -642,11 +644,13 @@ delete t3.* from t2,t3 where t2.a=t3.a; ...@@ -642,11 +644,13 @@ delete t3.* from t2,t3 where t2.a=t3.a;
# check # check
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
select count(*) from t3 /* must be 1 */; select count(*) from t3 /* must be 1 */;
# the query must be in binlog (no surprise though)
source include/show_binlog_events.inc;
# cleanup bug#29136 # cleanup bug#29136
drop table t1, t2, t3; drop table t1, t2, t3;
#
# Add further tests from here
#
--echo end of tests --echo end of tests
...@@ -558,8 +558,32 @@ int Log_event::do_update_pos(Relay_log_info *rli) ...@@ -558,8 +558,32 @@ int Log_event::do_update_pos(Relay_log_info *rli)
Matz: I don't think we will need this check with this refactoring. Matz: I don't think we will need this check with this refactoring.
*/ */
if (rli) if (rli)
rli->stmt_done(log_pos, when); {
/*
bug#29309 simulation: resetting the flag to force
wrong behaviour of artificial event to update
rli->last_master_timestamp for only one time -
the first FLUSH LOGS in the test.
*/
DBUG_EXECUTE_IF("let_first_flush_log_change_timestamp",
if (debug_not_change_ts_if_art_event == 1
&& is_artificial_event())
{
debug_not_change_ts_if_art_event= 0;
});
#ifndef DBUG_OFF
rli->stmt_done(log_pos,
is_artificial_event() &&
debug_not_change_ts_if_art_event > 0 ? 0 : when);
#else
rli->stmt_done(log_pos, is_artificial_event()? 0 : when);
#endif
DBUG_EXECUTE_IF("let_first_flush_log_change_timestamp",
if (debug_not_change_ts_if_art_event == 0)
{
debug_not_change_ts_if_art_event= 2;
});
}
return 0; // Cannot fail currently return 0; // Cannot fail currently
} }
......
...@@ -1082,6 +1082,9 @@ bool Relay_log_info::cached_charset_compare(char *charset) const ...@@ -1082,6 +1082,9 @@ bool Relay_log_info::cached_charset_compare(char *charset) const
void Relay_log_info::stmt_done(my_off_t event_master_log_pos, void Relay_log_info::stmt_done(my_off_t event_master_log_pos,
time_t event_creation_time) time_t event_creation_time)
{ {
#ifndef DBUG_OFF
extern uint debug_not_change_ts_if_art_event;
#endif
clear_flag(IN_STMT); clear_flag(IN_STMT);
/* /*
...@@ -1121,7 +1124,12 @@ void Relay_log_info::stmt_done(my_off_t event_master_log_pos, ...@@ -1121,7 +1124,12 @@ void Relay_log_info::stmt_done(my_off_t event_master_log_pos,
is that value may take some time to display in is that value may take some time to display in
Seconds_Behind_Master - not critical). Seconds_Behind_Master - not critical).
*/ */
last_master_timestamp= event_creation_time; #ifndef DBUG_OFF
if (!(event_creation_time == 0 && debug_not_change_ts_if_art_event > 0))
#else
if (event_creation_time != 0)
#endif
last_master_timestamp= event_creation_time;
} }
} }
......
...@@ -758,9 +758,9 @@ void multi_delete::send_error(uint errcode,const char *err) ...@@ -758,9 +758,9 @@ void multi_delete::send_error(uint errcode,const char *err)
*/ */
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
Query_log_event qinfo(thd, thd->query, thd->query_length, thd->binlog_query(THD::ROW_QUERY_TYPE,
transactional_tables, FALSE); thd->query, thd->query_length,
mysql_bin_log.write(&qinfo); transactional_tables, FALSE);
} }
thd->transaction.all.modified_non_trans_table= true; thd->transaction.all.modified_non_trans_table= true;
} }
......
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