3505 Frazer Clement 2011-09-21 [merge]
Merge to 5.5-cluster - #2
added:
mysql-test/include/have_binlog_row_v2.inc
mysql-test/r/have_binlog_row_v2.require
modified:
mysql-test/extra/binlog_tests/binlog.test
mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
mysql-test/include/show_binlog_events2.inc
mysql-test/include/show_binlog_using_logname.inc
mysql-test/r/ctype_cp932_binlog_stm.result
mysql-test/r/flush2.result
mysql-test/r/mysqld--help-notwin.result
mysql-test/suite/binlog/r/binlog_row_binlog.result
mysql-test/suite/binlog/r/binlog_stm_binlog.result
mysql-test/suite/binlog/t/binlog_incident.test
mysql-test/suite/ndb_rpl/r/ndb_rpl_multi.result
mysql-test/suite/ndb_rpl/r/ndb_rpl_slave_restart.result
mysql-test/suite/ndb_rpl/t/ndb_rpl_gap_event.test
mysql-test/suite/ndb_rpl/t/ndb_rpl_multi.test
mysql-test/suite/ndb_rpl/t/ndb_rpl_skip_gap_event.test
mysql-test/suite/ndb_rpl/t/ndb_rpl_slave_restart.test
mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
mysql-test/suite/rpl/t/rpl_extra_row_data.test
mysql-test/suite/rpl/t/rpl_row_4_bytes-master.opt
mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
mysql-test/suite/sys_vars/r/all_vars.result
mysql-test/t/ctype_cp932_binlog_stm.test
sql/ha_ndbcluster_binlog.cc
sql/log_event.cc
sql/log_event.h
sql/log_event_old.h
sql/mysqld.cc
sql/mysqld.h
sql/rpl_constants.h
sql/rpl_injector.cc
sql/rpl_injector.h
sql/sql_class.cc
sql/sql_class.h
sql/sys_vars.cc
3504 jonas oreland 2011-09-20
ndb - disable rpl_empty_master_host dur to bug#13003111 - valgrind warning
modified:
mysql-test/suite/rpl/t/disabled.def
=== modified file 'mysql-test/extra/binlog_tests/binlog.test'
--- a/mysql-test/extra/binlog_tests/binlog.test 2011-05-10 09:48:14 +0000
+++ b/mysql-test/extra/binlog_tests/binlog.test 2011-09-20 23:01:27 +0000
@@ -345,7 +345,7 @@ SHOW SESSION VARIABLES LIKE "%_checks";
--echo # INSERT INTO t1 VALUES(2)
--echo # foreign_key_checks=1 and unique_checks=1
--echo # It should not change current session's variables, even error happens
-call mtr.add_suppression("Slave SQL.*Could not execute Write_rows event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062");
+call mtr.add_suppression("Slave SQL.*Could not execute Write_rows_v1 event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062");
--error 1062
BINLOG '
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
=== modified file 'mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test'
--- a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test 2011-02-23 11:54:58 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test 2011-09-20 23:01:27 +0000
@@ -417,10 +417,6 @@ COMMIT;
--connection slave
--let $slave_sql_errno= 1197
-if (`SELECT @@binlog_format = 'ROW'`)
-{
- --let $slave_sql_errno= 1534
-}
source include/wait_for_slave_sql_error.inc;
SELECT count(*) FROM t1;
=== added file 'mysql-test/include/have_binlog_row_v2.inc'
--- a/mysql-test/include/have_binlog_row_v2.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_binlog_row_v2.inc 2011-09-20 14:20:41 +0000
@@ -0,0 +1,8 @@
+# Purpose
+# Ensure server has v2 Binlog row events
+#
+
+--require r/have_binlog_row_v2.require
+disable_query_log;
+show variables like 'log_bin_use_v1_row_events';
+enable_query_log;
\ No newline at end of file
=== modified file 'mysql-test/include/show_binlog_events2.inc'
--- a/mysql-test/include/show_binlog_events2.inc 2010-10-27 11:32:32 +0000
+++ b/mysql-test/include/show_binlog_events2.inc 2011-09-20 23:01:27 +0000
@@ -1,4 +1,11 @@
---let $binlog_start=107
+#--let $binlog_start=107
+--let $binlog_on= query_get_value("SELECT Variable_Value='ON' as binlog from INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE Variable_name like 'log_bin'", binlog, 1)
+--let $binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
+if (!$binlog_on)
+{
+ # Where there's no Binlog, we can use any old value
+ --let $binlog_start= 0
+}
--replace_result $binlog_start <binlog_start>
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
=== modified file 'mysql-test/include/show_binlog_using_logname.inc'
--- a/mysql-test/include/show_binlog_using_logname.inc 2007-06-21 19:58:59 +0000
+++ b/mysql-test/include/show_binlog_using_logname.inc 2011-09-20 14:20:41 +0000
@@ -6,8 +6,16 @@
# name is = log_name
########################################################
+if (!$start_pos)
+{
+ # If $start_pos is not set, we will set it as the second event's
+ # position. The first event(Description Event) is always ignored. For
+ # description event's length might be changed because of adding new events,
+ # 'SHOW BINLOG EVENTS LIMIT 1' is used to get the right value.
+ --let $start_pos= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
+}
--replace_result $start_pos <start_pos> $end_pos <end_pos>
---replace_column 2 #
+--replace_column 2 # 5 <end_pos>
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
--eval show binlog events in '$log_name' from $start_pos limit $off_set,1
=== modified file 'mysql-test/r/ctype_cp932_binlog_stm.result'
--- a/mysql-test/r/ctype_cp932_binlog_stm.result 2011-05-12 08:43:50 +0000
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result 2011-09-20 23:01:27 +0000
@@ -49,7 +49,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP PROCEDURE bug18293
master-bin.000001 # Query # # use `test`; DROP TABLE `t4` /* generated by server */
End of 5.0 tests
-SHOW BINLOG EVENTS FROM 490;
+SHOW BINLOG EVENTS FROM 495;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;
=== modified file 'mysql-test/r/flush2.result'
--- a/mysql-test/r/flush2.result 2009-11-04 12:28:20 +0000
+++ b/mysql-test/r/flush2.result 2011-09-20 23:01:27 +0000
@@ -4,9 +4,11 @@ show variables like 'log_bin%';
Variable_name Value
log_bin OFF
log_bin_trust_function_creators ON
+log_bin_use_v1_row_events OFF
flush logs;
show variables like 'log_bin%';
Variable_name Value
log_bin OFF
log_bin_trust_function_creators ON
+log_bin_use_v1_row_events OFF
set global expire_logs_days = 0;
=== added file 'mysql-test/r/have_binlog_row_v2.require'
--- a/mysql-test/r/have_binlog_row_v2.require 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/have_binlog_row_v2.require 2011-09-20 14:20:41 +0000
@@ -0,0 +1,2 @@
+Variable_name Value
+log_bin_use_v1_row_events OFF
=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result 2011-05-10 09:48:14 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result 2011-09-20 23:01:27 +0000
@@ -235,6 +235,11 @@ The following options may be given as th
ALWAYS use row-based binary logging, the security issues
do not exist and the binary logging cannot break, so you
can safely set this to TRUE
+ --log-bin-use-v1-row-events
+ If equal to 1 then version 1 row events are written to a
+ row based binary log. If equal to 0, then the latest
+ version of events are written. This option is useful
+ during some upgrades.
--log-error[=name] Error log file
--log-isam[=name] Log all MyISAM changes to file.
--log-output=name Syntax: log-output=value[,value...], where "value" could
@@ -808,6 +813,7 @@ lock-wait-timeout 31536000
log-bin (No default value)
log-bin-index (No default value)
log-bin-trust-function-creators FALSE
+log-bin-use-v1-row-events FALSE
log-error
log-isam myisam.log
log-output FILE
=== modified file 'mysql-test/suite/binlog/r/binlog_row_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result 2011-05-10 09:48:14 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result 2011-09-20 23:01:27 +0000
@@ -1374,7 +1374,7 @@ unique_checks OFF
# INSERT INTO t1 VALUES(2)
# foreign_key_checks=1 and unique_checks=1
# It should not change current session's variables, even error happens
-call mtr.add_suppression("Slave SQL.*Could not execute Write_rows event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062");
+call mtr.add_suppression("Slave SQL.*Could not execute Write_rows_v1 event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062");
BINLOG '
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
=== modified file 'mysql-test/suite/binlog/r/binlog_stm_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result 2011-05-10 09:48:14 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result 2011-09-20 23:01:27 +0000
@@ -459,12 +459,12 @@ master-bin.000001 # Query # # use `test`
master-bin.000001 # Query # # use `test`; insert into t1 values( 115 )
master-bin.000001 # Query # # use `test`; insert into t1 values( 114 )
master-bin.000001 # Query # # use `test`; insert into t1 values( 113 )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 112 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
master-bin.000001 # Query # # use `test`; insert into t1 values( 111 )
master-bin.000001 # Query # # use `test`; insert into t1 values( 110 )
master-bin.000001 # Query # # use `test`; insert into t1 values( 109 )
master-bin.000001 # Query # # use `test`; insert into t1 values( 108 )
-master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 107 )
master-bin.000001 # Query # # use `test`; insert into t1 values( 106 )
master-bin.000001 # Query # # use `test`; insert into t1 values( 105 )
master-bin.000001 # Query # # use `test`; insert into t1 values( 104 )
@@ -864,7 +864,7 @@ unique_checks OFF
# INSERT INTO t1 VALUES(2)
# foreign_key_checks=1 and unique_checks=1
# It should not change current session's variables, even error happens
-call mtr.add_suppression("Slave SQL.*Could not execute Write_rows event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062");
+call mtr.add_suppression("Slave SQL.*Could not execute Write_rows_v1 event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062");
BINLOG '
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
=== modified file 'mysql-test/suite/binlog/t/binlog_incident.test'
--- a/mysql-test/suite/binlog/t/binlog_incident.test 2010-10-27 11:32:32 +0000
+++ b/mysql-test/suite/binlog/t/binlog_incident.test 2011-09-20 23:01:27 +0000
@@ -20,7 +20,7 @@ REPLACE INTO t1 VALUES (4);
DROP TABLE t1;
FLUSH LOGS;
-exec $MYSQL_BINLOG --start-position=107 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
+exec $MYSQL_BINLOG --start-position=112 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
--disable_query_log
eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl;
--enable_query_log
=== modified file 'mysql-test/suite/ndb_rpl/r/ndb_rpl_multi.result'
--- a/mysql-test/suite/ndb_rpl/r/ndb_rpl_multi.result 2011-05-18 12:56:24 +0000
+++ b/mysql-test/suite/ndb_rpl/r/ndb_rpl_multi.result 2011-09-20 23:01:27 +0000
@@ -32,8 +32,6 @@ master-bin.000001 # Write_rows 3 # table
master-bin.000001 # Write_rows 3 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 3 # COMMIT
set SQL_LOG_BIN=1;
-@the_pos:=Position @the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\','/'), '/', -1)
-107 master-bin.000001
include/rpl_change_topology.inc [new topology=3->2]
include/start_slave.inc
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
=== modified file 'mysql-test/suite/ndb_rpl/r/ndb_rpl_slave_restart.result'
--- a/mysql-test/suite/ndb_rpl/r/ndb_rpl_slave_restart.result 2011-05-13 07:40:50 +0000
+++ b/mysql-test/suite/ndb_rpl/r/ndb_rpl_slave_restart.result 2011-09-20 23:01:27 +0000
@@ -32,12 +32,6 @@ master-bin.000001 # Write_rows 3 # table
master-bin.000001 # Write_rows 3 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 3 # COMMIT
set SQL_LOG_BIN=1;
-@the_pos:=Position @the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\','/'), '/', -1)
-107 master-bin.000001
-CHANGE MASTER TO
-master_port=<MASTER_PORT1>,
-master_log_file = 'master-bin.000001',
-master_log_pos = 107 ;
start slave;
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
DELETE FROM t1 WHERE c3 = 1;
=== modified file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_gap_event.test'
--- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_gap_event.test 2011-05-16 06:50:14 +0000
+++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_gap_event.test 2011-09-20 14:20:41 +0000
@@ -39,7 +39,6 @@ let $mysqld_name=mysqld.1.1;
--source include/restart_mysqld.inc
#show binlog events in 'master-bin.000002';
let $log_name=master-bin.000002;
-let $start_pos=107;
let $end_pos=143;
let $off_set=0;
-- source include/show_binlog_using_logname.inc
=== modified file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_multi.test'
--- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_multi.test 2011-05-18 12:56:24 +0000
+++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_multi.test 2011-09-20 23:01:27 +0000
@@ -47,9 +47,11 @@ insert into t2 values (1);
set SQL_LOG_BIN=1;
--replace_result $the_epoch <the_epoch>
--disable_query_log
+--disable_result_log
eval SELECT @the_pos:=Position,
@the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\\\','/'), '/', -1)
FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ;
+--enable_result_log
--enable_query_log
let $the_pos= `SELECT @the_pos` ;
let $the_file= `SELECT @the_file` ;
=== modified file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_skip_gap_event.test'
--- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_skip_gap_event.test 2011-05-13 07:40:50 +0000
+++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_skip_gap_event.test 2011-09-20 14:20:41 +0000
@@ -31,7 +31,6 @@ let $mysqld_name=mysqld.1.1;
--source include/restart_mysqld.inc
#show binlog events in 'master-bin.000002';
let $log_name=master-bin.000002;
-let $start_pos=107;
let $end_pos=143;
let $off_set=0;
-- source include/show_binlog_using_logname.inc
=== modified file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_slave_restart.test'
--- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_slave_restart.test 2011-05-13 07:40:50 +0000
+++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_slave_restart.test 2011-09-20 14:20:41 +0000
@@ -47,10 +47,10 @@ insert into t2 values (1);
set SQL_LOG_BIN=1;
--replace_result $the_epoch <the_epoch>
--disable_query_log
+--disable_result_log
eval SELECT @the_pos:=Position,
@the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\\\','/'), '/', -1)
FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ;
---enable_query_log
let $the_pos= `SELECT @the_pos` ;
let $the_file= `SELECT @the_file` ;
@@ -61,6 +61,8 @@ eval CHANGE MASTER TO
master_port=$MASTER_MYPORT1,
master_log_file = '$the_file',
master_log_pos = $the_pos ;
+--enable_result_log
+--enable_query_log
start slave;
# insert some more values on the first master
=== modified file 'mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result'
--- a/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result 2011-02-23 11:54:58 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result 2011-09-20 23:01:27 +0000
@@ -141,7 +141,7 @@ SET GLOBAL binlog_stmt_cache_size= ORIGI
BEGIN;
Repeat statement 'INSERT INTO t1 VALUES($n, repeat("a", 32))' 128 times
COMMIT;
-include/wait_for_slave_sql_error.inc [errno=1534]
+include/wait_for_slave_sql_error.inc [errno=1197]
SELECT count(*) FROM t1;
count(*)
0
=== modified file 'mysql-test/suite/rpl/t/rpl_extra_row_data.test'
--- a/mysql-test/suite/rpl/t/rpl_extra_row_data.test 2011-09-07 22:50:01 +0000
+++ b/mysql-test/suite/rpl/t/rpl_extra_row_data.test 2011-09-20 14:20:41 +0000
@@ -1,6 +1,7 @@
--source include/master-slave.inc
--source include/have_debug.inc
--source include/have_binlog_format_row.inc
+--source include/have_binlog_row_v2.inc
#
# Test Binlog row extra data added as part of WL5353
=== modified file 'mysql-test/suite/rpl/t/rpl_row_4_bytes-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_row_4_bytes-master.opt 2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_4_bytes-master.opt 2011-09-20 14:20:41 +0000
@@ -1 +1,2 @@
--loose-debug=d,"old_row_based_repl_4_byte_map_id_master"
+--log-bin-use-v1-row-events=1
=== modified file 'mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test'
--- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test 2011-04-14 15:40:04 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test 2011-09-20 23:01:27 +0000
@@ -1,7 +1,7 @@
# depends on the binlog output
-- source include/have_binlog_format_row.inc
-let $rename_event_pos= 898;
+let $rename_event_pos= 907;
# Bug#18326: Do not lock table for writing during prepare of statement
# The use of the ps protocol causes extra table maps in the binlog, so
=== modified file 'mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test'
--- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test 2011-04-14 15:40:04 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test 2011-09-20 23:01:27 +0000
@@ -1,5 +1,5 @@
# depends on the binlog output
--source include/have_binlog_format_mixed_or_statement.inc
-let $rename_event_pos= 931;
+let $rename_event_pos= 936;
-- source extra/rpl_tests/rpl_flsh_tbls.test
=== modified file 'mysql-test/suite/sys_vars/r/all_vars.result'
--- a/mysql-test/suite/sys_vars/r/all_vars.result 2011-05-31 09:12:32 +0000
+++ b/mysql-test/suite/sys_vars/r/all_vars.result 2011-09-20 23:01:27 +0000
@@ -12,10 +12,12 @@ select variable_name as `There should be
left join t1 on variable_name=test_name where test_name is null;
There should be *no* variables listed below:
INNODB_ROLLBACK_SEGMENTS
+LOG_BIN_USE_V1_ROW_EVENTS
INNODB_STATS_METHOD
INNODB_FILE_FORMAT_MAX
INNODB_LARGE_PREFIX
INNODB_ROLLBACK_SEGMENTS
+LOG_BIN_USE_V1_ROW_EVENTS
INNODB_STATS_METHOD
INNODB_FILE_FORMAT_MAX
INNODB_LARGE_PREFIX
=== modified file 'mysql-test/t/ctype_cp932_binlog_stm.test'
--- a/mysql-test/t/ctype_cp932_binlog_stm.test 2011-06-30 12:19:14 +0000
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test 2011-09-20 23:01:27 +0000
@@ -36,7 +36,7 @@ delimiter ;|
#
# #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump
--error 1220
-SHOW BINLOG EVENTS FROM 490;
+SHOW BINLOG EVENTS FROM 495;
--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2011-09-19 13:37:03 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2011-09-20 23:01:27 +0000
@@ -46,6 +46,7 @@ extern my_bool opt_ndb_log_apply_status;
extern ulong opt_ndb_extra_logging;
extern st_ndb_slave_state g_ndb_slave_state;
extern my_bool opt_ndb_log_transaction_id;
+extern my_bool log_bin_use_v1_row_events;
bool ndb_log_empty_epochs(void);
@@ -3374,6 +3375,17 @@ int ndbcluster_binlog_start()
DBUG_RETURN(-1);
}
+ /*
+ Check that v2 events are enabled if log-transaction-id is set
+ */
+ if (opt_ndb_log_transaction_id &&
+ log_bin_use_v1_row_events)
+ {
+ sql_print_error("NDB: --ndb-log-transaction-id requires v2 Binlog row events "
+ "but server is using v1.");
+ DBUG_RETURN(-1);
+ }
+
pthread_mutex_init(&injector_mutex, MY_MUTEX_INIT_FAST);
pthread_cond_init(&injector_cond, NULL);
pthread_mutex_init(&ndb_schema_share_mutex, MY_MUTEX_INIT_FAST);
@@ -6010,11 +6022,12 @@ ndb_binlog_thread_handle_data_event(THD*
Get NdbApi transaction id for this event to put into Binlog
*/
Ndb_binlog_extra_row_info extra_row_info;
+ const uchar* extra_row_info_ptr = NULL;
if (opt_ndb_log_transaction_id)
{
extra_row_info.setFlags(Ndb_binlog_extra_row_info::NDB_ERIF_TRANSID);
extra_row_info.setTransactionId(pOp->getTransId());
- thd->binlog_row_event_extra_data = extra_row_info.generateBuffer();
+ extra_row_info_ptr = extra_row_info.generateBuffer();
}
DBUG_ASSERT(trans.good());
@@ -6072,7 +6085,8 @@ ndb_binlog_thread_handle_data_event(THD*
ndb_unpack_record(table, event_data->ndb_value[0], &b, table->record[0]);
ret = trans.write_row(logged_server_id,
injector::transaction::table(table, true),
- &b, n_fields, table->record[0]);
+ &b, n_fields, table->record[0],
+ extra_row_info_ptr);
assert(ret == 0);
}
break;
@@ -6116,7 +6130,8 @@ ndb_binlog_thread_handle_data_event(THD*
DBUG_EXECUTE("info", print_records(table, table->record[n]););
ret = trans.delete_row(logged_server_id,
injector::transaction::table(table, true),
- &b, n_fields, table->record[n]);
+ &b, n_fields, table->record[n],
+ extra_row_info_ptr);
assert(ret == 0);
}
break;
@@ -6151,7 +6166,8 @@ ndb_binlog_thread_handle_data_event(THD*
*/
ret = trans.write_row(logged_server_id,
injector::transaction::table(table, true),
- &b, n_fields, table->record[0]);// after values
+ &b, n_fields, table->record[0],// after values
+ extra_row_info_ptr);
assert(ret == 0);
}
else
@@ -6175,7 +6191,8 @@ ndb_binlog_thread_handle_data_event(THD*
injector::transaction::table(table, true),
&b, n_fields,
table->record[1], // before values
- table->record[0]);// after values
+ table->record[0], // after values
+ extra_row_info_ptr);
assert(ret == 0);
}
}
@@ -6186,11 +6203,6 @@ ndb_binlog_thread_handle_data_event(THD*
break;
}
- if (opt_ndb_log_transaction_id)
- {
- thd->binlog_row_event_extra_data = NULL;
- }
-
if (share->flags & NSF_BLOB_FLAG)
{
my_free(blobs_buffer[0], MYF(MY_ALLOW_ZERO_PTR));
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2011-09-09 09:30:43 +0000
+++ b/sql/log_event.cc 2011-09-20 23:01:27 +0000
@@ -56,7 +56,6 @@
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
-
/*
Size of buffer for printing a double in format %.<PREC>g
@@ -658,12 +657,23 @@ const char* Log_event::get_type_str(Log_
case PRE_GA_WRITE_ROWS_EVENT: return "Write_rows_event_old";
case PRE_GA_UPDATE_ROWS_EVENT: return "Update_rows_event_old";
case PRE_GA_DELETE_ROWS_EVENT: return "Delete_rows_event_old";
+#ifndef MCP_WL5353
+ case WRITE_ROWS_EVENT_V1: return "Write_rows_v1";
+ case UPDATE_ROWS_EVENT_V1: return "Update_rows_v1";
+ case DELETE_ROWS_EVENT_V1: return "Delete_rows_v1";
+#else
case WRITE_ROWS_EVENT: return "Write_rows";
case UPDATE_ROWS_EVENT: return "Update_rows";
case DELETE_ROWS_EVENT: return "Delete_rows";
+#endif
case BEGIN_LOAD_QUERY_EVENT: return "Begin_load_query";
case EXECUTE_LOAD_QUERY_EVENT: return "Execute_load_query";
case INCIDENT_EVENT: return "Incident";
+#ifndef MCP_WL5353
+ case WRITE_ROWS_EVENT: return "Write_rows";
+ case UPDATE_ROWS_EVENT: return "Update_rows";
+ case DELETE_ROWS_EVENT: return "Delete_rows";
+#endif
default: return "Unknown"; /* impossible */
}
}
@@ -1310,6 +1320,17 @@ Log_event* Log_event::read_log_event(con
case PRE_GA_DELETE_ROWS_EVENT:
ev = new Delete_rows_log_event_old(buf, event_len, description_event);
break;
+#ifndef MCP_WL5353
+ case WRITE_ROWS_EVENT_V1:
+ ev = new Write_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type);
+ break;
+ case UPDATE_ROWS_EVENT_V1:
+ ev = new Update_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type);
+ break;
+ case DELETE_ROWS_EVENT_V1:
+ ev = new Delete_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type);
+ break;
+#else
case WRITE_ROWS_EVENT:
ev = new Write_rows_log_event(buf, event_len, description_event);
break;
@@ -1319,6 +1340,7 @@ Log_event* Log_event::read_log_event(con
case DELETE_ROWS_EVENT:
ev = new Delete_rows_log_event(buf, event_len, description_event);
break;
+#endif
case TABLE_MAP_EVENT:
ev = new Table_map_log_event(buf, event_len, description_event);
break;
@@ -1332,6 +1354,19 @@ Log_event* Log_event::read_log_event(con
case INCIDENT_EVENT:
ev = new Incident_log_event(buf, event_len, description_event);
break;
+#ifndef MCP_WL5353
+#if defined(HAVE_REPLICATION)
+ case WRITE_ROWS_EVENT:
+ ev = new Write_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type);
+ break;
+ case UPDATE_ROWS_EVENT:
+ ev = new Update_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type);
+ break;
+ case DELETE_ROWS_EVENT:
+ ev = new Delete_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type);
+ break;
+#endif
+#endif
default:
DBUG_PRINT("error",("Unknown event code: %d",
(int) buf[EVENT_TYPE_OFFSET]));
@@ -1963,9 +1998,11 @@ void Rows_log_event::print_verbose(IO_CA
Table_map_log_event *map;
table_def *td;
const char *sql_command, *sql_clause1, *sql_clause2;
+#ifdef MCP_WL5353
Log_event_type type_code= get_type_code();
-
-#ifndef MCP_WL5353
+#else
+ Log_event_type type_code= get_general_type_code();
+
if (m_extra_row_data)
{
uint8 extra_data_len= m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET];
@@ -2089,28 +2126,59 @@ void Log_event::print_base64(IO_CACHE* f
if (print_event_info->verbose)
{
Rows_log_event *ev= NULL;
+ Log_event_type et= (Log_event_type) ptr[4];
- if (ptr[4] == TABLE_MAP_EVENT)
+ switch(et)
+ {
+ case TABLE_MAP_EVENT:
{
Table_map_log_event *map;
map= new Table_map_log_event((const char*) ptr, size,
glob_description_event);
print_event_info->m_table_map.set_table(map->get_table_id(), map);
+ break;
}
- else if (ptr[4] == WRITE_ROWS_EVENT)
+ case WRITE_ROWS_EVENT:
+#ifndef MCP_WL5353
+ case WRITE_ROWS_EVENT_V1:
+#endif
{
ev= new Write_rows_log_event((const char*) ptr, size,
- glob_description_event);
+ glob_description_event
+#ifndef MCP_WL5353
+ , et
+#endif
+ );
+ break;
}
- else if (ptr[4] == DELETE_ROWS_EVENT)
+ case DELETE_ROWS_EVENT:
+#ifndef MCP_WL5353
+ case DELETE_ROWS_EVENT_V1:
+#endif
{
ev= new Delete_rows_log_event((const char*) ptr, size,
- glob_description_event);
+ glob_description_event
+#ifndef MCP_WL5353
+ , et
+#endif
+ );
+ break;
}
- else if (ptr[4] == UPDATE_ROWS_EVENT)
+ case UPDATE_ROWS_EVENT:
+#ifndef MCP_WL5353
+ case UPDATE_ROWS_EVENT_V1:
+#endif
{
ev= new Update_rows_log_event((const char*) ptr, size,
- glob_description_event);
+ glob_description_event
+#ifndef MCP_WL5353
+ , et
+#endif
+ );
+ break;
+ }
+ default:
+ break;
}
if (ev)
@@ -3970,9 +4038,15 @@ Format_description_log_event(uint8 binlo
post_header_len[PRE_GA_DELETE_ROWS_EVENT-1] = 0;
post_header_len[TABLE_MAP_EVENT-1]= TABLE_MAP_HEADER_LEN;
+#ifndef MCP_WL5353
+ post_header_len[WRITE_ROWS_EVENT_V1-1]= ROWS_HEADER_LEN_V1;
+ post_header_len[UPDATE_ROWS_EVENT_V1-1]= ROWS_HEADER_LEN_V1;
+ post_header_len[DELETE_ROWS_EVENT_V1-1]= ROWS_HEADER_LEN_V1;
+#else
post_header_len[WRITE_ROWS_EVENT-1]= ROWS_HEADER_LEN;
post_header_len[UPDATE_ROWS_EVENT-1]= ROWS_HEADER_LEN;
post_header_len[DELETE_ROWS_EVENT-1]= ROWS_HEADER_LEN;
+#endif
/*
We here have the possibility to simulate a master of before we changed
the table map id to be stored in 6 bytes: when it was stored in 4
@@ -3985,11 +4059,19 @@ Format_description_log_event(uint8 binlo
*/
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
post_header_len[TABLE_MAP_EVENT-1]=
- post_header_len[WRITE_ROWS_EVENT-1]=
- post_header_len[UPDATE_ROWS_EVENT-1]=
- post_header_len[DELETE_ROWS_EVENT-1]= 6;);
+ post_header_len[WRITE_ROWS_EVENT_V1-1]=
+ post_header_len[UPDATE_ROWS_EVENT_V1-1]=
+ post_header_len[DELETE_ROWS_EVENT_V1-1]= 6;);
post_header_len[INCIDENT_EVENT-1]= INCIDENT_HEADER_LEN;
post_header_len[HEARTBEAT_LOG_EVENT-1]= 0;
+#ifndef MCP_WL5353
+ post_header_len[IGNORABLE_LOG_EVENT-1]= 0;
+ post_header_len[ROWS_QUERY_LOG_EVENT-1]= 0;
+
+ post_header_len[WRITE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2;
+ post_header_len[UPDATE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2;
+ post_header_len[DELETE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2;
+#endif
// Sanity-check that all post header lengths are initialized.
int i;
@@ -7376,12 +7458,10 @@ static uchar dbug_extra_row_data_val= 0;
thread data structures which can be checked
when reading the binlog.
- @param thd Current thd
@param arr Buffer to use
*/
-void set_extra_data(THD* thd, uchar* arr)
+const uchar* set_extra_data(uchar* arr)
{
- assert(thd->binlog_row_event_extra_data == NULL);
uchar val= (dbug_extra_row_data_val++) %
(EXTRA_ROW_INFO_MAX_PAYLOAD + 1); /* 0 .. MAX_PAYLOAD + 1 */
arr[EXTRA_ROW_INFO_LEN_OFFSET]= val + EXTRA_ROW_INFO_HDR_BYTES;
@@ -7389,7 +7469,7 @@ void set_extra_data(THD* thd, uchar* arr
for (uchar i=0; i<val; i++)
arr[EXTRA_ROW_INFO_HDR_BYTES+i]= val;
- thd->binlog_row_event_extra_data= arr;
+ return arr;
}
#endif // #ifndef MYSQL_CLIENT
@@ -7427,15 +7507,20 @@ void check_extra_data(uchar* extra_row_d
#ifndef MYSQL_CLIENT
Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
- MY_BITMAP const *cols, bool is_transactional)
+ MY_BITMAP const *cols, bool is_transactional
+#ifndef MCP_WL5353
+ ,Log_event_type event_type,
+ const uchar* extra_row_info
+#endif
+ )
: Log_event(thd_arg, 0, is_transactional),
m_row_count(0),
m_table(tbl_arg),
m_table_id(tid),
m_width(tbl_arg ? tbl_arg->s->fields : 1),
- m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0)
+ m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0),
#ifndef MCP_WL5353
- ,m_extra_row_data(0)
+ m_type(event_type), m_extra_row_data(0)
#endif
#ifdef HAVE_REPLICATION
, m_curr_row(NULL), m_curr_row_end(NULL), m_key(NULL)
@@ -7459,27 +7544,23 @@ Rows_log_event::Rows_log_event(THD *thd_
uchar extra_data[255];
DBUG_EXECUTE_IF("extra_row_data_set",
/* Set extra row data to a known value */
- set_extra_data(thd_arg, extra_data););
+ extra_row_info = set_extra_data(extra_data););
#endif
- if (thd_arg->binlog_row_event_extra_data)
+ if (extra_row_info)
{
/* Copy Extra data from thd into new event */
- uint16 extra_data_len= thd_arg->get_binlog_row_event_extra_data_len();
+ uint8 extra_data_len= extra_row_info[EXTRA_ROW_INFO_LEN_OFFSET];
assert(extra_data_len >= EXTRA_ROW_INFO_HDR_BYTES);
m_extra_row_data= (uchar*) my_malloc(extra_data_len, MYF(MY_WME));
if (likely(m_extra_row_data != NULL))
{
- memcpy(m_extra_row_data, thd_arg->binlog_row_event_extra_data,
+ memcpy(m_extra_row_data, extra_row_info,
extra_data_len);
- set_flags(EXTRA_ROW_EV_DATA_F);
}
}
-
- DBUG_EXECUTE_IF("extra_row_data_set",
- thd_arg->binlog_row_event_extra_data = NULL;);
-#endif // #ifndef MCP_WL5353
+#endif
/* if bitmap_init fails, caught in is_valid() */
if (likely(!bitmap_init(&m_cols,
@@ -7511,9 +7592,9 @@ Rows_log_event::Rows_log_event(const cha
#ifndef MYSQL_CLIENT
m_table(NULL),
#endif
- m_table_id(0), m_rows_buf(0), m_rows_cur(0), m_rows_end(0)
+ m_table_id(0), m_rows_buf(0), m_rows_cur(0), m_rows_end(0),
#ifndef MCP_WL5353
- ,m_extra_row_data(0)
+ m_type(event_type), m_extra_row_data(0)
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
, m_curr_row(NULL), m_curr_row_end(NULL), m_key(NULL)
@@ -7543,34 +7624,61 @@ Rows_log_event::Rows_log_event(const cha
}
m_flags= uint2korr(post_start);
-
#ifndef MCP_WL5353
- uint16 extra_data_len= 0;
- if ((m_flags & EXTRA_ROW_EV_DATA_F))
+ post_start+= 2;
+
+ uint16 var_header_len= 0;
+ if (post_header_len == ROWS_HEADER_LEN_V2)
{
- const uchar* extra_data_start= (const uchar*) post_start + 2;
- extra_data_len= extra_data_start[EXTRA_ROW_INFO_LEN_OFFSET];
- assert(m_extra_row_data == 0);
- assert(extra_data_len >= EXTRA_ROW_INFO_HDR_BYTES);
- DBUG_PRINT("debug", ("extra_data_len = %u",
- extra_data_len));
+ /*
+ Have variable length header, check length,
+ which includes length bytes
+ */
+ var_header_len= uint2korr(post_start);
+ assert(var_header_len >= 2);
+ var_header_len-= 2;
- m_extra_row_data= (uchar*) my_malloc(extra_data_len,
- MYF(MY_WME));
- if (likely(m_extra_row_data != NULL))
+ /* Iterate over var-len header, extracting 'chunks' */
+ const char* start= post_start + 2;
+ const char* end= start + var_header_len;
+ for (const char* pos= start; pos < end;)
{
- memcpy(m_extra_row_data, extra_data_start, extra_data_len);
+ switch(*pos++)
+ {
+ case RW_V_EXTRAINFO_TAG:
+ {
+ /* Have an 'extra info' section, read it in */
+ assert((end - pos) >= EXTRA_ROW_INFO_HDR_BYTES);
+ uint8 infoLen= pos[EXTRA_ROW_INFO_LEN_OFFSET];
+ assert((end - pos) >= infoLen);
+ /* Just store/use the first tag of this type, skip others */
+ if (likely(!m_extra_row_data))
+ {
+ m_extra_row_data= (uchar*) my_malloc(infoLen,
+ MYF(MY_WME));
+ if (likely(m_extra_row_data != NULL))
+ {
+ memcpy(m_extra_row_data, pos, infoLen);
+ }
+ DBUG_EXECUTE_IF("extra_row_data_check",
+ /* Check extra data has expected value */
+ check_extra_data(m_extra_row_data););
+ }
+ pos+= infoLen;
+ break;
+ }
+ default:
+ /* Unknown code, we will not understand anything further here */
+ pos= end; /* Break loop */
+ }
}
}
- DBUG_EXECUTE_IF("extra_row_data_check",
- /* Check extra data has expected value */
- check_extra_data(m_extra_row_data););
-#endif // #ifndef MCP_WL5353
+#endif
uchar const *const var_start=
(const uchar *)buf + common_header_len + post_header_len
#ifndef MCP_WL5353
- + extra_data_len
+ + var_header_len
#endif
;
uchar const *const ptr_width= var_start;
@@ -7599,7 +7707,12 @@ Rows_log_event::Rows_log_event(const cha
m_cols_ai.bitmap= m_cols.bitmap; /* See explanation in is_valid() */
- if (event_type == UPDATE_ROWS_EVENT)
+ if ((event_type == UPDATE_ROWS_EVENT)
+#ifndef MCP_WL5353
+ ||
+ (event_type == UPDATE_ROWS_EVENT_V1)
+#endif
+ )
{
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
@@ -7659,7 +7772,11 @@ Rows_log_event::~Rows_log_event()
int Rows_log_event::get_data_size()
{
+#ifndef MCP_WL5353
+ int const type_code= get_general_type_code();
+#else
int const type_code= get_type_code();
+#endif
uchar buf[sizeof(m_width) + 1];
uchar *end= net_store_length(buf, m_width);
@@ -7668,14 +7785,26 @@ int Rows_log_event::get_data_size()
return 6 + no_bytes_in_map(&m_cols) + (end - buf) +
(type_code == UPDATE_ROWS_EVENT ? no_bytes_in_map(&m_cols_ai) : 0) +
(m_rows_cur - m_rows_buf););
+#ifndef MCP_WL5353
+ bool is_v2_event= get_type_code() > DELETE_ROWS_EVENT_V1;
+ int data_size= 0;
+
+ if (is_v2_event)
+ {
+ data_size= ROWS_HEADER_LEN_V2 +
+ (m_extra_row_data ?
+ RW_V_TAG_LEN + m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET]:
+ 0);
+ }
+ else
+ {
+ data_size= ROWS_HEADER_LEN_V1;
+ }
+#else
int data_size= ROWS_HEADER_LEN;
+#endif
data_size+= no_bytes_in_map(&m_cols);
data_size+= (uint) (end - buf);
-#ifndef MCP_WL5353
- data_size+= m_extra_row_data ?
- m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET] :
- 0;
-#endif
if (type_code == UPDATE_ROWS_EVENT)
data_size+= no_bytes_in_map(&m_cols_ai);
@@ -7829,10 +7958,10 @@ int Rows_log_event::do_apply_event(Relay
#endif
#ifndef MCP_WL5353
- if (get_flags(EXTRA_ROW_EV_DATA_F))
- thd->binlog_row_event_extra_data = m_extra_row_data;
+ if (m_extra_row_data)
+ thd->binlog_row_event_extra_data = m_extra_row_data;
else
- thd->binlog_row_event_extra_data = NULL;
+ thd->binlog_row_event_extra_data = NULL;
#endif
/* A small test to verify that objects have consistent types */
@@ -7944,7 +8073,7 @@ int Rows_log_event::do_apply_event(Relay
*/
thd->set_time((time_t)when);
#ifndef MCP_WL5353
- if (get_flags(EXTRA_ROW_EV_DATA_F))
+ if (m_extra_row_data)
thd->binlog_row_event_extra_data = m_extra_row_data;
else
thd->binlog_row_event_extra_data = NULL;
@@ -8248,32 +8377,64 @@ Rows_log_event::do_update_pos(Relay_log_
#ifndef MYSQL_CLIENT
bool Rows_log_event::write_data_header(IO_CACHE *file)
{
- uchar buf[ROWS_HEADER_LEN]; // No need to init the buffer
+#ifndef MCP_WL5353
+ uchar buf[ROWS_HEADER_LEN_V2]; // No need to init the buffer
+#else
+ uchar buf[ROWS_HEADER_LEN];
+#endif
DBUG_ASSERT(m_table_id != ~0UL);
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
{
+ assert(log_bin_use_v1_row_events);
int4store(buf + 0, m_table_id);
int2store(buf + 4, m_flags);
return (my_b_safe_write(file, buf, 6));
});
int6store(buf + RW_MAPID_OFFSET, (ulonglong)m_table_id);
int2store(buf + RW_FLAGS_OFFSET, m_flags);
+ int rc = 0;
#ifndef MCP_WL5353
- int rc = my_b_safe_write(file, buf, ROWS_HEADER_LEN);
-
- if ((rc == 0) &&
- (m_flags & EXTRA_ROW_EV_DATA_F))
+ if (likely(!log_bin_use_v1_row_events))
{
- /* Write extra row data */
- rc = my_b_safe_write(file, m_extra_row_data,
- m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET]);
- }
+ /*
+ v2 event, with variable header portion.
+ Determine length of variable header payload
+ */
+ uint16 vhlen= 2;
+ uint16 vhpayloadlen= 0;
+ uint16 extra_data_len= 0;
+ if (m_extra_row_data)
+ {
+ extra_data_len= m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET];
+ vhpayloadlen= RW_V_TAG_LEN + extra_data_len;
+ }
- /* Function returns bool, where false(0) is success :( */
- return (rc != 0);
+ /* Var-size header len includes len itself */
+ int2store(buf + RW_VHLEN_OFFSET, vhlen + vhpayloadlen);
+ rc= my_b_safe_write(file, buf, ROWS_HEADER_LEN_V2);
+
+ /* Write var-sized payload, if any */
+ if ((vhpayloadlen > 0) &&
+ (rc == 0))
+ {
+ /* Add tag and extra row info */
+ uchar type_code= RW_V_EXTRAINFO_TAG;
+ rc= my_b_safe_write(file, &type_code, RW_V_TAG_LEN);
+ if (rc==0)
+ rc= my_b_safe_write(file, m_extra_row_data, extra_data_len);
+ }
+ }
+ else
+#endif
+ rc= my_b_safe_write(file, buf,
+#ifndef MCP_WL5353
+ ROWS_HEADER_LEN_V1
#else
- return (my_b_safe_write(file, buf, ROWS_HEADER_LEN));
+ ROWS_HEADER_LEN
#endif
+ );
+
+ return (rc != 0);
}
bool Rows_log_event::write_data_body(IO_CACHE*file)
@@ -8297,7 +8458,13 @@ bool Rows_log_event::write_data_body(IO_
/*
TODO[refactor write]: Remove the "down cast" here (and elsewhere).
*/
- if (get_type_code() == UPDATE_ROWS_EVENT)
+ if (
+#ifndef MCP_WL5353
+ get_general_type_code()
+#else
+ get_type_code()
+#endif
+ == UPDATE_ROWS_EVENT)
{
DBUG_DUMP("m_cols_ai", (uchar*) m_cols_ai.bitmap,
no_bytes_in_map(&m_cols_ai));
@@ -8831,8 +8998,19 @@ void Table_map_log_event::print(FILE *,
Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
ulong tid_arg,
MY_BITMAP const *cols,
- bool is_transactional)
- : Rows_log_event(thd_arg, tbl_arg, tid_arg, cols, is_transactional)
+ bool is_transactional
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ )
+ : Rows_log_event(thd_arg, tbl_arg, tid_arg, cols, is_transactional
+#ifndef MCP_WL5353
+ ,log_bin_use_v1_row_events?
+ WRITE_ROWS_EVENT_V1:
+ WRITE_ROWS_EVENT,
+ extra_row_info
+#endif
+ )
{
}
#endif
@@ -8843,8 +9021,18 @@ Write_rows_log_event::Write_rows_log_eve
#ifdef HAVE_REPLICATION
Write_rows_log_event::Write_rows_log_event(const char *buf, uint event_len,
const Format_description_log_event
- *description_event)
-: Rows_log_event(buf, event_len, WRITE_ROWS_EVENT, description_event)
+ *description_event
+#ifndef MCP_WL5353
+ ,Log_event_type event_type
+#endif
+ )
+: Rows_log_event(buf, event_len,
+#ifndef MCP_WL5353
+ event_type,
+#else
+ WRITE_ROW_EVENT
+#endif
+ description_event)
{
}
#endif
@@ -9724,8 +9912,19 @@ err:
#ifndef MYSQL_CLIENT
Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
ulong tid, MY_BITMAP const *cols,
- bool is_transactional)
- : Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional)
+ bool is_transactional
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ )
+ : Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional
+#ifndef MCP_WL5353
+ ,log_bin_use_v1_row_events?
+ DELETE_ROWS_EVENT_V1:
+ DELETE_ROWS_EVENT,
+ extra_row_info
+#endif
+ )
{
}
#endif /* #if !defined(MYSQL_CLIENT) */
@@ -9736,8 +9935,18 @@ Delete_rows_log_event::Delete_rows_log_e
#ifdef HAVE_REPLICATION
Delete_rows_log_event::Delete_rows_log_event(const char *buf, uint event_len,
const Format_description_log_event
- *description_event)
- : Rows_log_event(buf, event_len, DELETE_ROWS_EVENT, description_event)
+ *description_event
+#ifndef MCP_WL5353
+ ,Log_event_type event_type
+#endif
+ )
+ : Rows_log_event(buf, event_len,
+#ifndef MCP_WL5353
+ event_type,
+#else
+ DELETE_ROWS_EVENT
+#endif
+ description_event)
{
}
#endif
@@ -9816,8 +10025,19 @@ Update_rows_log_event::Update_rows_log_e
ulong tid,
MY_BITMAP const *cols_bi,
MY_BITMAP const *cols_ai,
- bool is_transactional)
-: Rows_log_event(thd_arg, tbl_arg, tid, cols_bi, is_transactional)
+ bool is_transactional
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ )
+: Rows_log_event(thd_arg, tbl_arg, tid, cols_bi, is_transactional
+#ifndef MCP_WL5353
+ ,log_bin_use_v1_row_events?
+ UPDATE_ROWS_EVENT_V1:
+ UPDATE_ROWS_EVENT,
+ extra_row_info
+#endif
+ )
{
init(cols_ai);
}
@@ -9825,8 +10045,19 @@ Update_rows_log_event::Update_rows_log_e
Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
ulong tid,
MY_BITMAP const *cols,
- bool is_transactional)
-: Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional)
+ bool is_transactional
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ )
+: Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional
+#ifndef MCP_WL5353
+ ,log_bin_use_v1_row_events?
+ UPDATE_ROWS_EVENT_V1:
+ UPDATE_ROWS_EVENT,
+ extra_row_info
+#endif
+ )
{
init(cols);
}
@@ -9865,8 +10096,18 @@ Update_rows_log_event::~Update_rows_log_
Update_rows_log_event::Update_rows_log_event(const char *buf, uint event_len,
const
Format_description_log_event
- *description_event)
- : Rows_log_event(buf, event_len, UPDATE_ROWS_EVENT, description_event)
+ *description_event
+#ifndef MCP_WL5353
+ ,Log_event_type event_type
+#endif
+ )
+ : Rows_log_event(buf, event_len,
+#ifndef MCP_WL5353
+ event_type,
+#else
+ UPDATE_ROWS_EVENT,
+#endif
+ description_event)
{
}
#endif
=== modified file 'sql/log_event.h'
--- a/sql/log_event.h 2011-09-09 09:30:43 +0000
+++ b/sql/log_event.h 2011-09-20 23:01:27 +0000
@@ -250,12 +250,19 @@ struct sql_ex_info
#define FORMAT_DESCRIPTION_HEADER_LEN (START_V3_HEADER_LEN+1+LOG_EVENT_TYPES)
#define XID_HEADER_LEN 0
#define BEGIN_LOAD_QUERY_HEADER_LEN APPEND_BLOCK_HEADER_LEN
+#ifndef MCP_WL5353
+#define ROWS_HEADER_LEN_V1 8
+#else
#define ROWS_HEADER_LEN 8
+#endif
#define TABLE_MAP_HEADER_LEN 8
#define EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN (4 + 4 + 4 + 1)
#define EXECUTE_LOAD_QUERY_HEADER_LEN (QUERY_HEADER_LEN + EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN)
#define INCIDENT_HEADER_LEN 2
#define HEARTBEAT_HEADER_LEN 0
+#ifndef MCP_WL5353
+#define ROWS_HEADER_LEN_V2 10
+#endif
/*
Max number of possible extra bytes in a replication event compared to a
packet (i.e. a query) sent from client to master;
@@ -396,6 +403,11 @@ struct sql_ex_info
/* RW = "RoWs" */
#define RW_MAPID_OFFSET 0
#define RW_FLAGS_OFFSET 6
+#ifndef MCP_WL5353
+#define RW_VHLEN_OFFSET 8
+#define RW_V_TAG_LEN 1
+#define RW_V_EXTRAINFO_TAG 0
+#endif
/* ELQ = "Execute Load Query" */
#define ELQ_FILE_ID_OFFSET QUERY_HEADER_LEN
@@ -594,9 +606,15 @@ enum Log_event_type
/*
These event numbers are used from 5.1.16 and forward
*/
+#ifndef MCP_WL5353
+ WRITE_ROWS_EVENT_V1 = 23,
+ UPDATE_ROWS_EVENT_V1 = 24,
+ DELETE_ROWS_EVENT_V1 = 25,
+#else
WRITE_ROWS_EVENT = 23,
UPDATE_ROWS_EVENT = 24,
DELETE_ROWS_EVENT = 25,
+#endif
/*
Something out of the ordinary happened on the master
@@ -609,6 +627,21 @@ enum Log_event_type
*/
HEARTBEAT_LOG_EVENT= 27,
+#ifndef MCP_WL5353
+ /*
+ These event numbers are used in later releases (but not here)
+ */
+ IGNORABLE_LOG_EVENT= 28,
+ ROWS_QUERY_LOG_EVENT= 29,
+
+ /*
+ These event numbers are used in MySQL Cluster 5.1-telco-*
+ */
+ WRITE_ROWS_EVENT = 30,
+ UPDATE_ROWS_EVENT = 31,
+ DELETE_ROWS_EVENT = 32,
+#endif
+
/*
Add new events here - right above this comment!
Existing events (except ENUM_END_EVENT) should never change their numbers
@@ -3569,13 +3602,6 @@ public:
values for all columns of the table.
*/
COMPLETE_ROWS_F = (1U << 3)
-
-#ifndef MCP_WL5353
- /**
- Indicates that additional information was appended to the event.
- */
- ,EXTRA_ROW_EV_DATA_F = (1U << 4)
-#endif
};
typedef uint16 flag_set;
@@ -3592,7 +3618,12 @@ public:
void clear_flags(flag_set flags_arg) { m_flags &= ~flags_arg; }
flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }
-#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
+#ifndef MCP_WL5353
+ Log_event_type get_type_code() { return m_type; } /* Specific type (_V1 etc) */
+ virtual Log_event_type get_general_type_code() = 0; /* General type */
+#endif
+
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual void pack_info(Protocol *protocol);
#endif
@@ -3650,7 +3681,12 @@ protected:
*/
#ifdef MYSQL_SERVER
Rows_log_event(THD*, TABLE*, ulong table_id,
- MY_BITMAP const *cols, bool is_transactional);
+ MY_BITMAP const *cols, bool is_transactional,
+ Log_event_type event_type
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ );
#endif
Rows_log_event(const char *row_data, uint event_len,
Log_event_type event_type,
@@ -3692,6 +3728,8 @@ protected:
flag_set m_flags; /* Flags for row-level events */
#ifndef MCP_WL5353
+ Log_event_type m_type; /* Actual event type */
+
uchar *m_extra_row_data; /* Pointer to extra row data if any */
/* If non null, first byte is length */
#endif
@@ -3799,15 +3837,26 @@ public:
{
/* Support interface to THD::binlog_prepare_pending_rows_event */
TYPE_CODE = WRITE_ROWS_EVENT
+#ifndef MCP_WL5353
+ ,TYPE_CODE_V1 = WRITE_ROWS_EVENT_V1
+#endif
};
#if defined(MYSQL_SERVER)
Write_rows_log_event(THD*, TABLE*, ulong table_id,
- MY_BITMAP const *cols, bool is_transactional);
+ MY_BITMAP const *cols, bool is_transactional
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ );
#endif
#ifdef HAVE_REPLICATION
Write_rows_log_event(const char *buf, uint event_len,
- const Format_description_log_event *description_event);
+ const Format_description_log_event *description_event
+#ifndef MCP_WL5353
+ ,Log_event_type event_type
+#endif
+ );
#endif
#if defined(MYSQL_SERVER)
static bool binlog_row_logging_function(THD *thd, TABLE *table,
@@ -3819,12 +3868,20 @@ public:
const uchar *after_record)
{
return thd->binlog_write_row(table, is_transactional,
- cols, fields, after_record);
+ cols, fields, after_record
+#ifndef MCP_WL5353
+ , NULL
+#endif
+ );
}
#endif
private:
+#ifndef MCP_WL5353
+ virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; }
+#else
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
+#endif
#ifdef MYSQL_CLIENT
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
@@ -3857,17 +3914,28 @@ public:
{
/* Support interface to THD::binlog_prepare_pending_rows_event */
TYPE_CODE = UPDATE_ROWS_EVENT
+#ifndef MCP_WL5353
+ ,TYPE_CODE_V1 = UPDATE_ROWS_EVENT_V1
+#endif
};
#ifdef MYSQL_SERVER
Update_rows_log_event(THD*, TABLE*, ulong table_id,
MY_BITMAP const *cols_bi,
MY_BITMAP const *cols_ai,
- bool is_transactional);
+ bool is_transactional
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ );
Update_rows_log_event(THD*, TABLE*, ulong table_id,
MY_BITMAP const *cols,
- bool is_transactional);
+ bool is_transactional
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ );
void init(MY_BITMAP const *cols);
#endif
@@ -3876,7 +3944,11 @@ public:
#ifdef HAVE_REPLICATION
Update_rows_log_event(const char *buf, uint event_len,
- const Format_description_log_event *description_event);
+ const Format_description_log_event *description_event
+#ifndef MCP_WL5353
+ ,Log_event_type event_type
+#endif
+ );
#endif
#ifdef MYSQL_SERVER
@@ -3888,7 +3960,11 @@ public:
const uchar *after_record)
{
return thd->binlog_update_row(table, is_transactional,
- cols, fields, before_record, after_record);
+ cols, fields, before_record, after_record
+#ifndef MCP_WL5353
+ , NULL
+#endif
+ );
}
#endif
@@ -3898,7 +3974,11 @@ public:
}
protected:
+#ifndef MCP_WL5353
+ virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; }
+#else
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
+#endif
#ifdef MYSQL_CLIENT
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
@@ -3938,15 +4018,26 @@ public:
{
/* Support interface to THD::binlog_prepare_pending_rows_event */
TYPE_CODE = DELETE_ROWS_EVENT
+#ifndef MCP_WL5353
+ ,TYPE_CODE_V1 = DELETE_ROWS_EVENT_V1
+#endif
};
#ifdef MYSQL_SERVER
Delete_rows_log_event(THD*, TABLE*, ulong,
- MY_BITMAP const *cols, bool is_transactional);
+ MY_BITMAP const *cols, bool is_transactional
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ );
#endif
#ifdef HAVE_REPLICATION
Delete_rows_log_event(const char *buf, uint event_len,
- const Format_description_log_event *description_event);
+ const Format_description_log_event *description_event
+#ifndef MCP_WL5353
+ ,Log_event_type event_type
+#endif
+ );
#endif
#ifdef MYSQL_SERVER
static bool binlog_row_logging_function(THD *thd, TABLE *table,
@@ -3958,12 +4049,20 @@ public:
__attribute__((unused)))
{
return thd->binlog_delete_row(table, is_transactional,
- cols, fields, before_record);
+ cols, fields, before_record
+#ifndef MCP_WL5353
+ , NULL
+#endif
+ );
}
#endif
protected:
+#ifndef MCP_WL5353
+ virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; }
+#else
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
+#endif
#ifdef MYSQL_CLIENT
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
=== modified file 'sql/log_event_old.h'
--- a/sql/log_event_old.h 2010-10-27 11:32:32 +0000
+++ b/sql/log_event_old.h 2011-09-20 23:01:27 +0000
@@ -41,6 +41,9 @@
but we keep them this way for now. /Sven
*/
+#ifndef MCP_WL5353
+#define ROWS_HEADER_LEN ROWS_HEADER_LEN_V1
+#endif
/**
@class Old_rows_log_event
@@ -374,7 +377,11 @@ public:
const uchar *after_record)
{
return thd->binlog_write_row(table, is_transactional,
- cols, fields, after_record);
+ cols, fields, after_record
+#ifndef MCP_WL5353
+ , NULL
+#endif
+ );
}
#endif
@@ -450,7 +457,11 @@ public:
const uchar *after_record)
{
return thd->binlog_update_row(table, is_transactional,
- cols, fields, before_record, after_record);
+ cols, fields, before_record, after_record
+#ifndef MCP_WL5353
+ , NULL
+#endif
+ );
}
#endif
@@ -525,7 +536,11 @@ public:
__attribute__((unused)))
{
return thd->binlog_delete_row(table, is_transactional,
- cols, fields, before_record);
+ cols, fields, before_record
+#ifndef MCP_WL5353
+ , NULL
+#endif
+ );
}
#endif
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2011-09-02 09:16:56 +0000
+++ b/sql/mysqld.cc 2011-09-20 23:01:27 +0000
@@ -493,6 +493,10 @@ ulong max_connections, max_connect_error
mysql_send_long_data() call.
*/
ulong max_long_data_size;
+#ifndef MCP_WL5353
+my_bool log_bin_use_v1_row_events= 0;
+#endif
+
/**
Limit of the total number of prepared statements in the server.
Is necessary to protect the server against out-of-memory attacks.
@@ -5916,6 +5920,15 @@ struct my_option my_long_options[]=
"File that holds the names for last binary log files.",
&opt_binlog_index_name, &opt_binlog_index_name, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#ifndef MCP_WL5353
+ {"log-bin-use-v1-row-events", 0,
+ "If equal to 1 then version 1 row events are written to a row based "
+ "binary log. If equal to 0, then the latest version of events are "
+ "written. "
+ "This option is useful during some upgrades.",
+ &log_bin_use_v1_row_events, &log_bin_use_v1_row_events, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+#endif
{"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.",
&myisam_log_filename, &myisam_log_filename, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h 2011-08-31 10:39:08 +0000
+++ b/sql/mysqld.h 2011-09-20 23:01:27 +0000
@@ -172,6 +172,9 @@ extern LEX_CSTRING reason_slave_blocked;
extern ulong slave_trans_retries;
extern uint slave_net_timeout;
extern uint max_user_connections;
+#ifndef MCP_WL5353
+extern my_bool log_bin_use_v1_row_events;
+#endif
extern ulong what_to_log,flush_time;
extern ulong max_prepared_stmt_count, prepared_stmt_count;
extern ulong open_files_limit;
=== modified file 'sql/rpl_constants.h'
--- a/sql/rpl_constants.h 2011-09-09 09:30:43 +0000
+++ b/sql/rpl_constants.h 2011-09-20 23:01:27 +0000
@@ -55,6 +55,6 @@ enum ExtraRowInfoFormat {
#define EXTRA_ROW_INFO_HDR_BYTES 2
#define EXTRA_ROW_INFO_MAX_PAYLOAD (255 - EXTRA_ROW_INFO_HDR_BYTES)
-#endif // #ifndef MCP_WL5353
+#endif
#endif /* RPL_CONSTANTS_H */
=== modified file 'sql/rpl_injector.cc'
--- a/sql/rpl_injector.cc 2011-08-31 10:39:08 +0000
+++ b/sql/rpl_injector.cc 2011-09-20 23:01:27 +0000
@@ -133,7 +133,11 @@ int injector::transaction::use_table(ser
int injector::transaction::write_row (server_id_type sid, table tbl,
MY_BITMAP const* cols, size_t colcnt,
- record_type record)
+ record_type record
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ )
{
DBUG_ENTER("injector::transaction::write_row(...)");
@@ -144,15 +148,31 @@ int injector::transaction::write_row (se
server_id_type save_id= m_thd->server_id;
m_thd->set_server_id(sid);
error= m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(),
- cols, colcnt, record);
+ cols, colcnt, record
+#ifndef MCP_WL5353
+ , extra_row_info
+#endif
+ );
m_thd->set_server_id(save_id);
DBUG_RETURN(error);
}
+#ifndef MCP_WL5353
+int injector::transaction::write_row (server_id_type sid, table tbl,
+ MY_BITMAP const* cols, size_t colcnt,
+ record_type record)
+{
+ return write_row(sid, tbl, cols, colcnt, record, NULL);
+}
+#endif
int injector::transaction::delete_row(server_id_type sid, table tbl,
MY_BITMAP const* cols, size_t colcnt,
- record_type record)
+ record_type record
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ )
{
DBUG_ENTER("injector::transaction::delete_row(...)");
@@ -163,15 +183,31 @@ int injector::transaction::delete_row(se
server_id_type save_id= m_thd->server_id;
m_thd->set_server_id(sid);
error= m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(),
- cols, colcnt, record);
+ cols, colcnt, record
+#ifndef MCP_WL5353
+ , extra_row_info
+#endif
+ );
m_thd->set_server_id(save_id);
DBUG_RETURN(error);
}
+#ifndef MCP_WL5353
+int injector::transaction::delete_row(server_id_type sid, table tbl,
+ MY_BITMAP const* cols, size_t colcnt,
+ record_type record)
+{
+ return delete_row(sid, tbl, cols, colcnt, record, NULL);
+}
+#endif
int injector::transaction::update_row(server_id_type sid, table tbl,
MY_BITMAP const* cols, size_t colcnt,
- record_type before, record_type after)
+ record_type before, record_type after
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ )
{
DBUG_ENTER("injector::transaction::update_row(...)");
@@ -182,11 +218,23 @@ int injector::transaction::update_row(se
server_id_type save_id= m_thd->server_id;
m_thd->set_server_id(sid);
error= m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(),
- cols, colcnt, before, after);
+ cols, colcnt, before, after
+#ifndef MCP_WL5353
+ , extra_row_info
+#endif
+ );
m_thd->set_server_id(save_id);
DBUG_RETURN(error);
}
+#ifndef MCP_WL5353
+int injector::transaction::update_row(server_id_type sid, table tbl,
+ MY_BITMAP const* cols, size_t colcnt,
+ record_type before, record_type after)
+{
+ return update_row(sid, tbl, cols, colcnt, before, after, NULL);
+}
+#endif
injector::transaction::binlog_pos injector::transaction::start_pos() const
{
=== modified file 'sql/rpl_injector.h'
--- a/sql/rpl_injector.h 2011-08-31 10:39:08 +0000
+++ b/sql/rpl_injector.h 2011-09-20 23:01:27 +0000
@@ -186,6 +186,12 @@ public:
/*
Add a 'write row' entry to the transaction.
*/
+#ifndef MCP_WL5353
+ int write_row (server_id_type sid, table tbl,
+ MY_BITMAP const *cols, size_t colcnt,
+ record_type record,
+ const uchar* extra_row_info);
+#endif
int write_row (server_id_type sid, table tbl,
MY_BITMAP const *cols, size_t colcnt,
record_type record);
@@ -193,17 +199,28 @@ public:
/*
Add a 'delete row' entry to the transaction.
*/
+#ifndef MCP_WL5353
int delete_row(server_id_type sid, table tbl,
MY_BITMAP const *cols, size_t colcnt,
+ record_type record,
+ const uchar* extra_row_info);
+#endif
+ int delete_row(server_id_type sid, table tbl,
+ MY_BITMAP const *cols, size_t colcnt,
record_type record);
/*
Add an 'update row' entry to the transaction.
*/
+#ifndef MCP_WL5353
int update_row(server_id_type sid, table tbl,
MY_BITMAP const *cols, size_t colcnt,
+ record_type before, record_type after,
+ const uchar* extra_row_info);
+#endif
+ int update_row(server_id_type sid, table tbl,
+ MY_BITMAP const *cols, size_t colcnt,
record_type before, record_type after);
-
/*
Commit a transaction.
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2011-09-09 09:30:43 +0000
+++ b/sql/sql_class.cc 2011-09-20 23:01:27 +0000
@@ -4436,7 +4436,11 @@ THD::binlog_prepare_pending_rows_event(T
size_t colcnt,
size_t needed,
bool is_transactional,
- RowsEventT *hint __attribute__((unused)))
+ RowsEventT *hint __attribute__((unused))
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ )
{
DBUG_ENTER("binlog_prepare_pending_rows_event");
/* Pre-conditions */
@@ -4470,21 +4474,24 @@ THD::binlog_prepare_pending_rows_event(T
if (!pending ||
pending->server_id != serv_id ||
pending->get_table_id() != table->s->table_map_id ||
- pending->get_type_code() != type_code ||
+ pending->get_general_type_code() != type_code ||
pending->get_data_size() + needed > opt_binlog_rows_event_max_size ||
pending->get_width() != colcnt ||
!bitmap_cmp(pending->get_cols(), cols)
#ifndef MCP_WL5353
||
!binlog_row_event_extra_data_eq(pending->get_extra_row_data(),
- binlog_row_event_extra_data)
+ extra_row_info)
#endif
)
{
/* Create a new RowsEventT... */
Rows_log_event* const
- ev= new RowsEventT(this, table, table->s->table_map_id, cols,
- is_transactional);
+ ev= new RowsEventT(this, table, table->s->table_map_id, cols, is_transactional
+#ifndef MCP_WL5353
+ , extra_row_info
+#endif
+ );
if (unlikely(!ev))
DBUG_RETURN(NULL);
ev->server_id= serv_id; // I don't like this, it's too easy to forget.
@@ -4513,17 +4520,29 @@ THD::binlog_prepare_pending_rows_event(T
template Rows_log_event*
THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*,
size_t, size_t, bool,
- Write_rows_log_event*);
+ Write_rows_log_event*
+#ifndef MCP_WL5353
+ ,const uchar*
+#endif
+ );
template Rows_log_event*
THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*,
size_t colcnt, size_t, bool,
- Delete_rows_log_event *);
+ Delete_rows_log_event *
+#ifndef MCP_WL5353
+ ,const uchar*
+#endif
+ );
template Rows_log_event*
THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*,
size_t colcnt, size_t, bool,
- Update_rows_log_event *);
+ Update_rows_log_event *
+#ifndef MCP_WL5353
+ ,const uchar*
+#endif
+ );
#endif
/* Declare in unnamed namespace. */
@@ -4652,7 +4671,11 @@ CPP_UNNAMED_NS_END
int THD::binlog_write_row(TABLE* table, bool is_trans,
MY_BITMAP const* cols, size_t colcnt,
- uchar const *record)
+ uchar const *record
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ )
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open());
@@ -4671,7 +4694,11 @@ int THD::binlog_write_row(TABLE* table,
Rows_log_event* const ev=
binlog_prepare_pending_rows_event(table, server_id, cols, colcnt,
len, is_trans,
- static_cast<Write_rows_log_event*>(0));
+ static_cast<Write_rows_log_event*>(0)
+#ifndef MCP_WL5353
+ ,extra_row_info
+#endif
+ );
if (unlikely(ev == 0))
return HA_ERR_OUT_OF_MEM;
@@ -4682,7 +4709,11 @@ int THD::binlog_write_row(TABLE* table,
int THD::binlog_update_row(TABLE* table, bool is_trans,
MY_BITMAP const* cols, size_t colcnt,
const uchar *before_record,
- const uchar *after_record)
+ const uchar *after_record
+#ifndef MCP_WL5353
+ ,const uchar *extra_row_info
+#endif
+ )
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open());
@@ -4715,7 +4746,11 @@ int THD::binlog_update_row(TABLE* table,
Rows_log_event* const ev=
binlog_prepare_pending_rows_event(table, server_id, cols, colcnt,
before_size + after_size, is_trans,
- static_cast<Update_rows_log_event*>(0));
+ static_cast<Update_rows_log_event*>(0)
+#ifndef MCP_WL5353
+ ,extra_row_info
+#endif
+ );
if (unlikely(ev == 0))
return HA_ERR_OUT_OF_MEM;
@@ -4727,7 +4762,11 @@ int THD::binlog_update_row(TABLE* table,
int THD::binlog_delete_row(TABLE* table, bool is_trans,
MY_BITMAP const* cols, size_t colcnt,
- uchar const *record)
+ uchar const *record
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ )
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open());
@@ -4746,7 +4785,11 @@ int THD::binlog_delete_row(TABLE* table,
Rows_log_event* const ev=
binlog_prepare_pending_rows_event(table, server_id, cols, colcnt,
len, is_trans,
- static_cast<Delete_rows_log_event*>(0));
+ static_cast<Delete_rows_log_event*>(0)
+#ifndef MCP_WL5353
+ ,extra_row_info
+#endif
+ );
if (unlikely(ev == 0))
return HA_ERR_OUT_OF_MEM;
@@ -4997,29 +5040,6 @@ int THD::binlog_query(THD::enum_binlog_q
#ifndef MCP_WL5353
/**
- get_binlog_row_event_extra_data_len
-
- Returns the length in bytes of the current thread's
- binlog row event extra data, if present.
- The length is stored at some offset from the extra
- data ptr.
- Note that this length is the length of the whole extra
- data structure, including the fixed length header
- of size EXTRA_ROW_INFO_HDR_BYTES
-
- @return
- Length in bytes of the extra data.
- Zero is valid. Maximum is 255
-*/
-uint8
-THD::get_binlog_row_event_extra_data_len() const
-{
- return (binlog_row_event_extra_data?
- binlog_row_event_extra_data[EXTRA_ROW_INFO_LEN_OFFSET]:
- 0);
-};
-
-/**
binlog_row_event_extra_data_eq
Comparator for two binlog row event extra data
@@ -5050,8 +5070,7 @@ THD::binlog_row_event_extra_data_eq(cons
(memcmp(a, b,
a[EXTRA_ROW_INFO_LEN_OFFSET]) == 0)));
}
-
-#endif // #ifndef MCP_WL5353
+#endif
bool Discrete_intervals_list::append(ulonglong start, ulonglong val,
ulonglong incr)
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2011-09-09 13:33:52 +0000
+++ b/sql/sql_class.h 2011-09-20 23:01:27 +0000
@@ -1597,7 +1597,6 @@ public:
*/
uchar* binlog_row_event_extra_data;
- uint8 get_binlog_row_event_extra_data_len() const;
static bool binlog_row_event_extra_data_eq(const uchar* a,
const uchar* b);
#endif
@@ -1613,13 +1612,25 @@ public:
int binlog_write_table_map(TABLE *table, bool is_transactional);
int binlog_write_row(TABLE* table, bool is_transactional,
MY_BITMAP const* cols, size_t colcnt,
- const uchar *buf);
+ const uchar *buf
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ );
int binlog_delete_row(TABLE* table, bool is_transactional,
MY_BITMAP const* cols, size_t colcnt,
- const uchar *buf);
+ const uchar *buf
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ );
int binlog_update_row(TABLE* table, bool is_transactional,
MY_BITMAP const* cols, size_t colcnt,
- const uchar *old_data, const uchar *new_data);
+ const uchar *old_data, const uchar *new_data
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ );
void set_server_id(uint32 sid) { server_id = sid; }
@@ -1632,7 +1643,11 @@ public:
size_t colcnt,
size_t needed,
bool is_transactional,
- RowsEventT* hint);
+ RowsEventT* hint
+#ifndef MCP_WL5353
+ ,const uchar* extra_row_info
+#endif
+ );
Rows_log_event* binlog_get_pending_rows_event(bool is_transactional) const;
void binlog_set_pending_rows_event(Rows_log_event* ev, bool is_transactional);
inline int binlog_flush_pending_rows_event(bool stmt_end)
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2011-08-31 10:39:08 +0000
+++ b/sql/sys_vars.cc 2011-09-20 23:01:27 +0000
@@ -930,6 +930,14 @@ static Sys_var_mybool Sys_trust_function
GLOBAL_VAR(trust_function_creators),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
+#ifndef MCP_WL5353
+static Sys_var_mybool Sys_log_bin_use_v1_row_events(
+ "log_bin_use_v1_row_events",
+ "Whether to use version 1 row events in the Binlog.",
+ READ_ONLY GLOBAL_VAR(log_bin_use_v1_row_events),
+ NO_CMD_LINE, DEFAULT(FALSE));
+#endif
+
static Sys_var_charptr Sys_log_error(
"log_error", "Error log file",
READ_ONLY GLOBAL_VAR(log_error_file_ptr),
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5-cluster branch (frazer.clement:3504 to 3505) | Frazer Clement | 22 Sep |