List:Commits« Previous MessageNext Message »
From:Frazer Clement Date:October 4 2011 1:19pm
Subject:bzr push into mysql-trunk-cluster branch (frazer.clement:3380 to 3382)
View as plain text  
 3382 Frazer Clement	2011-10-04 [merge]
      Merge 5.5-cluster -> trunk-cluster

    added:
      mysql-test/include/have_binlog_row_v2.inc
      mysql-test/r/have_binlog_row_v2.require
    modified:
      client/mysqlbinlog.cc
      mysql-test/extra/binlog_tests/binlog.test
      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/r/binlog_variables_log_bin.result
      mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result
      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/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/t/ctype_cp932_binlog_stm.test
      sql/binlog.cc
      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_binlog.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sys_vars.cc
 3381 Frazer Clement	2011-10-03 [merge]
      Merge 5.5-cluster -> trunk-cluster

    modified:
      storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
 3380 magnus.blaudd@stripped	2011-10-03 [merge]
      Merge 5.5-cluster(3505) -> trunk-cluster

    added:
      mysql-test/suite/ndb/t/ndb_index_stat_partitions-master.opt
      storage/ndb/memcache/README
    modified:
      mysql-test/suite/ndb/r/ndb_index_stat_partitions.result
      mysql-test/suite/rpl/t/disabled.def
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/ha_ndbcluster_binlog.h
      storage/ndb/compile-cluster
      storage/ndb/include/mgmcommon/ConfigRetriever.hpp
      storage/ndb/memcache/CMakeLists.txt
      storage/ndb/memcache/atomics.cmake
      storage/ndb/memcache/include/ndb_configuration.h
      storage/ndb/memcache/sandbox.sh.in
      storage/ndb/memcache/src/Configuration.cc
      storage/ndb/memcache/src/ndb_configuration.cc
      storage/ndb/memcache/src/ndb_engine.c
      storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp
      storage/ndb/src/mgmapi/mgmapi.cpp
      storage/ndb/src/mgmsrv/MgmtSrvr.cpp
      storage/ndb/src/ndbapi/NdbQueryOperation.cpp
      storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
      storage/ndb/test/ndbapi/testMgm.cpp
      storage/ndb/test/ndbapi/testNdbApi.cpp
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	2011-09-20 09:16:45 +0000
+++ b/client/mysqlbinlog.cc	2011-10-04 12:53:30 +0000
@@ -875,6 +875,11 @@ Exit_status process_event(PRINT_EVENT_IN
     case WRITE_ROWS_EVENT:
     case DELETE_ROWS_EVENT:
     case UPDATE_ROWS_EVENT:
+#ifndef MCP_WL5353
+    case WRITE_ROWS_EVENT_V1:
+    case DELETE_ROWS_EVENT_V1:
+    case UPDATE_ROWS_EVENT_V1:
+#endif
     case PRE_GA_WRITE_ROWS_EVENT:
     case PRE_GA_DELETE_ROWS_EVENT:
     case PRE_GA_UPDATE_ROWS_EVENT:
@@ -883,7 +888,14 @@ Exit_status process_event(PRINT_EVENT_IN
       Table_map_log_event *ignored_map= NULL;
       if (ev_type == WRITE_ROWS_EVENT ||
           ev_type == DELETE_ROWS_EVENT ||
-          ev_type == UPDATE_ROWS_EVENT)
+          ev_type == UPDATE_ROWS_EVENT 
+#ifndef MCP_WL5353
+          ||
+          ev_type == WRITE_ROWS_EVENT_V1 ||
+          ev_type == DELETE_ROWS_EVENT_V1 ||
+          ev_type == UPDATE_ROWS_EVENT_V1
+#endif
+)
       {
         Rows_log_event *new_ev= (Rows_log_event*) ev;
         if (new_ev->get_flags(Rows_log_event::STMT_END_F))

=== modified file 'mysql-test/extra/binlog_tests/binlog.test'
--- a/mysql-test/extra/binlog_tests/binlog.test	2011-05-20 11:50:50 +0000
+++ b/mysql-test/extra/binlog_tests/binlog.test	2011-10-04 12:53:30 +0000
@@ -350,7 +350,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=

=== 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-21 10:57:59 +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_using_logname.inc'
--- a/mysql-test/include/show_binlog_using_logname.inc	2010-06-27 01:42:41 +0000
+++ b/mysql-test/include/show_binlog_using_logname.inc	2011-10-04 12:53:30 +0000
@@ -6,8 +6,16 @@
 #          name is = log_name
 ######################################################## 
 
---replace_result $start_pos <start_pos> $end_pos <end_pos>
---replace_column 2 #
+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>
+--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 $end_pos,1
+--eval show binlog events in '$log_name'  from $start_pos limit 0,1
 

=== modified file 'mysql-test/r/ctype_cp932_binlog_stm.result'
--- a/mysql-test/r/ctype_cp932_binlog_stm.result	2011-05-20 11:50:50 +0000
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result	2011-10-04 12:53:30 +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	2010-11-16 09:38:43 +0000
+++ b/mysql-test/r/flush2.result	2011-10-04 12:53:30 +0000
@@ -6,6 +6,7 @@ log_bin	OFF
 log_bin_basename	
 log_bin_index	
 log_bin_trust_function_creators	ON
+log_bin_use_v1_row_events	OFF
 show variables like 'relay_log%';
 Variable_name	Value
 relay_log	
@@ -23,6 +24,7 @@ log_bin	OFF
 log_bin_basename	
 log_bin_index	
 log_bin_trust_function_creators	ON
+log_bin_use_v1_row_events	OFF
 show variables like 'relay_log%';
 Variable_name	Value
 relay_log	

=== 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-21 10:57:59 +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-09-27 12:11:16 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result	2011-10-04 12:53:30 +0000
@@ -251,6 +251,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
@@ -891,6 +896,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-20 11:50:50 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result	2011-10-04 12:53:30 +0000
@@ -804,7 +804,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-20 11:50:50 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2011-10-04 12:53:30 +0000
@@ -572,7 +572,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_variables_log_bin.result'
--- a/mysql-test/suite/binlog/r/binlog_variables_log_bin.result	2010-11-04 14:43:52 +0000
+++ b/mysql-test/suite/binlog/r/binlog_variables_log_bin.result	2011-10-04 12:53:30 +0000
@@ -7,3 +7,5 @@ Variable_name	log_bin_index
 Value	MYSQLTEST_VARDIR/mysqld.1/data/other.index
 Variable_name	log_bin_trust_function_creators
 Value	ON
+Variable_name	log_bin_use_v1_row_events
+Value	OFF

=== modified file 'mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result'
--- a/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result	2010-11-04 14:43:52 +0000
+++ b/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result	2011-10-04 12:53:30 +0000
@@ -7,3 +7,5 @@ Variable_name	log_bin_index
 Value	MYSQLTEST_VARDIR/tmp/something.index
 Variable_name	log_bin_trust_function_creators
 Value	ON
+Variable_name	log_bin_use_v1_row_events
+Value	OFF

=== 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-21 10:57:59 +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-21 10:57:59 +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-10-04 12:53:30 +0000
@@ -39,9 +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
 
 drop table if exists t1;

=== 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-21 10:57:59 +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-21 10:11:58 +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-21 10:11:58 +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/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-21 10:11:58 +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-21 10:11:58 +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-05-20 11:50:50 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test	2011-10-04 12:53:30 +0000
@@ -1,7 +1,7 @@
 # depends on the binlog output
 -- source include/have_binlog_format_row.inc
 
-let $rename_event_pos= 900;
+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-05-20 11:50:50 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test	2011-10-04 12:53:30 +0000
@@ -2,5 +2,5 @@
 --source include/have_binlog_format_mixed_or_statement.inc
 --source include/not_relay_log_info_table.inc
 
-let $rename_event_pos= 933;
+let $rename_event_pos= 936;
 -- source extra/rpl_tests/rpl_flsh_tbls.test

=== modified file 'mysql-test/t/ctype_cp932_binlog_stm.test'
--- a/mysql-test/t/ctype_cp932_binlog_stm.test	2011-07-08 09:34:07 +0000
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test	2011-10-04 12:53:30 +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/binlog.cc'
--- a/sql/binlog.cc	2011-09-30 15:38:44 +0000
+++ b/sql/binlog.cc	2011-10-04 12:53:30 +0000
@@ -5444,7 +5444,11 @@ template <class RowsEventT> Rows_log_eve
 THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
                                        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 */
@@ -5471,20 +5475,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->read_write_bitmaps_cmp(table) == FALSE
 #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,
-                           is_transactional);
+                           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.
@@ -5630,7 +5638,11 @@ CPP_UNNAMED_NS_START
 CPP_UNNAMED_NS_END
 
 int THD::binlog_write_row(TABLE* table, bool is_trans, 
-                          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());
 
@@ -5648,7 +5660,11 @@ int THD::binlog_write_row(TABLE* table,
 
   Rows_log_event* const ev=
     binlog_prepare_pending_rows_event(table, server_id, 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;
@@ -5658,7 +5674,11 @@ int THD::binlog_write_row(TABLE* table,
 
 int THD::binlog_update_row(TABLE* table, bool is_trans,
                            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());
   int error= 0;
@@ -5706,7 +5726,11 @@ int THD::binlog_update_row(TABLE* table,
   Rows_log_event* const ev=
     binlog_prepare_pending_rows_event(table, server_id,
 				      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;
@@ -5722,7 +5746,11 @@ int THD::binlog_update_row(TABLE* table,
 }
 
 int THD::binlog_delete_row(TABLE* table, bool is_trans, 
-                           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());
   int error= 0;
@@ -5756,7 +5784,11 @@ int THD::binlog_delete_row(TABLE* table,
 
   Rows_log_event* const ev=
     binlog_prepare_pending_rows_event(table, server_id, 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;

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2011-10-03 12:34:35 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2011-10-04 12:53:30 +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);
 
@@ -3386,6 +3387,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);
@@ -6022,11 +6034,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());
@@ -6084,7 +6097,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;
@@ -6128,7 +6142,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;
@@ -6163,7 +6178,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
@@ -6187,7 +6203,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);
       }
     }
@@ -6198,11 +6215,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-30 15:38:44 +0000
+++ b/sql/log_event.cc	2011-10-04 12:53:30 +0000
@@ -78,7 +78,6 @@ TYPELIB binlog_checksum_typelib=
 
 #define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
 
-
 /*
   Size of buffer for printing a double in format %.<PREC>g
 
@@ -632,14 +631,25 @@ 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";
   case IGNORABLE_LOG_EVENT: return "Ignorable";
   case ROWS_QUERY_LOG_EVENT: return "Rows_query";
+#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 */
   }
 }
@@ -1506,6 +1516,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;
@@ -1515,6 +1536,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;
@@ -1531,6 +1553,19 @@ Log_event* Log_event::read_log_event(con
     case ROWS_QUERY_LOG_EVENT:
       ev= new Rows_query_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:
       /*
         Create an object of Ignorable_log_event for unrecognized sub-class.
@@ -2193,7 +2228,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();
+#else
+  Log_event_type type_code= get_general_type_code();
+#endif
   
 #ifndef MCP_WL5353
   if (m_extra_row_data)
@@ -2327,31 +2366,62 @@ 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 (checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF &&
         checksum_alg != BINLOG_CHECKSUM_ALG_OFF)
       size-= BINLOG_CHECKSUM_LEN; // checksum is displayed through the header
     
-    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)
@@ -4887,9 +4957,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
@@ -4902,13 +4978,18 @@ 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;
       post_header_len[IGNORABLE_LOG_EVENT-1]= IGNORABLE_HEADER_LEN;
       post_header_len[ROWS_QUERY_LOG_EVENT-1]= IGNORABLE_HEADER_LEN;
+#ifndef MCP_WL5353     
+      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;
@@ -8442,12 +8523,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;
@@ -8455,7 +8534,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
@@ -8493,18 +8572,24 @@ 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 using_trans)
-  : Log_event(thd_arg, 0,
+                               MY_BITMAP const *cols, bool using_trans
+#ifndef MCP_WL5353
+                               ,Log_event_type event_type,
+                               const uchar* extra_row_info
+#endif
+                               )
+ : Log_event(thd_arg, 0,
              using_trans ? Log_event::EVENT_TRANSACTIONAL_CACHE :
                            Log_event::EVENT_STMT_CACHE,
              Log_event::EVENT_NORMAL_LOGGING),
+                
     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)
@@ -8528,27 +8613,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,
@@ -8580,9 +8661,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)
@@ -8612,34 +8693,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;
@@ -8668,7 +8776,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));
 
@@ -8728,7 +8841,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);
@@ -8737,14 +8854,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);
@@ -8910,10 +9039,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 */
@@ -9024,7 +9153,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;
@@ -9367,32 +9496,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 (wrapper_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 = wrapper_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 = wrapper_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 (wrapper_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)
@@ -9416,7 +9577,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));
@@ -10080,8 +10247,19 @@ void Table_map_log_event::print(FILE *,
 #if !defined(MYSQL_CLIENT)
 Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
                                            ulong tid_arg,
-                                           bool is_transactional)
-  : Rows_log_event(thd_arg, tbl_arg, tid_arg, tbl_arg->write_set, is_transactional)
+                                           bool is_transactional
+#ifndef MCP_WL5353
+                                           ,const uchar* extra_row_info
+#endif
+                                           )
+  : Rows_log_event(thd_arg, tbl_arg, tid_arg, tbl_arg->write_set, is_transactional
+#ifndef MCP_WL5353
+                   ,log_bin_use_v1_row_events?
+                   WRITE_ROWS_EVENT_V1:
+                   WRITE_ROWS_EVENT,
+                   extra_row_info
+#endif
+                   )
 {
 }
 #endif
@@ -10092,8 +10270,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
@@ -11224,8 +11412,19 @@ err:
 #ifndef MYSQL_CLIENT
 Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
                                              ulong tid,
-                                             bool is_transactional)
-  : Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional)
+                                             bool is_transactional
+#ifndef MCP_WL5353
+                                             ,const uchar* extra_row_info
+#endif
+                                             )
+  : Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, 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) */
@@ -11236,8 +11435,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
@@ -11309,8 +11518,20 @@ void Delete_rows_log_event::print(FILE *
 #if !defined(MYSQL_CLIENT)
 Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
                                              ulong tid,
-                                             bool is_transactional)
-: Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional)
+                                             bool is_transactional
+#ifndef MCP_WL5353
+                                             ,const uchar* extra_row_info
+#endif
+                                             )
+: Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional
+#ifndef MCP_WL5353
+                 ,log_bin_use_v1_row_events?
+                 UPDATE_ROWS_EVENT_V1:
+                 UPDATE_ROWS_EVENT,
+                 extra_row_info
+#endif
+                 )
+
 {
   init(tbl_arg->write_set);
 }
@@ -11349,8 +11570,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-30 15:38:44 +0000
+++ b/sql/log_event.h	2011-10-04 12:53:30 +0000
@@ -248,7 +248,11 @@ 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)
@@ -256,6 +260,10 @@ struct sql_ex_info
 #define HEARTBEAT_HEADER_LEN   0
 #define IGNORABLE_HEADER_LEN   0
 
+#ifndef MCP_WL5353
+#define ROWS_HEADER_LEN_V2    10
+#endif
+
 /*
    The maximum number of updated databases that a status of
    Query-log-event can carry.  It can redefined within a range
@@ -419,6 +427,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
@@ -649,9 +662,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
@@ -673,6 +692,16 @@ enum Log_event_type
   IGNORABLE_LOG_EVENT= 28,
   ROWS_QUERY_LOG_EVENT= 29,
 
+#ifndef MCP_WL5353
+  /*
+     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
@@ -3853,13 +3882,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;
@@ -3876,7 +3898,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
 
@@ -3983,7 +4010,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,
@@ -4025,6 +4057,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
@@ -4133,15 +4167,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, 
-		       bool is_transactional);
+		       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,
@@ -4151,12 +4196,20 @@ public:
                                           const uchar *after_record)
   {
     return thd->binlog_write_row(table, is_transactional,
-                                 after_record);
+                                 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);
@@ -4189,16 +4242,27 @@ 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,
-                        bool is_transactional);
+                        bool is_transactional
+#ifndef MCP_WL5353
+                        ,const uchar* extra_row_info
+#endif
+                        );
 
   void init(MY_BITMAP const *cols);
 #endif
@@ -4207,7 +4271,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
@@ -4217,7 +4285,11 @@ public:
                                           const uchar *after_record)
   {
     return thd->binlog_update_row(table, is_transactional,
-                                  before_record, after_record);
+                                  before_record, after_record
+#ifndef MCP_WL5353
+                                  , NULL
+#endif
+                                  );
   }
 #endif
 
@@ -4227,7 +4299,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);
@@ -4267,15 +4343,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, 
-			bool is_transactional);
+			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,
@@ -4285,12 +4372,20 @@ public:
                                           __attribute__((unused)))
   {
     return thd->binlog_delete_row(table, is_transactional,
-                                  before_record);
+                                  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	2011-09-06 12:43:05 +0000
+++ b/sql/log_event_old.h	2011-10-04 12:53:30 +0000
@@ -42,6 +42,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,
-                                 after_record);
+                                 after_record
+#ifndef MCP_WL5353
+                                 , NULL
+#endif
+                                 );
   }
 #endif
 
@@ -448,7 +455,11 @@ public:
                                           const uchar *after_record)
   {
     return thd->binlog_update_row(table, is_transactional,
-                                  before_record, after_record);
+                                  before_record, after_record
+#ifndef MCP_WL5353
+                                  , NULL
+#endif
+                                  );
   }
 #endif
 
@@ -522,7 +533,11 @@ public:
                                           __attribute__((unused)))
   {
     return thd->binlog_delete_row(table, is_transactional,
-                                  before_record);
+                                  before_record
+#ifndef MCP_WL5353
+                                  , NULL
+#endif
+                                  );
   }
 #endif
   

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-09-07 10:08:09 +0000
+++ b/sql/mysqld.cc	2011-10-04 12:53:30 +0000
@@ -494,6 +494,10 @@ ulong specialflag=0;
 ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
 ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
 ulong max_connections, max_connect_errors;
+#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.
@@ -6308,6 +6312,15 @@ struct my_option my_long_options[]=
    "File that holds the names for relay log files.",
    &opt_relaylog_index_name, &opt_relaylog_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-09-07 10:08:09 +0000
+++ b/sql/mysqld.h	2011-10-04 12:53:30 +0000
@@ -187,6 +187,9 @@ extern uint  slave_net_timeout;
 extern ulong opt_mts_slave_parallel_workers;
 extern ulonglong opt_mts_pending_jobs_size_max;
 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-30 15:38:44 +0000
+++ b/sql/rpl_constants.h	2011-10-04 12:53:30 +0000
@@ -71,6 +71,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-09-07 10:08:09 +0000
+++ b/sql/rpl_injector.cc	2011-10-04 12:53:30 +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(...)");
 
@@ -146,15 +150,31 @@ int injector::transaction::write_row (se
    table::save_sets saveset(tbl, cols, cols);
 
    error= m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(), 
-                                  record);
+                                  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(...)");
 
@@ -166,15 +186,31 @@ int injector::transaction::delete_row(se
    m_thd->set_server_id(sid);
    table::save_sets saveset(tbl, cols, cols);
    error= m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(), 
-                                   record);
+                                   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(...)");
 
@@ -188,11 +224,23 @@ int injector::transaction::update_row(se
    table::save_sets saveset(tbl, cols, cols);
 
    error= m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(), 
-                                   before, after);
+                                   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-09-28 09:12:47 +0000
+++ b/sql/rpl_injector.h	2011-10-04 12:53:30 +0000
@@ -204,6 +204,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);
@@ -211,17 +217,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_binlog.cc'
--- a/sql/sql_binlog.cc	2011-09-07 10:08:09 +0000
+++ b/sql/sql_binlog.cc	2011-10-04 12:53:30 +0000
@@ -81,6 +81,11 @@ static int check_event_type(int type, Re
   case WRITE_ROWS_EVENT:
   case UPDATE_ROWS_EVENT:
   case DELETE_ROWS_EVENT:
+#ifndef MCP_WL5353
+  case WRITE_ROWS_EVENT_V1:
+  case UPDATE_ROWS_EVENT_V1:
+  case DELETE_ROWS_EVENT_V1:
+#endif
   case PRE_GA_WRITE_ROWS_EVENT:
   case PRE_GA_UPDATE_ROWS_EVENT:
   case PRE_GA_DELETE_ROWS_EVENT:

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2011-09-30 15:38:44 +0000
+++ b/sql/sql_class.cc	2011-10-04 12:53:30 +0000
@@ -4205,29 +4205,6 @@ void xid_cache_delete(XID_STATE *xid_sta
 
 #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

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2011-10-03 08:05:59 +0000
+++ b/sql/sql_class.h	2011-10-04 12:53:30 +0000
@@ -1921,7 +1921,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
@@ -1935,11 +1934,24 @@ public:
   int binlog_write_table_map(TABLE *table, bool is_transactional,
                              bool binlog_rows_query);
   int binlog_write_row(TABLE* table, bool is_transactional,
-                       const uchar *new_data);
+                       const uchar *new_data
+#ifndef MCP_WL5353
+                       ,const uchar* extra_row_info
+#endif
+                       );
   int binlog_delete_row(TABLE* table, bool is_transactional,
-                        const uchar *old_data);
+                        const uchar *old_data
+#ifndef MCP_WL5353
+                        ,const uchar* extra_row_info
+#endif
+                        );
   int binlog_update_row(TABLE* table, bool is_transactional,
-                        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 binlog_prepare_row_images(TABLE* table);
 
   void set_server_id(uint32 sid) { server_id = sid; }
@@ -1951,7 +1963,11 @@ public:
     binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
                                       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-09-27 12:11:16 +0000
+++ b/sql/sys_vars.cc	2011-10-04 12:53:30 +0000
@@ -1203,6 +1203,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),

=== modified file 'storage/ndb/include/ndbapi/ndb_cluster_connection.hpp'
--- a/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp	2011-09-09 13:09:02 +0000
+++ b/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp	2011-09-21 10:45:41 +0000
@@ -117,7 +117,7 @@ public:
    *         1 = recoverable error,
    *        -1 = non-recoverable error
    */
-  int connect(int no_retries=0, int retry_delay_in_seconds=1, int verbose=0);
+  int connect(int no_retries=30, int retry_delay_in_seconds=1, int verbose=0);
 
 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
   int start_connect_thread(int (*connect_callback)(void)= 0);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-cluster branch (frazer.clement:3380 to 3382) Frazer Clement5 Oct