List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:September 3 2009 4:54pm
Subject:bzr commit into mysql-5.1-telco-6.2 branch (alfranio.correia:2976)
Bug#45756
View as plain text  
#At file:///home/acorreia/workspace.sun/repository.mysql/bzrwork/bug-45756/mysql-5.1-telco-6.2/ based on revid:jonas@stripped

 2976 Alfranio Correia	2009-09-03
      BUG#45756 DDL statements not always in binary logs of other SQL Nodes on slave cluster

    added:
      mysql-test/extra/rpl_tests/rpl_ndb_bug_45756.cnf
      mysql-test/extra/rpl_tests/rpl_ndb_bug_45756.test
      mysql-test/suite/rpl_ndb/r/rpl_ndb_slave.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_binlog.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_binlog_update.result
      mysql-test/suite/rpl_ndb/t/rpl_ndb_slave.cnf
      mysql-test/suite/rpl_ndb/t/rpl_ndb_slave.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog.cnf
      mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog_update.cnf
      mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog_update.test
    modified:
      sql/ha_ndbcluster_binlog.cc
=== added file 'mysql-test/extra/rpl_tests/rpl_ndb_bug_45756.cnf'
--- a/mysql-test/extra/rpl_tests/rpl_ndb_bug_45756.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_ndb_bug_45756.cnf	2009-09-03 16:54:09 +0000
@@ -0,0 +1,147 @@
+[cluster_config]
+MaxNoOfSavedMessages=          1000
+MaxNoOfConcurrentTransactions= 128
+MaxNoOfConcurrentOperations=   10000
+DataMemory=                    20M
+IndexMemory=                   1M
+Diskless=                      0
+TimeBetweenWatchDogCheck=      30000
+MaxNoOfOrderedIndexes=         32
+MaxNoOfAttributes=             2048
+TimeBetweenGlobalCheckpoints=  500
+NoOfFragmentLogFiles=          4
+FragmentLogFileSize=           12M
+DiskPageBufferMemory=          4M
+InitialNoOfOpenFiles= 27
+HeartbeatIntervalDbDb=         30000
+HeartbeatIntervalDbApi=        30000
+
+
+
+[cluster_config.1]
+NoOfReplicas=                  3
+ndbd=,,
+ndb_mgmd=
+mysqld=,,
+
+
+
+[cluster_config.slave]
+NoOfReplicas=                  4
+ndbd=,,,
+ndb_mgmd=
+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
+
+
+[mysqld.3.1]
+server-id= 3
+log-bin= master-bin
+binlog_format=row
+
+
+
+
+[mysqld.1.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
+relay-log= slave-relay-bin
+rpl-recovery-rank= @mysqld.1.slave.server-id
+
+master-host= 127.0.0.1
+master-port= @mysqld.1.1.port
+master-password= @mysqld.1.1.#password
+master-user= @mysqld.1.1.#user
+master-connect-retry= 1
+master-retry-count= 10
+report-host= 127.0.0.1
+report-port= @mysqld.1.slave.port
+report-user= root
+
+
+
+[mysqld.2.slave]
+server-id= 5
+init-rpl-role= slave
+skip-slave-start
+loose-skip-innodb
+slave-load-tmpdir= ../../../tmp
+ndb_connectstring= @mysql_cluster.slave.ndb_connectstring
+
+
+
+[mysqld.3.slave]
+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
+
+
+
+[mysqld.4.slave]
+server-id= 7
+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
+SLAVE_MYPORT3= @mysqld.4.slave.port
+SLAVE_MYSOCK3= @mysqld.4.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_bug_45756.test'
--- a/mysql-test/extra/rpl_tests/rpl_ndb_bug_45756.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_ndb_bug_45756.test	2009-09-03 16:54:09 +0000
@@ -0,0 +1,172 @@
+###############################################################################
+# Description: Checks if DDL statements are correctly replicated among servers
+# with different configurations as described in what follows.
+# 
+# Testing scenario: Cluster 1 replicates to Cluster 2
+#
+#  cluster 1 [  srv_master  srv_master1  srv_master2  ]
+#                   |
+#                   v
+#  cluster 2 [  srv_slave  srv_slave1  srv_slave2  srv_slave3 ]
+#
+#  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 master.
+#    Identification: connection (srv_master2), config (mysqld.1.3).
+#
+#  Cluster 2:
+#  - MySQLD1 as slave varying log_bin and log_slave_updates.
+#    Identification: connection (srv_slave), config (mysqld.1.slave).
+#  - MySQLD2 binlogging with log_slave_updates off
+#    Identification: connection (srv_slave1), config (mysqld.2.slave).
+#  - MySQLD3 binlogging with log_slave_updates on
+#    Identification: connection (srv_slave2), config (mysqld.3.slave).
+#  - MySQLD4 with no binlogging
+#    Identification: connection (srv_slave3), config (mysqld.4.slave).
+###############################################################################
+
+--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,);
+connect (srv_slave3,127.0.0.1,root,,test,$SLAVE_MYPORT3,);
+
+--echo *** Configuring replication ***
+connection slave;
+--disable_warnings
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+--enable_warnings
+connection master;
+--disable_warnings
+--disable_query_log
+USE test;
+--enable_query_log
+SET SQL_LOG_BIN= 0;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+SET SQL_LOG_BIN= 1;
+--enable_warnings
+RESET MASTER;
+--disable_query_log
+RESET SLAVE;
+--enable_query_log
+connection slave;
+RESET SLAVE;
+--disable_warnings
+SET SQL_LOG_BIN= 0;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+SET SQL_LOG_BIN= 1;
+--enable_warnings
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+
+###############################################################################
+#                            Checking Replication
+###############################################################################
+--echo *** Generating data to be replicated ***
+connection srv_master;
+CREATE TABLE BUG_45756_01 (a int) engine = NDB;
+INSERT INTO BUG_45756_01 VALUES (1);
+DROP TABLE BUG_45756_01;
+
+connection srv_master1;
+CREATE TABLE BUG_45756_02 (a int) engine = NDB;
+INSERT INTO BUG_45756_02 VALUES (1);
+DROP TABLE BUG_45756_02;
+
+connection srv_master2;
+CREATE TABLE BUG_45756_03 (a int) engine = NDB;
+INSERT INTO BUG_45756_03 VALUES (1);
+DROP TABLE BUG_45756_03;
+
+connection srv_master;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_04 (a int) engine = NDB;
+INSERT INTO BUG_45756_04 VALUES (1);
+DROP TABLE BUG_45756_04;
+SET SQL_LOG_BIN= 1;
+
+connection srv_master1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_05 (a int) engine = NDB;
+INSERT INTO BUG_45756_05 VALUES (1);
+DROP TABLE BUG_45756_05;
+SET SQL_LOG_BIN= 1;
+
+connection srv_master2;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_06 (a int) engine = NDB;
+INSERT INTO BUG_45756_06 VALUES (1);
+DROP TABLE BUG_45756_06;
+SET SQL_LOG_BIN= 1;
+
+connection srv_master;
+sync_slave_with_master;
+
+--echo *** Checking replicated data on every sever in both clusters ***
+connection srv_master;
+--echo 
+--echo 
+--echo 
+--echo connection srv_master;
+--source include/show_binlog_events2.inc
+
+connection srv_master1;
+--echo 
+--echo 
+--echo 
+--echo connection srv_master1;
+--source include/show_binlog_events2.inc
+
+connection srv_master2;
+--echo 
+--echo 
+--echo 
+--echo connection srv_master2;
+--source include/show_binlog_events2.inc
+
+connection srv_slave;
+--echo 
+--echo 
+--echo 
+--echo connection srv_slave;
+--source include/show_binlog_events2.inc
+
+connection srv_slave1;
+--echo 
+--echo 
+--echo 
+--echo connection srv_slave1;
+--source include/show_binlog_events2.inc
+
+connection srv_slave2;
+--echo 
+--echo 
+--echo 
+--echo connection srv_slave2;
+--source include/show_binlog_events2.inc
+
+connection srv_slave3;
+--echo 
+--echo 
+--echo 
+--echo connection srv_slave3;
+--source include/show_binlog_events2.inc

=== added file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_slave.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave.result	2009-09-03 16:54:09 +0000
@@ -0,0 +1,152 @@
+*** Configuring connections ***
+*** Configuring replication ***
+STOP SLAVE;
+SET SQL_LOG_BIN= 0;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+SET SQL_LOG_BIN= 1;
+RESET MASTER;
+RESET SLAVE;
+SET SQL_LOG_BIN= 0;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+SET SQL_LOG_BIN= 1;
+START SLAVE;
+*** Generating data to be replicated ***
+CREATE TABLE BUG_45756_01 (a int) engine = NDB;
+INSERT INTO BUG_45756_01 VALUES (1);
+DROP TABLE BUG_45756_01;
+CREATE TABLE BUG_45756_02 (a int) engine = NDB;
+INSERT INTO BUG_45756_02 VALUES (1);
+DROP TABLE BUG_45756_02;
+CREATE TABLE BUG_45756_03 (a int) engine = NDB;
+INSERT INTO BUG_45756_03 VALUES (1);
+DROP TABLE BUG_45756_03;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_04 (a int) engine = NDB;
+INSERT INTO BUG_45756_04 VALUES (1);
+DROP TABLE BUG_45756_04;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_05 (a int) engine = NDB;
+INSERT INTO BUG_45756_05 VALUES (1);
+DROP TABLE BUG_45756_05;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_06 (a int) engine = NDB;
+INSERT INTO BUG_45756_06 VALUES (1);
+DROP TABLE BUG_45756_06;
+SET SQL_LOG_BIN= 1;
+*** Checking replicated data on every sever in both clusters ***
+
+
+
+connection srv_master;
+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_01 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_01)
+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_01
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_02 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_02)
+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_02`
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_03 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_03)
+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_03`
+
+
+
+connection srv_master1;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_master2;
+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_01 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_01)
+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_01`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_02 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_02)
+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_02`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_03 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_03)
+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_03
+
+
+
+connection srv_slave;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_slave1;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_slave2;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_slave3;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_01 (a int) engine = NDB
+slave-master-bin.000001	#	Query	7	#	BEGIN
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (test.BUG_45756_01)
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	7	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	7	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_01`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_02 (a int) engine = NDB
+slave-master-bin.000001	#	Query	7	#	BEGIN
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (test.BUG_45756_02)
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	7	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	7	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_02`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_03 (a int) engine = NDB
+slave-master-bin.000001	#	Query	7	#	BEGIN
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (test.BUG_45756_03)
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	7	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	7	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_03`

=== added file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_binlog.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_binlog.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_binlog.result	2009-09-03 16:54:09 +0000
@@ -0,0 +1,152 @@
+*** Configuring connections ***
+*** Configuring replication ***
+STOP SLAVE;
+SET SQL_LOG_BIN= 0;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+SET SQL_LOG_BIN= 1;
+RESET MASTER;
+RESET SLAVE;
+SET SQL_LOG_BIN= 0;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+SET SQL_LOG_BIN= 1;
+START SLAVE;
+*** Generating data to be replicated ***
+CREATE TABLE BUG_45756_01 (a int) engine = NDB;
+INSERT INTO BUG_45756_01 VALUES (1);
+DROP TABLE BUG_45756_01;
+CREATE TABLE BUG_45756_02 (a int) engine = NDB;
+INSERT INTO BUG_45756_02 VALUES (1);
+DROP TABLE BUG_45756_02;
+CREATE TABLE BUG_45756_03 (a int) engine = NDB;
+INSERT INTO BUG_45756_03 VALUES (1);
+DROP TABLE BUG_45756_03;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_04 (a int) engine = NDB;
+INSERT INTO BUG_45756_04 VALUES (1);
+DROP TABLE BUG_45756_04;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_05 (a int) engine = NDB;
+INSERT INTO BUG_45756_05 VALUES (1);
+DROP TABLE BUG_45756_05;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_06 (a int) engine = NDB;
+INSERT INTO BUG_45756_06 VALUES (1);
+DROP TABLE BUG_45756_06;
+SET SQL_LOG_BIN= 1;
+*** Checking replicated data on every sever in both clusters ***
+
+
+
+connection srv_master;
+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_01 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_01)
+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_01
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_02 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_02)
+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_02`
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_03 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_03)
+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_03`
+
+
+
+connection srv_master1;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_master2;
+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_01 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_01)
+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_01`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_02 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_02)
+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_02`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_03 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_03)
+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_03
+
+
+
+connection srv_slave;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_slave1;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_slave2;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_slave3;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_01 (a int) engine = NDB
+slave-master-bin.000001	#	Query	7	#	BEGIN
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (test.BUG_45756_01)
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	7	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	7	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_01`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_02 (a int) engine = NDB
+slave-master-bin.000001	#	Query	7	#	BEGIN
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (test.BUG_45756_02)
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	7	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	7	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_02`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_03 (a int) engine = NDB
+slave-master-bin.000001	#	Query	7	#	BEGIN
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (test.BUG_45756_03)
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	7	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	7	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_03`

=== added file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_binlog_update.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_binlog_update.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_binlog_update.result	2009-09-03 16:54:09 +0000
@@ -0,0 +1,176 @@
+*** Configuring connections ***
+*** Configuring replication ***
+STOP SLAVE;
+SET SQL_LOG_BIN= 0;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+SET SQL_LOG_BIN= 1;
+RESET MASTER;
+RESET SLAVE;
+SET SQL_LOG_BIN= 0;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+SET SQL_LOG_BIN= 1;
+START SLAVE;
+*** Generating data to be replicated ***
+CREATE TABLE BUG_45756_01 (a int) engine = NDB;
+INSERT INTO BUG_45756_01 VALUES (1);
+DROP TABLE BUG_45756_01;
+CREATE TABLE BUG_45756_02 (a int) engine = NDB;
+INSERT INTO BUG_45756_02 VALUES (1);
+DROP TABLE BUG_45756_02;
+CREATE TABLE BUG_45756_03 (a int) engine = NDB;
+INSERT INTO BUG_45756_03 VALUES (1);
+DROP TABLE BUG_45756_03;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_04 (a int) engine = NDB;
+INSERT INTO BUG_45756_04 VALUES (1);
+DROP TABLE BUG_45756_04;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_05 (a int) engine = NDB;
+INSERT INTO BUG_45756_05 VALUES (1);
+DROP TABLE BUG_45756_05;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE BUG_45756_06 (a int) engine = NDB;
+INSERT INTO BUG_45756_06 VALUES (1);
+DROP TABLE BUG_45756_06;
+SET SQL_LOG_BIN= 1;
+*** Checking replicated data on every sever in both clusters ***
+
+
+
+connection srv_master;
+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_01 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_01)
+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_01
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_02 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_02)
+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_02`
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_03 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.BUG_45756_03)
+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_03`
+
+
+
+connection srv_master1;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_master2;
+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_01 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_01)
+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_01`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_02 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_02)
+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_02`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE BUG_45756_03 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.BUG_45756_03)
+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_03
+
+
+
+connection srv_slave;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_01 (a int) engine = NDB
+slave-master-bin.000001	#	Query	4	#	BEGIN
+slave-master-bin.000001	#	Table_map	4	#	table_id: # (test.BUG_45756_01)
+slave-master-bin.000001	#	Table_map	4	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	4	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	4	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; DROP TABLE BUG_45756_01
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_02 (a int) engine = NDB
+slave-master-bin.000001	#	Query	4	#	BEGIN
+slave-master-bin.000001	#	Table_map	4	#	table_id: # (test.BUG_45756_02)
+slave-master-bin.000001	#	Table_map	4	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	4	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	4	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_02`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_03 (a int) engine = NDB
+slave-master-bin.000001	#	Query	4	#	BEGIN
+slave-master-bin.000001	#	Table_map	4	#	table_id: # (test.BUG_45756_03)
+slave-master-bin.000001	#	Table_map	4	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	4	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	4	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_03`
+
+
+
+connection srv_slave1;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_slave2;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+connection srv_slave3;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_01 (a int) engine = NDB
+slave-master-bin.000001	#	Query	7	#	BEGIN
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (test.BUG_45756_01)
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	7	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	7	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_01`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_02 (a int) engine = NDB
+slave-master-bin.000001	#	Query	7	#	BEGIN
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (test.BUG_45756_02)
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	7	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	7	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_02`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE BUG_45756_03 (a int) engine = NDB
+slave-master-bin.000001	#	Query	7	#	BEGIN
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (test.BUG_45756_03)
+slave-master-bin.000001	#	Table_map	7	#	table_id: # (mysql.ndb_apply_status)
+slave-master-bin.000001	#	Write_rows	7	#	table_id: #
+slave-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+slave-master-bin.000001	#	Query	7	#	COMMIT
+slave-master-bin.000001	#	Query	1	#	use `test`; drop table `test`.`BUG_45756_03`

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_slave.cnf'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave.cnf	2009-09-03 16:54:09 +0000
@@ -0,0 +1 @@
+!include extra/rpl_tests/rpl_ndb_bug_45756.cnf

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_slave.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave.test	2009-09-03 16:54:09 +0000
@@ -0,0 +1,14 @@
+###############################################################################
+# Description: Checks if DDL statements are correctly replicated among servers.
+#
+# Testing scenario: Cluster 1 replicates to Cluster 2
+#
+#  cluster 1 [  srv_master  srv_master1  srv_master2  ]
+#                   |
+#                   v
+#  cluster 2 [  srv_slave  srv_slave1  srv_slave2  srv_slave3 ]
+#
+#  - srv_slave as slave without log_bin and log_slave_updates.
+###############################################################################
+
+--source extra/rpl_tests/rpl_ndb_bug_45756.test

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog.cnf'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog.cnf	2009-09-03 16:54:09 +0000
@@ -0,0 +1,4 @@
+!include extra/rpl_tests/rpl_ndb_bug_45756.cnf
+
+[mysqld.1.slave]
+log-bin= slave-master-bin

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog.test	2009-09-03 16:54:09 +0000
@@ -0,0 +1,14 @@
+###############################################################################
+# Description: Checks if DDL statements are correctly replicated among servers.
+#
+# Testing scenario: Cluster 1 replicates to Cluster 2
+#
+#  cluster 1 [  srv_master  srv_master1  srv_master2  ]
+#                   |
+#                   v
+#  cluster 2 [  srv_slave  srv_slave1  srv_slave2  srv_slave3 ]
+#
+#  - srv_slave as slave with log_bin and without log_slave_updates.
+###############################################################################
+
+--source extra/rpl_tests/rpl_ndb_bug_45756.test

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog_update.cnf'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog_update.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog_update.cnf	2009-09-03 16:54:09 +0000
@@ -0,0 +1,5 @@
+!include extra/rpl_tests/rpl_ndb_bug_45756.cnf
+
+[mysqld.1.slave]
+log-bin= slave-master-bin
+log-slave-updates

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog_update.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog_update.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_binlog_update.test	2009-09-03 16:54:09 +0000
@@ -0,0 +1,14 @@
+###############################################################################
+# Description: Checks if DDL statements are correctly replicated among servers.
+#
+# Testing scenario: Cluster 1 replicates to Cluster 2
+#
+#  cluster 1 [  srv_master  srv_master1  srv_master2  ]
+#                   |
+#                   v
+#  cluster 2 [  srv_slave  srv_slave1  srv_slave2  srv_slave3 ]
+#
+#  - srv_slave as slave with both log_bin and log_slave_updates.
+###############################################################################
+
+--source extra/rpl_tests/rpl_ndb_bug_45756.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-03 16:54:09 +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->


Attachment: [text/bzr-bundle]
Thread
bzr commit into mysql-5.1-telco-6.2 branch (alfranio.correia:2976)Bug#45756Alfranio Correia3 Sep