MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Frazer Clement Date:September 11 2009 10:34am
Subject:bzr commit into mysql-5.1-telco-6.2 branch (frazer:2993) Bug#45756
View as plain text  
#At file:///home/frazer/bzr/mysql-5.1-telco-6.2/

 2993 Frazer Clement	2009-09-11
      Bug#45756 : DDL statements not always in binary logs of other SQL Nodes on slave cluster
      
      - Modify source-server-id mechanism for DDL propagation within cluster to allow Binlog Injector to differentiate between local-cluster-sourced and replication-slave-sourced DDL changes.
      - Modify Binlog Injector to generate DDL Binlog entries for replication-slave-sourced DDL changes iff log-slave-updates is On.
      
      Impact
      - Binlogging of DDL on MySQLDs attached to slave cluster is independent of log-bin and log-slave-updates setting on active slave MySQLD
        This aligns DDL handling behaviour with DML handling behaviour
      - Source server-id for DDL Binlog entries is set to the server-id of the first MySQLD to Binlog the change.
        This aligns DDL handling behaviour with DML handling behaviour
      
      Risks
      - Online upgrade of Binlogging MySQLDs
        DDL applied by non-upgraded MySQLDs will not be logged by upgraded MySQLDs unless the upgraded MySQLDs have log-slave-updates on.
        This is because the upgraded MySQLDs will think that the DDL sourced by locally-attached non-upgraded MySQLDs has been applied by a slave applier.
      
        Workarounds :
        1) Do not perform DDL during online upgrade of attached MySQLDs
           or
        2) Upgrade binlogging MySQLD node last
           or
        3) Reconfigure binlogging MySQLD nodes to set log-slave-updates=On before upgrade
           This may have other effects in circular replication scenarios. 
      added:
        mysql-test/extra/rpl_tests/rpl_ndb_multi_binlog_update.cnf
        mysql-test/extra/rpl_tests/rpl_ndb_multi_binlog_update.test
        mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu.result
        mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu.cnf
        mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu.test
      modified:
        mysql-test/suite/ndb_binlog/r/ndb_binlog_ddl_multi.result
        mysql-test/suite/ndb_binlog/r/ndb_binlog_log_bin.result
        mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result
        mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
        mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
        mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf
        sql/ha_ndbcluster_binlog.cc

=== added file 'mysql-test/extra/rpl_tests/rpl_ndb_multi_binlog_update.cnf'
--- a/mysql-test/extra/rpl_tests/rpl_ndb_multi_binlog_update.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_ndb_multi_binlog_update.cnf	2009-09-11 10:34:36 +0000
@@ -0,0 +1,112 @@
+!include include/default_ndbd.cnf
+
+[cluster_config.1]
+# NoOfReplicas refers to NDBD nodes/nodegroup
+NoOfReplicas=                  2
+ndbd=,
+ndb_mgmd=
+# 3 MySQLDS attached to Cluster 1
+mysqld=,,                   
+
+
+
+[cluster_config.slave]
+# NoOfReplicas refers to NDBD nodes/nodegroup
+NoOfReplicas=                  2
+ndbd=,
+ndb_mgmd=
+# 3 MySQLDs attached to Cluster 2
+mysqld=,,
+
+
+
+[mysqld]
+open-files-limit=           1024
+local-infile
+default-character-set=      latin1
+connect-timeout=            60
+log-bin-trust-function-creators=1
+key_buffer_size=            1M
+sort_buffer=                256K
+max_heap_table_size=        1M
+loose-innodb_data_file_path=      ibdata1:10M:autoextend
+slave-net-timeout=120
+ndbcluster
+
+
+
+[mysqld.1.1]
+server-id= 1
+log-bin= master-bin
+binlog_format=row
+
+
+
+[mysqld.2.1]
+server-id= 2
+# Note no binary log
+
+
+
+[mysqld.3.1]
+server-id= 3
+log-bin= master-bin
+binlog_format=row
+
+
+
+[mysqld.1.slave]
+# Note no binlog on this slave
+server-id= 4
+init-rpl-role= slave
+skip-slave-start
+loose-skip-innodb
+slave-load-tmpdir= ../../../tmp
+ndb_connectstring= @mysql_cluster.slave.ndb_connectstring
+
+
+
+[mysqld.2.slave]
+# Note binlog on this slave, but not logging slave updates
+server-id= 5
+init-rpl-role= slave
+skip-slave-start
+loose-skip-innodb
+slave-load-tmpdir= ../../../tmp
+ndb_connectstring= @mysql_cluster.slave.ndb_connectstring
+log-bin= slave-master-bin
+binlog_format=row
+
+
+
+[mysqld.3.slave]
+# Note binlog on this slave, with slave updates logged
+server-id= 6
+init-rpl-role= slave
+skip-slave-start
+loose-skip-innodb
+slave-load-tmpdir= ../../../tmp
+ndb_connectstring= @mysql_cluster.slave.ndb_connectstring
+log-bin= slave-master-bin
+binlog_format=row
+log-slave-updates
+
+
+
+[ENV]
+MASTER_MYPORT= @mysqld.1.1.port
+MASTER_MYPORT1= @mysqld.2.1.port
+MASTER_MYSOCK1= @mysqld.2.1.socket
+MASTER_MYPORT2= @mysqld.3.1.port
+MASTER_MYSOCK2= @mysqld.3.1.socket
+SLAVE_MYPORT= @mysqld.1.slave.port
+SLAVE_MYSOCK= @mysqld.1.slave.socket
+SLAVE_MYPORT1= @mysqld.2.slave.port
+SLAVE_MYSOCK1= @mysqld.2.slave.socket
+SLAVE_MYPORT2= @mysqld.3.slave.port
+SLAVE_MYSOCK2= @mysqld.3.slave.socket
+
+
+NDB_CONNECTSTRING= @mysql_cluster.1.ndb_connectstring
+NDB_CONNECTSTRING_SLAVE= @mysql_cluster.slave.ndb_connectstring
+NDB_BACKUP_DIR= @cluster_config.ndbd.1.1.BackupDataDir

=== added file 'mysql-test/extra/rpl_tests/rpl_ndb_multi_binlog_update.test'
--- a/mysql-test/extra/rpl_tests/rpl_ndb_multi_binlog_update.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_ndb_multi_binlog_update.test	2009-09-11 10:34:36 +0000
@@ -0,0 +1,196 @@
+###############################################################################
+# Description: Performs binloggable and non binloggable DDL and DML at each
+#              MySQLD in pair of clusters with (at least) 3 MySQLDs each.
+#              Then connects to each MySQLD and examines the contents of
+#              its Binlog.
+#              Expected contents depends on the configuration of Binlogging
+#              in the cluster used.
+#              Default from rpl_ndb_multi_binlog_update.test is as shown
+#              below. 
+# 
+# Testing scenario: Cluster 1 replicates to Cluster 2
+#
+#  Key : BL= Binlogging, LSU = LogSlaveUpdates = On
+#
+#                       BL                        BL
+#  cluster 1 [  srv_master  srv_master1  srv_master2  ]
+#                   |
+#                   |-----------------------
+#                   v          v            v
+#  cluster 2 [  srv_slave  srv_slave1  srv_slave2 ]
+#                                  BL      BL LSU
+#
+#  Cluster 1:
+#  - Schema change originates on all severs in Cluster 1
+#  - MySQLD1 which is binlogging master. 
+#    Identification: connection (srv_master), config (mysqld.1.1).
+#  - MySQLD2 which is not binlogging.
+#    Identification: connection (srv_master1), config (mysqld.1.2).
+#  - MySQLD3 which is binlogging but not currently master.
+#    Identification: connection (srv_master2), config (mysqld.1.3).
+#
+#  Cluster 2:
+#  - MySQLD1: 
+#    Can act as slave, not binlogging
+#    Identification: connection (srv_slave), config (mysqld.1.slave).
+#  - MySQLD2: 
+#    Can act as slave, binlogging, log-slave-updates = off
+#    Identification: connection (srv_slave1), config (mysqld.2.slave).
+#  - MySQLD3 
+#    Can act as slave, binlogging, log-slave-updates = on
+#    Identification: connection (srv_slave2), config (mysqld.3.slave).
+#
+# See rpl_ndb_multi_binlog_update.test for default configuration.
+# Originally motivated by bug#45756
+# See rpl_ndb_slave_lsu.test for full testcase
+#
+# Preconditions :
+#   - Connections srv_master, srv_master1, srv_master2, srv_slave, 
+#     srv_slave1, srv_slave2 exist.
+#   - $which_slave contains the name of the slave server performing
+#     the replication slave role.
+#
+###############################################################################
+
+###############################################################################
+#                            Checking Replication
+###############################################################################
+--echo *** Generating slave cluster originated binloggable changes ***
+connection srv_slave;
+CREATE TABLE BUG_45756_SLAVE_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_1;
+
+connection srv_slave1;
+CREATE TABLE BUG_45756_SLAVE_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_2;
+
+connection srv_slave2;
+CREATE TABLE BUG_45756_SLAVE_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_3;
+
+--echo ***Generating slave cluster non-binloggable changes***
+connection srv_slave;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_1;
+SET SQL_LOG_BIN= 1;
+
+connection srv_slave1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_2;
+SET SQL_LOG_BIN= 1;
+
+connection srv_slave2;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_3;
+SET SQL_LOG_BIN= 1;
+
+--echo *** Generating data to be replicated ***
+connection srv_master;
+CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_1;
+
+connection srv_master1;
+CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_2;
+
+connection srv_master2;
+CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_3;
+
+--echo *** Generating changes not to be replicated ***
+connection srv_master;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_1;
+SET SQL_LOG_BIN= 1;
+
+connection srv_master1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_2;
+SET SQL_LOG_BIN= 1;
+
+connection srv_master2;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_3;
+SET SQL_LOG_BIN= 1;
+
+connection srv_master;
+sync_slave_with_master $which_slave;
+
+--echo *** Checking binlog contents on every server in both clusters ***
+connection srv_master;
+--echo 
+--echo 
+--echo 
+--echo connection srv_master;
+show variables like 'server_id';
+show variables like 'log_bin';
+show variables like 'log_slave_updates';
+--source include/show_binlog_events2.inc
+
+connection srv_master1;
+--echo 
+--echo 
+--echo 
+--echo connection srv_master1;
+show variables like 'server_id';
+show variables like 'log_bin';
+show variables like 'log_slave_updates';
+--source include/show_binlog_events2.inc
+
+connection srv_master2;
+--echo 
+--echo 
+--echo 
+--echo connection srv_master2;
+show variables like 'server_id';
+show variables like 'log_bin';
+show variables like 'log_slave_updates';
+--source include/show_binlog_events2.inc
+
+connection srv_slave;
+--echo 
+--echo 
+--echo 
+--echo connection srv_slave;
+show variables like 'server_id';
+show variables like 'log_bin';
+show variables like 'log_slave_updates';
+--source include/show_binlog_events2.inc
+
+connection srv_slave1;
+--echo 
+--echo 
+--echo 
+--echo connection srv_slave1;
+show variables like 'server_id';
+show variables like 'log_bin';
+show variables like 'log_slave_updates';
+--source include/show_binlog_events2.inc
+
+connection srv_slave2;
+--echo 
+--echo 
+--echo 
+--echo connection srv_slave2;
+show variables like 'server_id';
+show variables like 'log_bin';
+show variables like 'log_slave_updates';
+--source include/show_binlog_events2.inc

=== modified file 'mysql-test/suite/ndb_binlog/r/ndb_binlog_ddl_multi.result'
--- a/mysql-test/suite/ndb_binlog/r/ndb_binlog_ddl_multi.result	2009-02-01 21:05:19 +0000
+++ b/mysql-test/suite/ndb_binlog/r/ndb_binlog_ddl_multi.result	2009-09-11 10:34:36 +0000
@@ -10,14 +10,14 @@ create table t1 (a int primary key) engi
 create table t2 (a int primary key) engine=ndb;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-mysqld-bin.000001	#	Query	1	#	create database mysqltest
-mysqld-bin.000001	#	Query	1	#	use `mysqltest`; create table t1 (a int primary key) engine=ndb
+mysqld-bin.000001	#	Query	2	#	create database mysqltest
+mysqld-bin.000001	#	Query	2	#	use `mysqltest`; create table t1 (a int primary key) engine=ndb
 mysqld-bin.000001	#	Query	2	#	use `test`; create table t2 (a int primary key) engine=ndb
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 mysqld-bin.000001	#	Query	1	#	create database mysqltest
 mysqld-bin.000001	#	Query	1	#	use `mysqltest`; create table t1 (a int primary key) engine=ndb
-mysqld-bin.000001	#	Query	2	#	use `test`; create table t2 (a int primary key) engine=ndb
+mysqld-bin.000001	#	Query	1	#	use `test`; create table t2 (a int primary key) engine=ndb
 reset master;
 reset master;
 alter table t2 add column (b int);
@@ -25,19 +25,19 @@ Warnings:
 Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-mysqld-bin.000001	#	Query	2	#	use `test`; alter table t2 add column (b int)
+mysqld-bin.000001	#	Query	1	#	use `test`; alter table t2 add column (b int)
 reset master;
 reset master;
 ALTER DATABASE mysqltest CHARACTER SET latin1;
 drop table mysqltest.t1;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-mysqld-bin.000001	#	Query	2	#	ALTER DATABASE mysqltest CHARACTER SET latin1
-mysqld-bin.000001	#	Query	2	#	use `mysqltest`; drop table `mysqltest`.`t1`
+mysqld-bin.000001	#	Query	1	#	ALTER DATABASE mysqltest CHARACTER SET latin1
+mysqld-bin.000001	#	Query	1	#	use `mysqltest`; drop table `mysqltest`.`t1`
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-mysqld-bin.000001	#	Query	2	#	ALTER DATABASE mysqltest CHARACTER SET latin1
-mysqld-bin.000001	#	Query	2	#	use `mysqltest`; drop table `mysqltest`.`t1`
+mysqld-bin.000001	#	Query	1	#	ALTER DATABASE mysqltest CHARACTER SET latin1
+mysqld-bin.000001	#	Query	1	#	use `mysqltest`; drop table `mysqltest`.`t1`
 reset master;
 reset master;
 use test;
@@ -52,8 +52,8 @@ mysqld-bin.000001	#	Table_map	2	#	table_
 mysqld-bin.000001	#	Write_rows	2	#	table_id: #
 mysqld-bin.000001	#	Write_rows	2	#	table_id: # flags: STMT_END_F
 mysqld-bin.000001	#	Query	2	#	COMMIT
-mysqld-bin.000001	#	Query	1	#	drop database mysqltest
-mysqld-bin.000001	#	Query	1	#	use `test`; create table t1 (a int primary key) engine=ndb
+mysqld-bin.000001	#	Query	2	#	drop database mysqltest
+mysqld-bin.000001	#	Query	2	#	use `test`; create table t1 (a int primary key) engine=ndb
 drop table t2;
 reset master;
 reset master;
@@ -87,63 +87,63 @@ DROP LOGFILE GROUP lg1 
 ENGINE =NDB;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-mysqld-bin.000001	#	Query	1	#	CREATE LOGFILE GROUP lg1
+mysqld-bin.000001	#	Query	2	#	CREATE LOGFILE GROUP lg1
 ADD UNDOFILE 'undofile.dat'
 INITIAL_SIZE 16M
 UNDO_BUFFER_SIZE = 1M
 ENGINE=NDB
-mysqld-bin.000001	#	Query	1	#	ALTER LOGFILE GROUP lg1
+mysqld-bin.000001	#	Query	2	#	ALTER LOGFILE GROUP lg1
 ADD UNDOFILE 'undofile02.dat'
 INITIAL_SIZE = 4M 
 ENGINE=NDB
-mysqld-bin.000001	#	Query	1	#	CREATE TABLESPACE ts1
+mysqld-bin.000001	#	Query	2	#	CREATE TABLESPACE ts1
 ADD DATAFILE 'datafile.dat'
 USE LOGFILE GROUP lg1
 INITIAL_SIZE 12M
 ENGINE NDB
-mysqld-bin.000001	#	Query	1	#	ALTER TABLESPACE ts1
+mysqld-bin.000001	#	Query	2	#	ALTER TABLESPACE ts1
 ADD DATAFILE 'datafile02.dat'
 INITIAL_SIZE = 4M 
 ENGINE=NDB
-mysqld-bin.000001	#	Query	1	#	ALTER TABLESPACE ts1 
+mysqld-bin.000001	#	Query	2	#	ALTER TABLESPACE ts1 
 DROP DATAFILE 'datafile.dat' 
 ENGINE = NDB
-mysqld-bin.000001	#	Query	1	#	ALTER TABLESPACE ts1 
+mysqld-bin.000001	#	Query	2	#	ALTER TABLESPACE ts1 
 DROP DATAFILE 'datafile02.dat' 
 ENGINE = NDB
-mysqld-bin.000001	#	Query	1	#	DROP TABLESPACE ts1 
+mysqld-bin.000001	#	Query	2	#	DROP TABLESPACE ts1 
 ENGINE = NDB
-mysqld-bin.000001	#	Query	1	#	DROP LOGFILE GROUP lg1 
+mysqld-bin.000001	#	Query	2	#	DROP LOGFILE GROUP lg1 
 ENGINE =NDB
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-mysqld-bin.000001	#	Query	1	#	CREATE LOGFILE GROUP lg1
+mysqld-bin.000001	#	Query	2	#	CREATE LOGFILE GROUP lg1
 ADD UNDOFILE 'undofile.dat'
 INITIAL_SIZE 16M
 UNDO_BUFFER_SIZE = 1M
 ENGINE=NDB
-mysqld-bin.000001	#	Query	1	#	ALTER LOGFILE GROUP lg1
+mysqld-bin.000001	#	Query	2	#	ALTER LOGFILE GROUP lg1
 ADD UNDOFILE 'undofile02.dat'
 INITIAL_SIZE = 4M 
 ENGINE=NDB
-mysqld-bin.000001	#	Query	1	#	CREATE TABLESPACE ts1
+mysqld-bin.000001	#	Query	2	#	CREATE TABLESPACE ts1
 ADD DATAFILE 'datafile.dat'
 USE LOGFILE GROUP lg1
 INITIAL_SIZE 12M
 ENGINE NDB
-mysqld-bin.000001	#	Query	1	#	ALTER TABLESPACE ts1
+mysqld-bin.000001	#	Query	2	#	ALTER TABLESPACE ts1
 ADD DATAFILE 'datafile02.dat'
 INITIAL_SIZE = 4M 
 ENGINE=NDB
-mysqld-bin.000001	#	Query	1	#	ALTER TABLESPACE ts1 
+mysqld-bin.000001	#	Query	2	#	ALTER TABLESPACE ts1 
 DROP DATAFILE 'datafile.dat' 
 ENGINE = NDB
-mysqld-bin.000001	#	Query	1	#	ALTER TABLESPACE ts1 
+mysqld-bin.000001	#	Query	2	#	ALTER TABLESPACE ts1 
 DROP DATAFILE 'datafile02.dat' 
 ENGINE = NDB
-mysqld-bin.000001	#	Query	1	#	DROP TABLESPACE ts1 
+mysqld-bin.000001	#	Query	2	#	DROP TABLESPACE ts1 
 ENGINE = NDB
-mysqld-bin.000001	#	Query	1	#	DROP LOGFILE GROUP lg1 
+mysqld-bin.000001	#	Query	2	#	DROP LOGFILE GROUP lg1 
 ENGINE =NDB
 drop table t1;
 reset master;
@@ -158,13 +158,13 @@ create table t3 (a int key) engine=ndb;
 rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-mysqld-bin.000001	#	Query	1	#	use `test`; create table t1 (a int key) engine=ndb
-mysqld-bin.000001	#	Query	1	#	use `test`; create table t2 (a int key) engine=ndb
-mysqld-bin.000001	#	Query	1	#	use `test`; create table t3 (a int key) engine=ndb
-mysqld-bin.000001	#	Query	1	#	use `test`; rename table `test`.`t3` to `test`.`t4`
-mysqld-bin.000001	#	Query	1	#	use `test`; rename table `test`.`t2` to `test`.`t3`
-mysqld-bin.000001	#	Query	1	#	use `test`; rename table `test`.`t1` to `test`.`t2`
-mysqld-bin.000001	#	Query	1	#	use `test`; rename table `test`.`t4` to `test`.`t1`
+mysqld-bin.000001	#	Query	2	#	use `test`; create table t1 (a int key) engine=ndb
+mysqld-bin.000001	#	Query	2	#	use `test`; create table t2 (a int key) engine=ndb
+mysqld-bin.000001	#	Query	2	#	use `test`; create table t3 (a int key) engine=ndb
+mysqld-bin.000001	#	Query	2	#	use `test`; rename table `test`.`t3` to `test`.`t4`
+mysqld-bin.000001	#	Query	2	#	use `test`; rename table `test`.`t2` to `test`.`t3`
+mysqld-bin.000001	#	Query	2	#	use `test`; rename table `test`.`t1` to `test`.`t2`
+mysqld-bin.000001	#	Query	2	#	use `test`; rename table `test`.`t4` to `test`.`t1`
 drop table t1;
 drop table t2;
 drop table t3;
@@ -181,14 +181,14 @@ insert into t2 values(2);
 drop table t2;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-mysqld-bin.000001	#	Query	1	#	use `test`; create table t1 (a int key) engine=ndb
+mysqld-bin.000001	#	Query	2	#	use `test`; create table t1 (a int key) engine=ndb
 mysqld-bin.000001	#	Query	2	#	BEGIN
 mysqld-bin.000001	#	Table_map	2	#	table_id: # (test.t1)
 mysqld-bin.000001	#	Table_map	2	#	table_id: # (mysql.ndb_apply_status)
 mysqld-bin.000001	#	Write_rows	2	#	table_id: #
 mysqld-bin.000001	#	Write_rows	2	#	table_id: # flags: STMT_END_F
 mysqld-bin.000001	#	Query	2	#	COMMIT
-mysqld-bin.000001	#	Query	1	#	use `test`; rename table `test`.`t1` to `test`.`t2`
+mysqld-bin.000001	#	Query	2	#	use `test`; rename table `test`.`t1` to `test`.`t2`
 mysqld-bin.000001	#	Query	2	#	BEGIN
 mysqld-bin.000001	#	Table_map	2	#	table_id: # (test.t2)
 mysqld-bin.000001	#	Table_map	2	#	table_id: # (mysql.ndb_apply_status)

=== modified file 'mysql-test/suite/ndb_binlog/r/ndb_binlog_log_bin.result'
--- a/mysql-test/suite/ndb_binlog/r/ndb_binlog_log_bin.result	2009-02-01 21:05:19 +0000
+++ b/mysql-test/suite/ndb_binlog/r/ndb_binlog_log_bin.result	2009-09-11 10:34:36 +0000
@@ -53,10 +53,10 @@ use mysqltest;
 insert into t2 values (1,1);
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-mysqld-bin.000001	#	Query	1	#	use `mysqltest`; drop table `mysqltest`.`t1`
-mysqld-bin.000001	#	Query	1	#	use `mysqltest`; drop table `mysqltest`.`t2`
-mysqld-bin.000001	#	Query	1	#	use `mysqltest`; create table t1 (d int key, e int) engine=ndb
-mysqld-bin.000001	#	Query	1	#	use `mysqltest`; create table t2 (d int key, e int) engine=ndb
+mysqld-bin.000001	#	Query	2	#	use `mysqltest`; drop table `mysqltest`.`t1`
+mysqld-bin.000001	#	Query	2	#	use `mysqltest`; drop table `mysqltest`.`t2`
+mysqld-bin.000001	#	Query	2	#	use `mysqltest`; create table t1 (d int key, e int) engine=ndb
+mysqld-bin.000001	#	Query	2	#	use `mysqltest`; create table t2 (d int key, e int) engine=ndb
 mysqld-bin.000001	#	Query	2	#	BEGIN
 mysqld-bin.000001	#	Table_map	2	#	table_id: # (mysqltest.t1)
 mysqld-bin.000001	#	Table_map	2	#	table_id: # (mysql.ndb_apply_status)

=== modified file 'mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result'
--- a/mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result	2009-02-01 21:05:19 +0000
+++ b/mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result	2009-09-11 10:34:36 +0000
@@ -30,7 +30,7 @@ a	b
 DROP TABLE t2;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-mysqld-bin.000001	#	Query	2	#	use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
+mysqld-bin.000001	#	Query	1	#	use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
 mysqld-bin.000001	#	Query	1	#	BEGIN
 mysqld-bin.000001	#	Table_map	1	#	table_id: # (test.t2)
 mysqld-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result	2008-03-14 14:42:27 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result	2009-09-11 10:34:36 +0000
@@ -56,6 +56,31 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Slave Binlog contains all ops as log_slave_updates is on
+show variables like 'server_id';
+Variable_name	Value
+server_id	2
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	ON
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	2	#	use `test`; CREATE TABLE t1 (a int key, b int) ENGINE=ndb
+slave-bin.000001	#	Query	2	#	BEGIN
+slave-bin.000001	#	Table_map	2	#	table_id: # (test.t1)
+slave-bin.000001	#	Table_map	2	#	table_id: # (mysql.ndb_apply_status)
+slave-bin.000001	#	Write_rows	2	#	table_id: #
+slave-bin.000001	#	Write_rows	2	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	2	#	COMMIT
+slave-bin.000001	#	Query	2	#	BEGIN
+slave-bin.000001	#	Table_map	2	#	table_id: # (test.t1)
+slave-bin.000001	#	Table_map	2	#	table_id: # (mysql.ndb_apply_status)
+slave-bin.000001	#	Write_rows	2	#	table_id: #
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	2	#	COMMIT
 SELECT * FROM t1 ORDER BY a;
 a	b
 1	2
@@ -99,5 +124,23 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Master Binlog contains only Master ops as log_slave_updates is off
+show variables like 'server_id';
+Variable_name	Value
+server_id	1
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
+master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	1	#	table_id: #
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	COMMIT
 STOP SLAVE;
 DROP TABLE t1;

=== added file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu.result	2009-09-11 10:34:36 +0000
@@ -0,0 +1,819 @@
+*** Configuring connections ***
+*** Configuring replication via Slave ***
+STOP SLAVE;
+USE test;
+RESET MASTER;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=MASTER_PORT,MASTER_USER="root";;
+START SLAVE;
+*** Generating slave cluster originated binloggable changes ***
+CREATE TABLE BUG_45756_SLAVE_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_1;
+CREATE TABLE BUG_45756_SLAVE_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_2;
+CREATE TABLE BUG_45756_SLAVE_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_3;
+***Generating slave cluster non-binloggable changes***
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_1;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_2;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_3;
+SET SQL_LOG_BIN= 1;
+*** Generating data to be replicated ***
+CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_1;
+CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_2;
+CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_3;
+*** Generating changes not to be replicated ***
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_1;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_2;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_3;
+SET SQL_LOG_BIN= 1;
+*** Checking binlog contents on every server in both clusters ***
+
+
+
+connection srv_master;
+show variables like 'server_id';
+Variable_name	Value
+server_id	1
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_MASTER_LOGGED_1)
+master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	1	#	table_id: #
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	COMMIT
+master-bin.000001	#	Query	1	#	use `test`; DROP TABLE BUG_45756_MASTER_LOGGED_1
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_MASTER_LOGGED_2)
+master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	1	#	table_id: #
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	COMMIT
+master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_2`
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_MASTER_LOGGED_3)
+master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	1	#	table_id: #
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	COMMIT
+master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_3`
+
+
+
+connection srv_master1;
+show variables like 'server_id';
+Variable_name	Value
+server_id	2
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	OFF
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_master2;
+show variables like 'server_id';
+Variable_name	Value
+server_id	3
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_MASTER_LOGGED_1)
+master-bin.000001	#	Table_map	3	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	3	#	table_id: #
+master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	3	#	COMMIT
+master-bin.000001	#	Query	3	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_1`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_MASTER_LOGGED_2)
+master-bin.000001	#	Table_map	3	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	3	#	table_id: #
+master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	3	#	COMMIT
+master-bin.000001	#	Query	3	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_2`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_MASTER_LOGGED_3)
+master-bin.000001	#	Table_map	3	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	3	#	table_id: #
+master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	3	#	COMMIT
+master-bin.000001	#	Query	3	#	use `test`; DROP TABLE BUG_45756_MASTER_LOGGED_3
+
+
+
+connection srv_slave;
+show variables like 'server_id';
+Variable_name	Value
+server_id	4
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	OFF
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_slave1;
+show variables like 'server_id';
+Variable_name	Value
+server_id	5
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-master-bin.000001	#	Query	5	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	5	#	BEGIN
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_1)
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	5	#	table_id: #
+slave-master-bin.000001	#	Write_rows	5	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	5	#	COMMIT
+slave-master-bin.000001	#	Query	5	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_1`
+slave-master-bin.000001	#	Query	5	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	5	#	BEGIN
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_2)
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	5	#	table_id: #
+slave-master-bin.000001	#	Write_rows	5	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	5	#	COMMIT
+slave-master-bin.000001	#	Query	5	#	use `test`; DROP TABLE BUG_45756_SLAVE_LOGGED_2
+slave-master-bin.000001	#	Query	5	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	5	#	BEGIN
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_3)
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	5	#	table_id: #
+slave-master-bin.000001	#	Write_rows	5	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	5	#	COMMIT
+slave-master-bin.000001	#	Query	5	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_3`
+
+
+
+connection srv_slave2;
+show variables like 'server_id';
+Variable_name	Value
+server_id	6
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	ON
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-master-bin.000001	#	Query	6	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_1)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	6	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	6	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_1`
+slave-master-bin.000001	#	Query	6	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_2)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	6	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	6	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_2`
+slave-master-bin.000001	#	Query	6	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_3)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	6	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	6	#	use `test`; DROP TABLE BUG_45756_SLAVE_LOGGED_3
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_MASTER_LOGGED_1)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_1`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_MASTER_LOGGED_2)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_2`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_MASTER_LOGGED_3)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_3`
+*** Configuring replication via Slave1 ***
+STOP SLAVE;
+STOP SLAVE;
+USE test;
+RESET MASTER;
+RESET MASTER;
+RESET MASTER;
+RESET MASTER;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=MASTER_PORT,MASTER_USER="root";
+START SLAVE;
+*** Generating slave cluster originated binloggable changes ***
+CREATE TABLE BUG_45756_SLAVE_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_1;
+CREATE TABLE BUG_45756_SLAVE_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_2;
+CREATE TABLE BUG_45756_SLAVE_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_3;
+***Generating slave cluster non-binloggable changes***
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_1;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_2;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_3;
+SET SQL_LOG_BIN= 1;
+*** Generating data to be replicated ***
+CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_1;
+CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_2;
+CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_3;
+*** Generating changes not to be replicated ***
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_1;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_2;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_3;
+SET SQL_LOG_BIN= 1;
+*** Checking binlog contents on every server in both clusters ***
+
+
+
+connection srv_master;
+show variables like 'server_id';
+Variable_name	Value
+server_id	1
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_MASTER_LOGGED_1)
+master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	1	#	table_id: #
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	COMMIT
+master-bin.000001	#	Query	1	#	use `test`; DROP TABLE BUG_45756_MASTER_LOGGED_1
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_MASTER_LOGGED_2)
+master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	1	#	table_id: #
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	COMMIT
+master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_2`
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_MASTER_LOGGED_3)
+master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	1	#	table_id: #
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	COMMIT
+master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_3`
+
+
+
+connection srv_master1;
+show variables like 'server_id';
+Variable_name	Value
+server_id	2
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	OFF
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_master2;
+show variables like 'server_id';
+Variable_name	Value
+server_id	3
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_MASTER_LOGGED_1)
+master-bin.000001	#	Table_map	3	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	3	#	table_id: #
+master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	3	#	COMMIT
+master-bin.000001	#	Query	3	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_1`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_MASTER_LOGGED_2)
+master-bin.000001	#	Table_map	3	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	3	#	table_id: #
+master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	3	#	COMMIT
+master-bin.000001	#	Query	3	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_2`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_MASTER_LOGGED_3)
+master-bin.000001	#	Table_map	3	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	3	#	table_id: #
+master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	3	#	COMMIT
+master-bin.000001	#	Query	3	#	use `test`; DROP TABLE BUG_45756_MASTER_LOGGED_3
+
+
+
+connection srv_slave;
+show variables like 'server_id';
+Variable_name	Value
+server_id	4
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	OFF
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_slave1;
+show variables like 'server_id';
+Variable_name	Value
+server_id	5
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-master-bin.000001	#	Query	5	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	5	#	BEGIN
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_1)
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	5	#	table_id: #
+slave-master-bin.000001	#	Write_rows	5	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	5	#	COMMIT
+slave-master-bin.000001	#	Query	5	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_1`
+slave-master-bin.000001	#	Query	5	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	5	#	BEGIN
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_2)
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	5	#	table_id: #
+slave-master-bin.000001	#	Write_rows	5	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	5	#	COMMIT
+slave-master-bin.000001	#	Query	5	#	use `test`; DROP TABLE BUG_45756_SLAVE_LOGGED_2
+slave-master-bin.000001	#	Query	5	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	5	#	BEGIN
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_3)
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	5	#	table_id: #
+slave-master-bin.000001	#	Write_rows	5	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	5	#	COMMIT
+slave-master-bin.000001	#	Query	5	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_3`
+
+
+
+connection srv_slave2;
+show variables like 'server_id';
+Variable_name	Value
+server_id	6
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	ON
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-master-bin.000001	#	Query	6	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_1)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	6	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	6	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_1`
+slave-master-bin.000001	#	Query	6	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_2)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	6	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	6	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_2`
+slave-master-bin.000001	#	Query	6	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_3)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	6	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	6	#	use `test`; DROP TABLE BUG_45756_SLAVE_LOGGED_3
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_MASTER_LOGGED_1)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_1`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_MASTER_LOGGED_2)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_2`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_MASTER_LOGGED_3)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_3`
+*** Configuring replication via Slave2 ***
+STOP SLAVE;
+STOP SLAVE;
+USE test;
+RESET MASTER;
+RESET MASTER;
+RESET MASTER;
+RESET MASTER;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=MASTER_PORT,MASTER_USER="root";;
+START SLAVE;
+*** Generating slave cluster originated binloggable changes ***
+CREATE TABLE BUG_45756_SLAVE_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_1;
+CREATE TABLE BUG_45756_SLAVE_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_2;
+CREATE TABLE BUG_45756_SLAVE_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_LOGGED_3;
+***Generating slave cluster non-binloggable changes***
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_1;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_2;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_SLAVE_NOT_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_SLAVE_NOT_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_SLAVE_NOT_LOGGED_3;
+SET SQL_LOG_BIN= 1;
+*** Generating data to be replicated ***
+CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_1;
+CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_2;
+CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_MASTER_LOGGED_3;
+*** Generating changes not to be replicated ***
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_1 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_1 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_1;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_2 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_2 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_2;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_MASTER_NOT_LOGGED_3 (a int) engine = NDB;
+INSERT INTO BUG_45756_MASTER_NOT_LOGGED_3 VALUES (1);
+DROP TABLE BUG_45756_MASTER_NOT_LOGGED_3;
+SET SQL_LOG_BIN= 1;
+*** Checking binlog contents on every server in both clusters ***
+
+
+
+connection srv_master;
+show variables like 'server_id';
+Variable_name	Value
+server_id	1
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_MASTER_LOGGED_1)
+master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	1	#	table_id: #
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	COMMIT
+master-bin.000001	#	Query	1	#	use `test`; DROP TABLE BUG_45756_MASTER_LOGGED_1
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_MASTER_LOGGED_2)
+master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	1	#	table_id: #
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	COMMIT
+master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_2`
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_MASTER_LOGGED_3)
+master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	1	#	table_id: #
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	COMMIT
+master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_3`
+
+
+
+connection srv_master1;
+show variables like 'server_id';
+Variable_name	Value
+server_id	2
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	OFF
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_master2;
+show variables like 'server_id';
+Variable_name	Value
+server_id	3
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_MASTER_LOGGED_1)
+master-bin.000001	#	Table_map	3	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	3	#	table_id: #
+master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	3	#	COMMIT
+master-bin.000001	#	Query	3	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_1`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_MASTER_LOGGED_2)
+master-bin.000001	#	Table_map	3	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	3	#	table_id: #
+master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	3	#	COMMIT
+master-bin.000001	#	Query	3	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_2`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_MASTER_LOGGED_3)
+master-bin.000001	#	Table_map	3	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	3	#	table_id: #
+master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	3	#	COMMIT
+master-bin.000001	#	Query	3	#	use `test`; DROP TABLE BUG_45756_MASTER_LOGGED_3
+
+
+
+connection srv_slave;
+show variables like 'server_id';
+Variable_name	Value
+server_id	4
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	OFF
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_slave1;
+show variables like 'server_id';
+Variable_name	Value
+server_id	5
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	OFF
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-master-bin.000001	#	Query	5	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	5	#	BEGIN
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_1)
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	5	#	table_id: #
+slave-master-bin.000001	#	Write_rows	5	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	5	#	COMMIT
+slave-master-bin.000001	#	Query	5	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_1`
+slave-master-bin.000001	#	Query	5	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	5	#	BEGIN
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_2)
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	5	#	table_id: #
+slave-master-bin.000001	#	Write_rows	5	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	5	#	COMMIT
+slave-master-bin.000001	#	Query	5	#	use `test`; DROP TABLE BUG_45756_SLAVE_LOGGED_2
+slave-master-bin.000001	#	Query	5	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	5	#	BEGIN
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_3)
+slave-master-bin.000001	#	Table_map	5	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	5	#	table_id: #
+slave-master-bin.000001	#	Write_rows	5	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	5	#	COMMIT
+slave-master-bin.000001	#	Query	5	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_3`
+
+
+
+connection srv_slave2;
+show variables like 'server_id';
+Variable_name	Value
+server_id	6
+show variables like 'log_bin';
+Variable_name	Value
+log_bin	ON
+show variables like 'log_slave_updates';
+Variable_name	Value
+log_slave_updates	ON
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-master-bin.000001	#	Query	6	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_1)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	6	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	6	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_1`
+slave-master-bin.000001	#	Query	6	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_2)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	6	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	6	#	use `test`; drop table `test`.`BUG_45756_SLAVE_LOGGED_2`
+slave-master-bin.000001	#	Query	6	#	use `test`; CREATE TABLE BUG_45756_SLAVE_LOGGED_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_SLAVE_LOGGED_3)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	6	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	6	#	use `test`; DROP TABLE BUG_45756_SLAVE_LOGGED_3
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_MASTER_LOGGED_1)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; DROP TABLE BUG_45756_MASTER_LOGGED_1
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_MASTER_LOGGED_2)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_2`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_MASTER_LOGGED_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.BUG_45756_MASTER_LOGGED_3)
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	6	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	6	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_MASTER_LOGGED_3`

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test	2008-03-14 14:42:27 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test	2009-09-11 10:34:36 +0000
@@ -42,6 +42,13 @@ SELECT * FROM t1 ORDER BY a;
 # BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36
 --replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
 --query_vertical show slave status;
+
+--echo Slave Binlog contains all ops as log_slave_updates is on
+show variables like 'server_id';
+show variables like 'log_bin';
+show variables like 'log_slave_updates';
+--source include/show_binlog_events2.inc
+
 # connect to master and ensure data it there.
 --connection master
 SELECT * FROM t1 ORDER BY a;
@@ -50,6 +57,12 @@ SELECT * FROM t1 ORDER BY a;
 --replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
 --query_vertical show slave status;
 
+--echo Master Binlog contains only Master ops as log_slave_updates is off
+show variables like 'server_id';
+show variables like 'log_bin';
+show variables like 'log_slave_updates';
+--source include/show_binlog_events2.inc
+
 # stop replication on "master" as not to replicate
 # shutdown circularly, eg drop table
 --connection master

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf	2008-10-31 14:11:44 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf	2009-09-11 10:34:36 +0000
@@ -1,16 +1,27 @@
 !include ../my.cnf
 
+# 2 clusters, each with 2 MySQLDs
+# All MySQLDs log-slave-updates
+# Potential infinite loops are broken by both servers 
+# on each cluster having the same server-id
+# To support > 2 clusters and/or different server-ids per
+# MySQLD server, we need some other loop breaking 
+# mechanism 
+
 [mysqld.1.1]
 server-id= 1
 log-bin
+log-slave-updates
 
 [mysqld.2.1]
 server-id= 1
 log-bin
+log-slave-updates
 
 [mysqld.1.slave]
 server-id= 2
 log-bin
+log-slave-updates
 skip-slave-start
 
 [mysqld.2.slave]
@@ -22,6 +33,7 @@ master-user=		@mysqld.2.1.#user
 master-connect-retry=	1
 init-rpl-role=		slave
 log-bin
+log-slave-updates
 skip-slave-start
 ndb_connectstring=	@mysql_cluster.slave.ndb_connectstring
 

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu.cnf'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu.cnf	2009-09-11 10:34:36 +0000
@@ -0,0 +1 @@
+!include extra/rpl_tests/rpl_ndb_multi_binlog_update.cnf

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu.test	2009-09-11 10:34:36 +0000
@@ -0,0 +1,151 @@
+###############################################################################
+# Description: Checks if DDL and DML statements are correctly logged by
+#              servers and slave servers according to log-slave-updates,
+#              and independent of their settings on the particular MySQLD
+#              acting in the slave role
+#
+# Testing scenario: Cluster 1 replicates to Cluster 2
+#   Key : BL = log-bin, LSU = log-slave-updates
+#
+#                       BL                        BL
+#  cluster 1 [  srv_master  srv_master1  srv_master2  ]
+#                   |----------+------------
+#                   v          v           v
+#  cluster 2 [  srv_slave  srv_slave1  srv_slave2 ]
+#                                  BL     BL LSU  
+#
+#  - First replicate via srv_slave and check all nodes' Binlog contents
+#  - Second replicate via srv_slave1 and check all nodes' Binlog contents
+#  - Third replicate via srv_slave2 and check all nodes' Binlog contents
+#
+# Makes use of extra/rpl_tests/rpl_ndb_multi_binlog_update.test
+# Originally motivated by bug#45756
+###############################################################################
+
+--source include/have_ndb.inc
+--source include/have_log_bin.inc
+
+###############################################################################
+#                           Configuring Environment
+###############################################################################
+--echo *** Configuring connections ***
+
+connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
+connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
+
+connect (srv_master,127.0.0.1,root,,test,$MASTER_MYPORT,);
+connect (srv_master1,127.0.0.1,root,,test,$MASTER_MYPORT1,);
+connect (srv_master2,127.0.0.1,root,,test,$MASTER_MYPORT2,);
+connect (srv_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
+connect (srv_slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
+connect (srv_slave2,127.0.0.1,root,,test,$SLAVE_MYPORT2,);
+
+--echo *** Configuring replication via Slave ***
+connection slave;
+--disable_warnings
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+--enable_warnings
+
+connection master;
+--disable_warnings
+USE test;
+RESET MASTER;
+--enable_warnings
+
+connection slave;
+--disable_warnings
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--eval CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=$MASTER_MYPORT,MASTER_USER="root";
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+--enable_warnings
+
+--let $which_slave=srv_slave
+--source extra/rpl_tests/rpl_ndb_multi_binlog_update.test
+
+
+
+--echo *** Configuring replication via Slave1 ***
+connection slave;
+--disable_warnings
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+--enable_warnings
+
+connection srv_slave1;
+--disable_warnings
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+--enable_warnings
+
+# Reset state of all Binlogging nodes
+connection master;
+--disable_warnings
+USE test;
+RESET MASTER;
+--enable_warnings
+
+connection srv_master2;
+RESET MASTER;
+
+connection srv_slave1;
+RESET MASTER;
+
+connection srv_slave2;
+RESET MASTER;
+
+connection srv_slave1;
+--disable_warnings
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--eval CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=$MASTER_MYPORT,MASTER_USER="root"
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+--enable_warnings
+
+--let $which_slave=srv_slave1
+--source extra/rpl_tests/rpl_ndb_multi_binlog_update.test
+
+
+
+--echo *** Configuring replication via Slave2 ***
+connection srv_slave1;
+--disable_warnings
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+--enable_warnings
+
+connection srv_slave2;
+--disable_warnings
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+--enable_warnings
+
+connection master;
+--disable_warnings
+USE test;
+RESET MASTER;
+--enable_warnings
+
+connection srv_master2;
+RESET MASTER;
+
+connection srv_slave1;
+RESET MASTER;
+
+connection srv_slave2;
+RESET MASTER;
+
+connection srv_slave2;
+--disable_warnings
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--eval CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=$MASTER_MYPORT,MASTER_USER="root";
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+--enable_warnings
+
+--let $which_slave=srv_slave2
+--source extra/rpl_tests/rpl_ndb_multi_binlog_update.test

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2009-08-25 19:44:04 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2009-09-11 10:34:36 +0000
@@ -1996,10 +1996,34 @@ int ndbcluster_log_schema_op(THD *thd,
       r|= op->setValue(SCHEMA_TYPE_I, log_type);
       DBUG_ASSERT(r == 0);
       /* any value */
-      if (!(thd->options & OPTION_BIN_LOG))
-        r|= op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING);
+      Uint32 anyValue;
+      if (! thd->slave_thread)
+      {
+        /* Schema change originating from this MySQLD, check SQL_LOG_BIN
+         * variable and pass 'setting' to all logging MySQLDs via AnyValue  
+         */
+        if (thd->options & OPTION_BIN_LOG) /* e.g. SQL_LOG_BIN == on */
+        {
+          DBUG_PRINT("info", ("Schema event for binlogging"));
+          anyValue = 0;
+        }
+        else
+        {
+          DBUG_PRINT("info", ("Schema event not for binlogging")); 
+          anyValue = NDB_ANYVALUE_FOR_NOLOGGING;
+        }
+      }
       else
-        r|= op->setAnyValue(thd->server_id);
+      {
+        /* Slave applying replicated schema event
+         * Pass original applier's serverId in AnyValue
+         */
+        DBUG_PRINT("info", ("Replicated schema event with original server id %d",
+                            thd->server_id));
+        anyValue = thd->server_id;
+      }
+
+      r|= op->setAnyValue(anyValue);
       DBUG_ASSERT(r == 0);
 #if 0
       if (log_db != new_db && new_db && new_table_name)
@@ -2242,14 +2266,34 @@ ndb_handle_schema_change(THD *thd, Ndb *
 
 static void ndb_binlog_query(THD *thd, Cluster_schema *schema)
 {
-  if (schema->any_value & NDB_ANYVALUE_RESERVED)
+  /* any_value == 0 means local cluster sourced change that
+   * should be logged
+   */
+  if (schema->any_value != 0)
   {
-    if (schema->any_value != NDB_ANYVALUE_FOR_NOLOGGING)
-      sql_print_warning("NDB: unknown value for binlog signalling 0x%X, "
-                        "query not logged",
-                        schema->any_value);
-    return;
+    if (schema->any_value & NDB_ANYVALUE_RESERVED)
+    {
+      /* Originating SQL node did not want this query logged */
+      if (schema->any_value != NDB_ANYVALUE_FOR_NOLOGGING)
+        sql_print_warning("NDB: unknown value for binlog signalling 0x%X, "
+                          "query not logged",
+                          schema->any_value);
+      return;
+    }
+    else 
+    {
+      /* AnyValue is set to non-zero serverId, must be a query applied
+       * by a slave mysqld.
+       * TODO : Assert that we are running in the Binlog injector thread?
+       */
+      if (! g_ndb_log_slave_updates)
+      {
+        /* This MySQLD does not log slave updates */
+        return;
+      }
+    }
   }
+
   uint32 thd_server_id_save= thd->server_id;
   DBUG_ASSERT(sizeof(thd_server_id_save) == sizeof(thd->server_id));
   char *thd_db_save= thd->db;
@@ -5051,6 +5095,7 @@ restart:
     if (unlikely(schema_res > 0))
     {
       thd->proc_info= "Processing events from schema table";
+      g_ndb_log_slave_updates= opt_log_slave_updates;
       s_ndb->
         setReportThreshEventGCISlip(ndb_report_thresh_binlog_epoch_slip);
       s_ndb->

Thread
bzr commit into mysql-5.1-telco-6.2 branch (frazer:2993) Bug#45756Frazer Clement11 Sep