#At file:///media/sdb2/hezx/work/mysql/bzrwork/b43263/6.0-bugteam/ based on revid:azundris@stripped
3330 He Zhenxing 2009-05-31 [merge]
Merge 5.1-bt to 6.0-bt
A mysql-test/r/rpl_begin_commit_rollback.result
A mysql-test/t/rpl_begin_commit_rollback-slave.opt
A mysql-test/t/rpl_begin_commit_rollback.test
M mysql-test/suite/binlog/r/binlog_stm_binlog.result
M mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
M sql/ha_ndbcluster_binlog.cc
M sql/log.cc
M sql/log.h
M sql/log_event.cc
M sql/log_event.h
M sql/sp.cc
M sql/sp_head.cc
M sql/sql_acl.cc
M sql/sql_base.cc
M sql/sql_class.cc
M sql/sql_class.h
M sql/sql_db.cc
M sql/sql_delete.cc
M sql/sql_insert.cc
M sql/sql_load.cc
M sql/sql_table.cc
M sql/sql_update.cc
M sql/sql_view.cc
2497.917.27 He Zhenxing 2009-05-30 [merge]
Merge BUG#41948
M sql/ha_ndbcluster_binlog.cc
M sql/log.cc
M sql/log.h
M sql/log_event.cc
M sql/log_event.h
M sql/sp.cc
M sql/sp_head.cc
M sql/sql_acl.cc
M sql/sql_base.cc
M sql/sql_class.cc
M sql/sql_class.h
M sql/sql_db.cc
M sql/sql_delete.cc
M sql/sql_insert.cc
M sql/sql_load.cc
M sql/sql_table.cc
M sql/sql_update.cc
M sql/sql_view.cc
2497.931.1 He Zhenxing 2009-05-30
BUG#41948 Query_log_event constructor needlessly contorted
Make the caller of Query_log_event, Execute_load_log_event
constructors and THD::binlog_query to provide the error code
instead of having the constructors to figure out the error code.
@ sql/log_event.cc
Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument instead of figuring it out by itself
@ sql/log_event.h
Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument
M sql/ha_ndbcluster_binlog.cc
M sql/log.cc
M sql/log.h
M sql/log_event.cc
M sql/log_event.h
M sql/sp.cc
M sql/sp_head.cc
M sql/sql_acl.cc
M sql/sql_base.cc
M sql/sql_class.cc
M sql/sql_class.h
M sql/sql_db.cc
M sql/sql_delete.cc
M sql/sql_insert.cc
M sql/sql_load.cc
M sql/sql_table.cc
M sql/sql_update.cc
M sql/sql_view.cc
2497.917.26 He Zhenxing 2009-05-30 [merge]
Merge BUG#43263 from 5.0-bugteam to 5.1-bugteam
A mysql-test/r/rpl_begin_commit_rollback.result
A mysql-test/t/rpl_begin_commit_rollback-slave.opt
A mysql-test/t/rpl_begin_commit_rollback.test
M mysql-test/suite/binlog/r/binlog_stm_binlog.result
M mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
M sql/log.cc
M sql/log_event.cc
1810.3924.9 He Zhenxing 2009-05-30
BUG#43263 BEGIN skipped in some replicate-do-db cases
BEGIN/COMMIT/ROLLBACK was subject to replication db rules, and
caused the boundary of a transaction not recognized correctly
when these queries were ignored by the rules.
Fixed the problem by skipping replication db rules for these
statements.
@ sql/log_event.cc
Skip checking replication db rules for BEGIN/COMMIT/ROLLBACK statements
A mysql-test/r/rpl_begin_commit_rollback.result
A mysql-test/t/rpl_begin_commit_rollback-slave.opt
A mysql-test/t/rpl_begin_commit_rollback.test
M mysql-test/r/binlog.result
M mysql-test/r/mix_innodb_myisam_binlog.result
M sql/log.cc
M sql/log_event.cc
=== added file 'mysql-test/r/rpl_begin_commit_rollback.result'
--- a/mysql-test/r/rpl_begin_commit_rollback.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/rpl_begin_commit_rollback.result 2009-05-30 13:22:01 +0000
@@ -0,0 +1,75 @@
+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 DATABASE IF EXISTS db1;
+CREATE DATABASE db1;
+use db1;
+CREATE TABLE db1.t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE db1.t2 (a INT) ENGINE=MyISAM;
+include/stop_slave.inc
+CREATE PROCEDURE db1.p1 ()
+BEGIN
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+END//
+CREATE PROCEDURE db1.p2 ()
+BEGIN
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+INSERT INTO t2 VALUES (1);
+END//
+use test;
+BEGIN;
+CALL db1.p1();
+COMMIT;
+SELECT * FROM db1.t1;
+a
+1
+2
+3
+4
+5
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_POS;
+#
+# If we got no rows here, then we're suffering BUG#43263
+#
+SELECT * FROM db1.t1;
+a
+1
+2
+3
+4
+5
+BEGIN;
+CALL db1.p2();
+ROLLBACK;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_POS;
+#
+# If we got no rows here, then we're suffering BUG#43263
+#
+SELECT * FROM db1.t1;
+a
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+#
+# Clean up
+#
+DROP DATABASE db1;
+DROP DATABASE db1;
=== modified file 'mysql-test/suite/binlog/r/binlog_stm_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result 2009-03-25 19:49:31 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result 2009-05-31 00:55:17 +0000
@@ -27,7 +27,7 @@ master-bin.000001 # Query # # use `test`
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Query # # use `test`; insert t1 values (5)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert t2 values (5)
master-bin.000001 # Xid # # COMMIT /* XID */
drop table t1,t2;
@@ -39,7 +39,7 @@ drop table t1;
show binlog events in 'master-bin.000001' from 107;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb
-master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Query 1 # use `test`; insert into t1 values(100 + 4)
master-bin.000001 # Query 1 # use `test`; insert into t1 values(99 + 4)
master-bin.000001 # Query 1 # use `test`; insert into t1 values(98 + 4)
@@ -159,7 +159,7 @@ show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4
master-bin.000001 107 Query 1 206 use `test`; create table t1(n int) engine=innodb
-master-bin.000001 206 Query 1 274 use `test`; BEGIN
+master-bin.000001 206 Query 1 274 BEGIN
master-bin.000001 274 Query 1 362 use `test`; insert into t1 values (1)
master-bin.000001 362 Query 1 450 use `test`; insert into t1 values (2)
master-bin.000001 450 Query 1 538 use `test`; insert into t1 values (3)
@@ -173,7 +173,7 @@ show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4
master-bin.000001 107 Query 1 207 use `test`; create table t1 (a int) engine=innodb
-master-bin.000001 207 Query 1 275 use `test`; BEGIN
+master-bin.000001 207 Query 1 275 BEGIN
master-bin.000001 275 Query 1 366 use `test`; insert into t1 values( 400 )
master-bin.000001 366 Query 1 457 use `test`; insert into t1 values( 399 )
master-bin.000001 457 Query 1 548 use `test`; insert into t1 values( 398 )
=== modified file 'mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result 2009-03-06 22:17:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result 2009-05-31 00:55:17 +0000
@@ -8,7 +8,7 @@ insert into t2 select * from t1;
commit;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(1)
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
master-bin.000001 # Xid # # COMMIT /* XID */
@@ -23,10 +23,10 @@ Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(2)
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
-master-bin.000001 # Query # # use `test`; ROLLBACK
+master-bin.000001 # Query # # ROLLBACK
delete from t1;
delete from t2;
reset master;
@@ -41,7 +41,7 @@ Warning 1196 Some non-transactional chan
commit;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(3)
master-bin.000001 # Query # # use `test`; savepoint my_savepoint
master-bin.000001 # Query # # use `test`; insert into t1 values(4)
@@ -67,7 +67,7 @@ a
7
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(5)
master-bin.000001 # Query # # use `test`; savepoint my_savepoint
master-bin.000001 # Query # # use `test`; insert into t1 values(6)
@@ -89,10 +89,10 @@ get_lock("a",10)
1
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(8)
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
-master-bin.000001 # Query # # use `test`; ROLLBACK
+master-bin.000001 # Query # # ROLLBACK
delete from t1;
delete from t2;
reset master;
@@ -100,7 +100,7 @@ insert into t1 values(9);
insert into t2 select * from t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(9)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
@@ -112,7 +112,7 @@ begin;
insert into t2 select * from t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(10)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
@@ -120,11 +120,11 @@ insert into t1 values(11);
commit;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(10)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(11)
master-bin.000001 # Xid # # COMMIT /* XID */
alter table t2 engine=INNODB;
@@ -137,7 +137,7 @@ insert into t2 select * from t1;
commit;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(12)
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
master-bin.000001 # Xid # # COMMIT /* XID */
@@ -162,7 +162,7 @@ rollback to savepoint my_savepoint;
commit;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(14)
master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
@@ -182,7 +182,7 @@ a
18
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(16)
master-bin.000001 # Query # # use `test`; insert into t1 values(18)
master-bin.000001 # Xid # # COMMIT /* XID */
@@ -233,24 +233,24 @@ get_lock("lock1",60)
1
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(16)
master-bin.000001 # Query # # use `test`; insert into t1 values(18)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; delete from t1
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; delete from t2
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; alter table t2 engine=MyISAM
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; insert into t2 values (20)
master-bin.000001 # Query # # use `test`; drop table t1,t2
master-bin.000001 # Query # # use `test`; create temporary table ti (a int) engine=innodb
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into ti values(1)
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; create temporary table t1 (a int) engine=myisam
@@ -404,11 +404,11 @@ count(*)
2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into ti values (1)
master-bin.000001 # Query # # use `test`; insert into ti values (2)
master-bin.000001 # Query # # use `test`; insert into tt select * from ti
-master-bin.000001 # Query # # use `test`; ROLLBACK
+master-bin.000001 # Query # # ROLLBACK
select count(*) from ti /* zero */;
count(*)
0
@@ -430,11 +430,11 @@ Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into ti values (1)
master-bin.000001 # Query # # use `test`; insert into ti values (2) /* to make the dup error in the following */
master-bin.000001 # Query # # use `test`; insert into tt select * from ti /* one affected and error */
-master-bin.000001 # Query # # use `test`; ROLLBACK
+master-bin.000001 # Query # # ROLLBACK
select count(*) from ti /* zero */;
count(*)
0
=== added file 'mysql-test/t/rpl_begin_commit_rollback-slave.opt'
--- a/mysql-test/t/rpl_begin_commit_rollback-slave.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/rpl_begin_commit_rollback-slave.opt 2009-05-30 13:22:01 +0000
@@ -0,0 +1 @@
+--replicate-do-db=db1
=== added file 'mysql-test/t/rpl_begin_commit_rollback.test'
--- a/mysql-test/t/rpl_begin_commit_rollback.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/rpl_begin_commit_rollback.test 2009-05-30 13:22:01 +0000
@@ -0,0 +1,97 @@
+source include/master-slave.inc;
+source include/have_innodb.inc;
+
+disable_warnings;
+DROP DATABASE IF EXISTS db1;
+enable_warnings;
+
+CREATE DATABASE db1;
+
+use db1;
+
+CREATE TABLE db1.t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE db1.t2 (a INT) ENGINE=MyISAM;
+
+sync_slave_with_master;
+source include/stop_slave.inc;
+connection master;
+
+DELIMITER //;
+CREATE PROCEDURE db1.p1 ()
+BEGIN
+ INSERT INTO t1 VALUES (1);
+ INSERT INTO t1 VALUES (2);
+ INSERT INTO t1 VALUES (3);
+ INSERT INTO t1 VALUES (4);
+ INSERT INTO t1 VALUES (5);
+END//
+
+CREATE PROCEDURE db1.p2 ()
+BEGIN
+ INSERT INTO t1 VALUES (6);
+ INSERT INTO t1 VALUES (7);
+ INSERT INTO t1 VALUES (8);
+ INSERT INTO t1 VALUES (9);
+ INSERT INTO t1 VALUES (10);
+ INSERT INTO t2 VALUES (1);
+END//
+DELIMITER ;//
+
+# Note: the master_log_pos is set to be the position of the BEGIN + 1,
+# so before fix of BUG#43263 if the BEGIN is ignored, then all the
+# INSERTS in p1 will be replicated in AUTOCOMMIT=1 mode and the slave
+# SQL thread will stop right before the first INSERT. After fix of
+# BUG#43263, BEGIN will not be ignored by the replication db rules,
+# and then the whole transaction will be executed before slave SQL
+# stop.
+let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $master_pos= `SELECT $master_pos + 1`;
+
+use test;
+BEGIN;
+CALL db1.p1();
+COMMIT;
+
+SELECT * FROM db1.t1;
+
+connection slave;
+
+replace_result $master_pos MASTER_POS;
+eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_pos;
+source include/wait_for_slave_sql_to_stop.inc;
+
+--echo #
+--echo # If we got no rows here, then we're suffering BUG#43263
+--echo #
+SELECT * FROM db1.t1;
+
+connection master;
+
+# See comments above.
+let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $master_pos= `SELECT $master_pos + 1`;
+
+BEGIN;
+CALL db1.p2();
+disable_warnings;
+ROLLBACK;
+enable_warnings;
+
+connection slave;
+
+replace_result $master_pos MASTER_POS;
+eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_pos;
+source include/wait_for_slave_sql_to_stop.inc;
+
+--echo #
+--echo # If we got no rows here, then we're suffering BUG#43263
+--echo #
+SELECT * FROM db1.t1;
+
+--echo #
+--echo # Clean up
+--echo #
+connection master;
+DROP DATABASE db1;
+connection slave;
+DROP DATABASE db1;
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2009-03-04 13:33:47 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2009-05-31 00:55:17 +0000
@@ -2248,9 +2248,11 @@ static void ndb_binlog_query(THD *thd, C
else
thd->server_id= schema->any_value;
thd->db= schema->db;
+ int errcode = query_error_code(thd, thd->killed == THD::NOT_KILLED);
thd->binlog_query(THD::STMT_QUERY_TYPE, schema->query,
schema->query_length, FALSE,
- schema->name[0] == 0 || thd->db[0] == 0);
+ schema->name[0] == 0 || thd->db[0] == 0,
+ errcode);
thd->server_id= thd_server_id_save;
thd->db= thd_db_save;
}
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2009-05-14 08:56:34 +0000
+++ b/sql/log.cc 2009-05-31 00:55:17 +0000
@@ -2767,7 +2767,7 @@ static int binlog_commit(handlerton *hto
{
if (!in_transaction || all)
{
- Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE);
+ Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, TRUE, 0);
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
error= binlog_end_trans(thd, trx_data, &qev, all);
goto end;
@@ -2826,8 +2826,7 @@ static int binlog_rollback(handlerton *h
transactional table in that statement as well, which needs to be
rolled back on the slave.
*/
- Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE);
- qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
+ Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, TRUE, 0);
error= binlog_end_trans(thd, trx_data, &qev, all);
}
else if (all && !thd->transaction.all.modified_non_trans_table ||
@@ -2875,10 +2874,11 @@ static int binlog_savepoint_set(handlert
binlog_trans_log_savepos(thd, (my_off_t*) sv);
/* Write it to the binary log */
-
+
+ int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
int const error=
thd->binlog_query(THD::STMT_QUERY_TYPE,
- thd->query, thd->query_length, TRUE, FALSE);
+ thd->query, thd->query_length, TRUE, FALSE, errcode);
DBUG_RETURN(error);
}
@@ -2894,9 +2894,10 @@ static int binlog_savepoint_rollback(han
if (unlikely(thd->transaction.all.modified_non_trans_table ||
(thd->options & OPTION_KEEP_LOG)))
{
+ int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
int error=
thd->binlog_query(THD::STMT_QUERY_TYPE,
- thd->query, thd->query_length, TRUE, FALSE);
+ thd->query, thd->query_length, TRUE, FALSE, errcode);
DBUG_RETURN(error);
}
binlog_trans_log_truncate(thd, *(my_off_t*)sv);
@@ -6271,6 +6272,35 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE
return 0; // All OK
}
+/*
+ Helper function to get the error code of the query to be binlogged.
+ */
+int query_error_code(THD *thd, bool not_killed)
+{
+ int error;
+
+ if (not_killed)
+ {
+ error= thd->is_error() ? thd->stmt_da->sql_errno() : 0;
+
+ /* thd->main_da.sql_errno() might be ER_SERVER_SHUTDOWN or
+ ER_QUERY_INTERRUPTED, So here we need to make sure that error
+ is not set to these errors when specified not_killed by the
+ caller.
+ */
+ if (error == ER_SERVER_SHUTDOWN || error == ER_QUERY_INTERRUPTED)
+ error= 0;
+ }
+ else
+ {
+ /* killed status for DELAYED INSERT thread should never be used */
+ DBUG_ASSERT(!(thd->system_thread & SYSTEM_THREAD_DELAYED_INSERT));
+ error= thd->killed_errno();
+ }
+
+ return error;
+}
+
/**
Write a cached log entry to the binary log.
- To support transaction over replication, we wrap the transaction
@@ -6314,19 +6344,8 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_C
transaction is either a BEGIN..COMMIT block or a single
statement in autocommit mode.
*/
- Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE);
- /*
- Imagine this is rollback due to net timeout, after all
- statements of the transaction succeeded. Then we want a
- zero-error code in BEGIN. In other words, if there was a
- really serious error code it's already in the statement's
- events, there is no need to put it also in this internally
- generated event, and as this event is generated late it would
- lead to false alarms.
+ Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE, 0);
- This is safer than thd->clear_error() against kills at shutdown.
- */
- qinfo.error_code= 0;
/*
Now this Query_log_event has artificial log_pos 0. It must be
adjusted to reflect the real position in the log. Not doing it
=== modified file 'sql/log.h'
--- a/sql/log.h 2009-04-24 12:55:11 +0000
+++ b/sql/log.h 2009-05-31 00:55:17 +0000
@@ -827,5 +827,6 @@ enum enum_binlog_format {
extern TYPELIB binlog_format_typelib;
uint purge_log_get_error_code(int res);
+int query_error_code(THD *thd, bool not_killed);
#endif /* LOG_H */
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2009-05-15 13:45:06 +0000
+++ b/sql/log_event.cc 2009-05-31 00:55:17 +0000
@@ -2320,19 +2320,16 @@ Query_log_event::Query_log_event()
query_length - size of the `query_arg' array
using_trans - there is a modified transactional table
suppress_use - suppress the generation of 'USE' statements
- killed_status_arg - an optional with default to THD::KILLED_NO_VALUE
- if the value is different from the default, the arg
- is set to the current thd->killed value.
- A caller might need to masquerade thd->killed with
- THD::NOT_KILLED.
+ errcode - the error code of the query
+
DESCRIPTION
Creates an event for binlogging
- The value for local `killed_status' can be supplied by caller.
+ The value for `errcode' should be supplied by caller.
*/
Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
ulong query_length, bool using_trans,
- bool suppress_use,
- THD::killed_state killed_status_arg)
+ bool suppress_use, int errcode)
+
:Log_event(thd_arg,
(thd_arg->thread_specific_used ? LOG_EVENT_THREAD_SPECIFIC_F :
0) |
@@ -2353,22 +2350,7 @@ Query_log_event::Query_log_event(THD* th
{
time_t end_time;
- if (killed_status_arg == THD::KILLED_NO_VALUE)
- killed_status_arg= thd_arg->killed;
- error_code=
- (killed_status_arg == THD::NOT_KILLED) ?
- (thd_arg->is_error() ? thd_arg->stmt_da->sql_errno() : 0) :
- ((thd_arg->system_thread & SYSTEM_THREAD_DELAYED_INSERT) ? 0 :
- thd_arg->killed_errno());
-
- /* thd_arg->main_da.sql_errno() might be ER_SERVER_SHUTDOWN or
- ER_QUERY_INTERRUPTED, So here we need to make sure that
- error_code is not set to these errors when specified NOT_KILLED
- by the caller
- */
- if ((killed_status_arg == THD::NOT_KILLED) &&
- (error_code == ER_SERVER_SHUTDOWN || error_code == ER_QUERY_INTERRUPTED))
- error_code= 0;
+ error_code= errcode;
time(&end_time);
exec_time = (ulong) (end_time - thd_arg->start_time);
@@ -3028,7 +3010,10 @@ int Query_log_event::do_apply_event(Rela
::do_apply_event(), then the companion SET also have so
we don't need to reset_one_shot_variables().
*/
- if (rpl_filter->db_ok(thd->db))
+ if (!strncmp(query_arg, "BEGIN", q_len_arg) ||
+ !strncmp(query_arg, "COMMIT", q_len_arg) ||
+ !strncmp(query_arg, "ROLLBACK", q_len_arg) ||
+ rpl_filter->db_ok(thd->db))
{
thd->set_time((time_t)when);
thd->query_length= q_len_arg;
@@ -6643,9 +6628,9 @@ Execute_load_query_log_event(THD *thd_ar
uint fn_pos_end_arg,
enum_load_dup_handling dup_handling_arg,
bool using_trans, bool suppress_use,
- THD::killed_state killed_err_arg):
+ int errcode):
Query_log_event(thd_arg, query_arg, query_length_arg, using_trans,
- suppress_use, killed_err_arg),
+ suppress_use, errcode),
file_id(thd_arg->file_id), fn_pos_start(fn_pos_start_arg),
fn_pos_end(fn_pos_end_arg), dup_handling(dup_handling_arg)
{
=== modified file 'sql/log_event.h'
--- a/sql/log_event.h 2009-05-14 21:49:53 +0000
+++ b/sql/log_event.h 2009-05-31 00:55:17 +0000
@@ -1644,8 +1644,7 @@ public:
#ifndef MYSQL_CLIENT
Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
- bool using_trans, bool suppress_use,
- THD::killed_state killed_err_arg= THD::KILLED_NO_VALUE);
+ bool using_trans, bool suppress_use, int error);
const char* get_db() { return db; }
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
@@ -2896,8 +2895,7 @@ public:
uint fn_pos_end_arg,
enum_load_dup_handling dup_handling_arg,
bool using_trans, bool suppress_use,
- THD::killed_state
- killed_err_arg= THD::KILLED_NO_VALUE);
+ int errcode);
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
#endif /* HAVE_REPLICATION */
=== modified file 'sql/sp.cc'
--- a/sql/sp.cc 2009-05-29 15:06:21 +0000
+++ b/sql/sp.cc 2009-05-31 00:55:17 +0000
@@ -954,7 +954,7 @@ sp_create_routine(THD *thd, int type, sp
/* Such a statement can always go directly to binlog, no trans cache */
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
log_query.c_ptr(), log_query.length(),
- FALSE, FALSE, THD::NOT_KILLED);
+ FALSE, FALSE, 0);
thd->variables.sql_mode= 0;
}
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2009-05-15 13:45:06 +0000
+++ b/sql/sp_head.cc 2009-05-31 00:55:17 +0000
@@ -1783,8 +1783,9 @@ sp_head::execute_function(THD *thd, Item
thd->options= binlog_save_options;
if (thd->binlog_evt_union.unioned_events)
{
+ int errcode = query_error_code(thd, thd->killed == THD::NOT_KILLED);
Query_log_event qinfo(thd, binlog_buf.ptr(), binlog_buf.length(),
- thd->binlog_evt_union.unioned_events_trans, FALSE);
+ thd->binlog_evt_union.unioned_events_trans, FALSE, errcode);
if (mysql_bin_log.write(&qinfo) &&
thd->binlog_evt_union.unioned_events_trans)
{
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2009-05-29 15:06:21 +0000
+++ b/sql/sql_acl.cc 2009-05-31 00:55:17 +0000
@@ -1655,7 +1655,7 @@ bool change_password(THD *thd, const cha
new_password));
thd->clear_error();
thd->binlog_query(THD::MYSQL_QUERY_TYPE, buff, query_length,
- FALSE, FALSE, THD::NOT_KILLED);
+ FALSE, FALSE, 0);
}
end:
close_thread_tables(thd);
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2009-05-25 10:10:18 +0000
+++ b/sql/sql_base.cc 2009-05-31 00:55:17 +0000
@@ -1656,7 +1656,7 @@ void close_temporary_tables(THD *thd)
thd->variables.character_set_client= system_charset_info;
Query_log_event qinfo(thd, s_query.ptr(),
s_query.length() - 1 /* to remove trailing ',' */,
- 0, FALSE, THD::NOT_KILLED);
+ 0, FALSE, 0);
thd->variables.character_set_client= cs_save;
mysql_bin_log.write(&qinfo);
thd->variables.pseudo_thread_id= save_pseudo_thread_id;
@@ -3390,9 +3390,10 @@ static bool open_table_entry_fini(THD *t
/* this DELETE FROM is needed even with row-based binlogging */
end = strxmov(strmov(query, "DELETE FROM `"),
share->db.str,"`.`",share->table_name.str,"`", NullS);
+ int errcode= query_error_code(thd, TRUE);
thd->binlog_query(THD::STMT_QUERY_TYPE,
query, (ulong)(end-query),
- FALSE, FALSE, THD::NOT_KILLED);
+ FALSE, FALSE, errcode);
my_free(query, MYF(0));
}
else
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2009-05-29 15:06:21 +0000
+++ b/sql/sql_class.cc 2009-05-31 00:55:17 +0000
@@ -3813,7 +3813,7 @@ show_query_type(THD::enum_binlog_query_t
*/
int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
ulong query_len, bool is_trans, bool suppress_use,
- THD::killed_state killed_status_arg)
+ int errcode)
{
DBUG_ENTER("THD::binlog_query");
DBUG_PRINT("enter", ("qtype: %s query: '%s'",
@@ -3880,7 +3880,7 @@ int THD::binlog_query(THD::enum_binlog_q
*/
{
Query_log_event qinfo(this, query_arg, query_len, is_trans, suppress_use,
- killed_status_arg);
+ errcode);
qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
/*
Binlog table maps will be irrelevant after a Query_log_event
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2009-05-29 15:06:21 +0000
+++ b/sql/sql_class.h 2009-05-31 00:55:17 +0000
@@ -1997,7 +1997,7 @@ public:
int binlog_query(enum_binlog_query_type qtype,
char const *query, ulong query_len,
bool is_trans, bool suppress_use,
- THD::killed_state killed_err_arg= THD::KILLED_NO_VALUE);
+ int errcode);
#endif
/*
=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc 2009-05-25 10:10:18 +0000
+++ b/sql/sql_db.cc 2009-05-31 00:55:17 +0000
@@ -181,8 +181,7 @@ uchar* dboptions_get_key(my_dbopt_t *opt
static inline void write_to_binlog(THD *thd, char *query, uint q_len,
char *db, uint db_len)
{
- Query_log_event qinfo(thd, query, q_len, 0, 0, THD::NOT_KILLED);
- qinfo.error_code= 0;
+ Query_log_event qinfo(thd, query, q_len, 0, 0, 0);
qinfo.db= db;
qinfo.db_len= db_len;
mysql_bin_log.write(&qinfo);
@@ -727,8 +726,9 @@ int mysql_create_db(THD *thd, char *db,
if (mysql_bin_log.is_open())
{
+ int errcode= query_error_code(thd, TRUE);
Query_log_event qinfo(thd, query, query_length, 0,
- /* suppress_use */ TRUE, THD::NOT_KILLED);
+ /* suppress_use */ TRUE, errcode);
/*
Write should use the database being created as the "current
@@ -818,8 +818,9 @@ bool mysql_alter_db(THD *thd, const char
if (mysql_bin_log.is_open())
{
+ int errcode= query_error_code(thd, TRUE);
Query_log_event qinfo(thd, thd->query, thd->query_length, 0,
- /* suppress_use */ TRUE, THD::NOT_KILLED);
+ /* suppress_use */ TRUE, errcode);
/*
Write should use the database being created as the "current
@@ -969,8 +970,9 @@ bool mysql_rm_db(THD *thd,char *db,bool
}
if (mysql_bin_log.is_open())
{
+ int errcode= query_error_code(thd, TRUE);
Query_log_event qinfo(thd, query, query_length, 0,
- /* suppress_use */ TRUE, THD::NOT_KILLED);
+ /* suppress_use */ TRUE, errcode);
/*
Write should use the database being created as the "current
database" and not the threads current database, which is the
@@ -1974,8 +1976,9 @@ bool mysql_upgrade_db(THD *thd, LEX_STRI
/* Step8: logging */
if (mysql_bin_log.is_open())
{
+ int errcode= query_error_code(thd, TRUE);
Query_log_event qinfo(thd, thd->query, thd->query_length,
- 0, TRUE, THD::NOT_KILLED);
+ 0, TRUE, errcode);
thd->clear_error();
mysql_bin_log.write(&qinfo);
}
=== modified file 'sql/sql_delete.cc'
--- a/sql/sql_delete.cc 2009-05-25 10:10:18 +0000
+++ b/sql/sql_delete.cc 2009-05-31 00:55:17 +0000
@@ -397,8 +397,12 @@ cleanup:
FALSE :
transactional_table;
+ int errcode= 0;
if (error < 0)
thd->clear_error();
+ else
+ errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
+
/*
[binlog]: If 'handler::delete_all_rows()' was called and the
storage engine does not inject the rows itself, we replicate
@@ -410,7 +414,7 @@ cleanup:
*/
int log_result= thd->binlog_query(query_type,
thd->query, thd->query_length,
- is_trans, FALSE, killed_status);
+ is_trans, FALSE, errcode);
if (log_result && transactional_table)
{
@@ -854,9 +858,10 @@ void multi_delete::abort()
*/
if (mysql_bin_log.is_open())
{
+ int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query, thd->query_length,
- transactional_tables, FALSE);
+ transactional_tables, FALSE, errcode);
}
thd->transaction.all.modified_non_trans_table= true;
}
@@ -997,11 +1002,14 @@ bool multi_delete::send_eof()
{
if (mysql_bin_log.is_open())
{
+ int errcode= 0;
if (local_error == 0)
thd->clear_error();
+ else
+ errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query, thd->query_length,
- transactional_tables, FALSE, killed_status) &&
+ transactional_tables, FALSE, errcode) &&
!normal_tables)
{
local_error=1; // Log write failed: roll back the SQL statement
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2009-05-15 13:45:06 +0000
+++ b/sql/sql_insert.cc 2009-05-31 00:55:17 +0000
@@ -887,6 +887,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
{
if (mysql_bin_log.is_open())
{
+ int errcode= 0;
if (error <= 0)
{
/*
@@ -901,6 +902,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
/* todo: consider removing */
thd->clear_error();
}
+ else
+ errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
+
/* bug#22725:
A query which per-row-loop can not be interrupted with
@@ -917,7 +921,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query, thd->query_length,
transactional_table, FALSE,
- (error>0) ? thd->killed : THD::NOT_KILLED) &&
+ errcode) &&
transactional_table)
{
error=1;
@@ -2741,6 +2745,12 @@ bool Delayed_insert::handle_inserts(void
thd.variables.time_zone = row->time_zone;
}
+ /* if the delayed insert was killed, the killed status is
+ ignored while binlogging */
+ int errcode= 0;
+ if (thd.killed == THD::NOT_KILLED)
+ errcode= query_error_code(&thd, TRUE);
+
/*
If the query has several rows to insert, only the first row will come
here. In row-based binlogging, this means that the first row will be
@@ -2751,7 +2761,7 @@ bool Delayed_insert::handle_inserts(void
*/
thd.binlog_query(THD::ROW_QUERY_TYPE,
row->query.str, row->query.length,
- FALSE, FALSE);
+ FALSE, FALSE, errcode);
thd.time_zone_used = backup_time_zone_used;
thd.variables.time_zone = backup_time_zone;
@@ -3269,11 +3279,14 @@ bool select_insert::send_eof()
*/
if (mysql_bin_log.is_open())
{
+ int errcode= 0;
if (!error)
thd->clear_error();
+ else
+ errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query, thd->query_length,
- trans_table, FALSE, killed_status);
+ trans_table, FALSE, errcode);
}
table->file->ha_release_auto_increment();
@@ -3342,8 +3355,11 @@ void select_insert::abort() {
if (thd->transaction.stmt.modified_non_trans_table)
{
if (mysql_bin_log.is_open())
+ {
+ int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length,
- transactional_table, FALSE);
+ transactional_table, FALSE, errcode);
+ }
if (!thd->current_stmt_binlog_row_based && !can_rollback_data())
thd->transaction.all.modified_non_trans_table= TRUE;
if (changed)
@@ -3762,10 +3778,14 @@ select_create::binlog_show_create_table(
DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */
if (mysql_bin_log.is_open())
+ {
+ int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
thd->binlog_query(THD::STMT_QUERY_TYPE,
query.ptr(), query.length(),
/* is_trans */ TRUE,
- /* suppress_use */ FALSE);
+ /* suppress_use */ FALSE,
+ errcode);
+ }
}
void select_create::store_values(List<Item> &values)
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc 2009-05-07 20:48:24 +0000
+++ b/sql/sql_load.cc 2009-05-31 00:55:17 +0000
@@ -119,7 +119,7 @@ static int read_xml_field(THD *thd, COPY
static bool write_execute_load_query_log_event(THD *thd,
bool duplicates, bool ignore,
bool transactional_table,
- THD::killed_state killed_status);
+ int errcode);
#endif /* EMBEDDED_LIBRARY */
/*
@@ -521,10 +521,12 @@ int mysql_load(THD *thd,sql_exchange *ex
/* If the file was not empty, wrote_create_file is true */
if (lf_info.wrote_create_file)
{
+ int errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
+
if (thd->transaction.stmt.modified_non_trans_table)
write_execute_load_query_log_event(thd, handle_duplicates,
ignore, transactional_table,
- killed_status);
+ errcode);
else
{
Delete_file_log_event d(thd, db, transactional_table);
@@ -566,8 +568,9 @@ int mysql_load(THD *thd,sql_exchange *ex
read_info.end_io_cache();
if (lf_info.wrote_create_file)
{
+ int errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
write_execute_load_query_log_event(thd, handle_duplicates, ignore,
- transactional_table,killed_status);
+ transactional_table, errcode);
}
}
}
@@ -591,7 +594,7 @@ err:
static bool write_execute_load_query_log_event(THD *thd,
bool duplicates, bool ignore,
bool transactional_table,
- THD::killed_state killed_err_arg)
+ int errcode)
{
Execute_load_query_log_event
e(thd, thd->query, thd->query_length,
@@ -599,7 +602,7 @@ static bool write_execute_load_query_log
(char*)thd->lex->fname_end - (char*)thd->query,
(duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :
(ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR),
- transactional_table, FALSE, killed_err_arg);
+ transactional_table, FALSE, errcode);
e.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
return mysql_bin_log.write(&e);
}
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2009-05-29 14:59:42 +0000
+++ b/sql/sql_table.cc 2009-05-31 00:55:17 +0000
@@ -1462,10 +1462,13 @@ void write_bin_log(THD *thd, bool clear_
{
if (mysql_bin_log.is_open())
{
+ int errcode= 0;
if (clear_error)
thd->clear_error();
+ else
+ errcode= query_error_code(thd, TRUE);
thd->binlog_query(THD::STMT_QUERY_TYPE,
- query, query_length, FALSE, FALSE, THD::NOT_KILLED);
+ query, query_length, FALSE, FALSE, errcode);
}
}
@@ -6748,7 +6751,7 @@ bool mysql_alter_table(THD *thd,char *ne
{
thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length,
- 0, FALSE, THD::NOT_KILLED);
+ 0, FALSE, 0);
mysql_bin_log.write(&qinfo);
}
DBUG_EXECUTE_IF("sleep_alter_rename_view", my_sleep(6000000););
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2009-05-15 13:45:06 +0000
+++ b/sql/sql_update.cc 2009-05-31 00:55:17 +0000
@@ -807,11 +807,15 @@ int mysql_update(THD *thd,
{
if (mysql_bin_log.is_open())
{
+ int errcode= 0;
if (error < 0)
thd->clear_error();
+ else
+ errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
+
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query, thd->query_length,
- transactional_table, FALSE, killed_status) &&
+ transactional_table, FALSE, errcode) &&
transactional_table)
{
error=1; // Rollback update
@@ -1854,9 +1858,10 @@ void multi_update::abort()
got caught and if happens later the killed error is written
into repl event.
*/
+ int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query, thd->query_length,
- transactional_tables, FALSE);
+ transactional_tables, FALSE, errcode);
}
thd->transaction.all.modified_non_trans_table= TRUE;
}
@@ -2081,11 +2086,14 @@ bool multi_update::send_eof()
{
if (mysql_bin_log.is_open())
{
+ int errcode= 0;
if (local_error == 0)
thd->clear_error();
+ else
+ errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query, thd->query_length,
- transactional_tables, FALSE, killed_status) &&
+ transactional_tables, FALSE, errcode) &&
trans_safe)
{
local_error= 1; // Rollback update
=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc 2009-05-15 13:45:06 +0000
+++ b/sql/sql_view.cc 2009-05-31 00:55:17 +0000
@@ -660,8 +660,9 @@ bool mysql_create_view(THD *thd, TABLE_L
buff.append(STRING_WITH_LEN(" AS "));
buff.append(views->source.str, views->source.length);
+ int errcode= query_error_code(thd, TRUE);
thd->binlog_query(THD::STMT_QUERY_TYPE,
- buff.ptr(), buff.length(), FALSE, FALSE, THD::NOT_KILLED);
+ buff.ptr(), buff.length(), FALSE, FALSE, errcode);
}
pthread_mutex_unlock(&LOCK_open);
Attachment: [text/bzr-bundle] bzr/zhenxing.he@sun.com-20090531005517-f16j2co9j4c3l7qb.bundle
| Thread |
|---|
| • bzr commit into mysql-6.0-bugteam branch (zhenxing.he:3330) | He Zhenxing | 31 May |