List:Commits« Previous MessageNext Message »
From:Frazer Clement Date:June 24 2010 3:41pm
Subject:bzr commit into mysql-5.1-telco-7.0 branch (frazer:3628)
View as plain text  
#At file:///home/frazer/bzr/mysql-5.1-telco-7.0/ based on revid:jonas@stripped

 3628 Frazer Clement	2010-06-24
      Commit2 for CluB-XXX build

    added:
      mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu_anyval.result
      mysql-test/suite/rpl_ndb/t/rpl_ndb_get_binlog_events.inc
      mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu_anyval.cnf
      mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu_anyval.test
    modified:
      client/mysqlbinlog.cc
      mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu.result
      mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_binlog_update.inc
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/ha_ndbcluster_binlog.h
      sql/log_event.cc
      sql/log_event.h
      sql/mysqld.cc
      sql/set_var.cc
      sql/slave.cc
      sql/slave.h
      sql/sql_class.cc
      sql/sql_class.h
      storage/ndb/tools/restore/consumer_restore.cpp
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	2010-06-16 12:04:53 +0000
+++ b/client/mysqlbinlog.cc	2010-06-24 15:41:46 +0000
@@ -102,6 +102,8 @@ static ulonglong rec_count= 0;
 static short binlog_flags = 0; 
 static MYSQL* mysql = NULL;
 static const char* dirname_for_local_load= 0;
+uint opt_server_id_bits = 0;
+ulong opt_server_id_mask = 0;
 
 /**
   Pointer to the Format_description_log_event of the currently active binlog.
@@ -1152,6 +1154,12 @@ that may lead to an endless loop.",
    "Used to reserve file descriptors for use by this program.",
    (uchar**) &open_files_limit, (uchar**) &open_files_limit, 0, GET_ULONG,
    REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
+  {"server-id-bits", 255,
+   "Set number of significant bits in ServerId",
+   (uchar**) &opt_server_id_bits,
+   (uchar**) &opt_server_id_bits,
+   /* Default + Max 32 bits, minimum 7 bits */
+   0, GET_UINT, REQUIRED_ARG, 32, 7, 32, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
@@ -2049,6 +2057,9 @@ int main(int argc, char** argv)
   if (opt_base64_output_mode == BASE64_OUTPUT_UNSPEC)
     opt_base64_output_mode= BASE64_OUTPUT_AUTO;
 
+  opt_server_id_mask = (opt_server_id_bits == 32)?
+    ~ ulong(0) : (1 << opt_server_id_bits) -1;
+
   my_set_max_open_files(open_files_limit);
 
   MY_TMPDIR tmpdir;

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu.result	2009-09-16 16:04:14 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu.result	2010-06-24 15:41:46 +0000
@@ -97,6 +97,32 @@ master-bin.000001	#	Write_rows	1	#	table
 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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
 
 
 
@@ -151,6 +177,32 @@ master-bin.000001	#	Write_rows	3	#	table
 master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	3	#	COMMIT
 master-bin.000001	#	Query	3	#	use `test`; DROP TABLE bug45756_master_logged_3
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 3    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 3    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 3    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
 
 
 
@@ -205,6 +257,32 @@ slave-master-bin.000001	#	Write_rows	5	#
 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`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 5    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 5    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 5    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
 
 
 
@@ -268,6 +346,56 @@ slave-master-bin.000001	#	Write_rows	6	#
 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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 6    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 6    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 6    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
 *** Configuring replication via Slave1 ***
 STOP SLAVE;
 STOP SLAVE;
@@ -366,6 +494,32 @@ master-bin.000001	#	Write_rows	1	#	table
 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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
 
 
 
@@ -420,6 +574,32 @@ master-bin.000001	#	Write_rows	3	#	table
 master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	3	#	COMMIT
 master-bin.000001	#	Query	3	#	use `test`; DROP TABLE bug45756_master_logged_3
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 3    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 3    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 3    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
 
 
 
@@ -474,6 +654,32 @@ slave-master-bin.000001	#	Write_rows	5	#
 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`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 5    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 5    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 5    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
 
 
 
@@ -537,6 +743,56 @@ slave-master-bin.000001	#	Write_rows	6	#
 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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 6    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 6    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 6    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
 *** Configuring replication via Slave2 ***
 STOP SLAVE;
 STOP SLAVE;
@@ -635,6 +891,32 @@ master-bin.000001	#	Write_rows	1	#	table
 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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
 
 
 
@@ -689,6 +971,32 @@ master-bin.000001	#	Write_rows	3	#	table
 master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	3	#	COMMIT
 master-bin.000001	#	Query	3	#	use `test`; DROP TABLE bug45756_master_logged_3
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 3    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 3    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 3    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
 
 
 
@@ -743,6 +1051,32 @@ slave-master-bin.000001	#	Write_rows	5	#
 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`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 5    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 5    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 5    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
 
 
 
@@ -806,3 +1140,53 @@ slave-master-bin.000001	#	Write_rows	6	#
 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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 6    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 6    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 6    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 1    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 

=== added file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu_anyval.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu_anyval.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_lsu_anyval.result	2010-06-24 15:41:46 +0000
@@ -0,0 +1,1192 @@
+*** Configuring connections ***
+STOP SLAVE;
+*** Waiting for each cluster to startup ***
+*** Configuring replication via Slave ***
+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 bug45756_master_logged_1 (a int) engine = NDB;
+INSERT INTO bug45756_master_logged_1 VALUES (1);
+DROP TABLE bug45756_master_logged_1;
+CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB;
+INSERT INTO bug45756_master_logged_2 VALUES (1);
+DROP TABLE bug45756_master_logged_2;
+CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB;
+INSERT INTO bug45756_master_logged_3 VALUES (1);
+DROP TABLE bug45756_master_logged_3;
+*** Generating changes not to be replicated ***
+SET SQL_LOG_BIN= 0;
+CREATE TABLE bug45756_master_not_logged_1 (a int) engine = NDB;
+INSERT INTO bug45756_master_not_logged_1 VALUES (1);
+DROP TABLE bug45756_master_not_logged_1;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE bug45756_master_not_logged_2 (a int) engine = NDB;
+INSERT INTO bug45756_master_not_logged_2 VALUES (1);
+DROP TABLE bug45756_master_not_logged_2;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE bug45756_master_not_logged_3 (a int) engine = NDB;
+INSERT INTO bug45756_master_not_logged_3 VALUES (1);
+DROP TABLE bug45756_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 bug45756_master_logged_1 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.bug45756_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 bug45756_master_logged_1
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_2`
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+
+
+
+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 bug45756_master_logged_1 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_1`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_2`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.bug45756_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 bug45756_master_logged_3
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 2147483523    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 2147483523    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 2147483523    	Query	 	 	 
+server id 2147483523    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 2147483523    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 2147483523    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 2147483523    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+
+
+
+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`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 2147483525    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 2147483525    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 2147483525    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 2147483525    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 2147483525    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 2147483525    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 2147483525    	Query	 	 	 
+
+
+
+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 bug45756_master_logged_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_1`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_2`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 2147483526    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483526    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483526    	Query	 	 	 
+server id 2147483526    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483526    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483526    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483526    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+*** Configuring replication via Slave1 ***
+STOP SLAVE;
+STOP SLAVE;
+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 bug45756_master_logged_1 (a int) engine = NDB;
+INSERT INTO bug45756_master_logged_1 VALUES (1);
+DROP TABLE bug45756_master_logged_1;
+CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB;
+INSERT INTO bug45756_master_logged_2 VALUES (1);
+DROP TABLE bug45756_master_logged_2;
+CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB;
+INSERT INTO bug45756_master_logged_3 VALUES (1);
+DROP TABLE bug45756_master_logged_3;
+*** Generating changes not to be replicated ***
+SET SQL_LOG_BIN= 0;
+CREATE TABLE bug45756_master_not_logged_1 (a int) engine = NDB;
+INSERT INTO bug45756_master_not_logged_1 VALUES (1);
+DROP TABLE bug45756_master_not_logged_1;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE bug45756_master_not_logged_2 (a int) engine = NDB;
+INSERT INTO bug45756_master_not_logged_2 VALUES (1);
+DROP TABLE bug45756_master_not_logged_2;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE bug45756_master_not_logged_3 (a int) engine = NDB;
+INSERT INTO bug45756_master_not_logged_3 VALUES (1);
+DROP TABLE bug45756_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 bug45756_master_logged_1 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.bug45756_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 bug45756_master_logged_1
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_2`
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+
+
+
+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 bug45756_master_logged_1 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_1`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_2`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.bug45756_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 bug45756_master_logged_3
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 2147483523    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 2147483523    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 2147483523    	Query	 	 	 
+server id 2147483523    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 2147483523    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 2147483523    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 2147483523    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+
+
+
+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`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 2147483525    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 2147483525    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 2147483525    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 2147483525    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 2147483525    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 2147483525    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 2147483525    	Query	 	 	 
+
+
+
+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 bug45756_master_logged_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_1`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_2`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 2147483526    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483526    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483526    	Query	 	 	 
+server id 2147483526    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483526    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483526    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483526    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+*** Configuring replication via Slave2 ***
+STOP SLAVE;
+STOP SLAVE;
+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 bug45756_master_logged_1 (a int) engine = NDB;
+INSERT INTO bug45756_master_logged_1 VALUES (1);
+DROP TABLE bug45756_master_logged_1;
+CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB;
+INSERT INTO bug45756_master_logged_2 VALUES (1);
+DROP TABLE bug45756_master_logged_2;
+CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB;
+INSERT INTO bug45756_master_logged_3 VALUES (1);
+DROP TABLE bug45756_master_logged_3;
+*** Generating changes not to be replicated ***
+SET SQL_LOG_BIN= 0;
+CREATE TABLE bug45756_master_not_logged_1 (a int) engine = NDB;
+INSERT INTO bug45756_master_not_logged_1 VALUES (1);
+DROP TABLE bug45756_master_not_logged_1;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE bug45756_master_not_logged_2 (a int) engine = NDB;
+INSERT INTO bug45756_master_not_logged_2 VALUES (1);
+DROP TABLE bug45756_master_not_logged_2;
+SET SQL_LOG_BIN= 1;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE bug45756_master_not_logged_3 (a int) engine = NDB;
+INSERT INTO bug45756_master_not_logged_3 VALUES (1);
+DROP TABLE bug45756_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 bug45756_master_logged_1 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.bug45756_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 bug45756_master_logged_1
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_2`
+master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB
+master-bin.000001	#	Query	1	#	BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 1    	Table_map: `mysql`.`ndb_apply_status`  
+server id 1    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 1    	Query	 	 	 
+server id 2147483521    	Query	 	 	 
+
+
+
+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 bug45756_master_logged_1 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_1`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_2`
+master-bin.000001	#	Query	3	#	use `test`; CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.bug45756_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 bug45756_master_logged_3
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 2147483523    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 2147483523    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 2147483523    	Query	 	 	 
+server id 2147483523    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 2147483523    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 2147483523    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+server id 3    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 3    	Table_map: `mysql`.`ndb_apply_status`  
+server id 3    	Write_rows:  
+server id 2147483523    	Write_rows:   flags: STMT_END_F
+server id 3    	Query	 	 	 
+server id 3    	Query	 	 	 
+
+
+
+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`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 2147483525    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 2147483525    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 2147483525    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 2147483525    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 2147483525    	Query	 	 	 
+server id 5    	Query	 	 	 
+server id 5    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 5    	Table_map: `mysql`.`ndb_apply_status`  
+server id 5    	Write_rows:  
+server id 2147483525    	Write_rows:   flags: STMT_END_F
+server id 5    	Query	 	 	 
+server id 2147483525    	Query	 	 	 
+
+
+
+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 bug45756_master_logged_1 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.bug45756_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 bug45756_master_logged_1
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_2 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_2`
+slave-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE bug45756_master_logged_3 (a int) engine = NDB
+slave-master-bin.000001	#	Query	6	#	BEGIN
+slave-master-bin.000001	#	Table_map	6	#	table_id: # (test.bug45756_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`.`bug45756_master_logged_3`
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+binlog_entries
+server id 2147483526    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483526    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483526    	Query	 	 	 
+server id 2147483526    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483526    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 2147483526    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug_45756_slave_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483526    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_1`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_2`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 1    	Query	 	 	 
+server id 6    	Query	 	 	 
+server id 6    	Table_map: `test`.`bug45756_master_logged_3`  
+server id 6    	Table_map: `mysql`.`ndb_apply_status`  
+server id 6    	Write_rows:  
+server id 2147483521    	Write_rows:   flags: STMT_END_F
+server id 6    	Query	 	 	 
+server id 1    	Query	 	 	 

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_get_binlog_events.inc'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_get_binlog_events.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_get_binlog_events.inc	2010-06-24 15:41:46 +0000
@@ -0,0 +1,23 @@
+# 
+# Munch the mysqlbinlog tool output into deterministic form to look at server ids
+#
+
+--disable_query_log
+let $MYSQLD_DATADIR= `select @@datadir;`;
+--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/$BINLOG_FILENAME.000001 > $MYSQLTEST_VARDIR/tmp/rpl_ndb_mysqlbinlog.sql
+set sql_log_bin=0;
+create table raw_binlog_rows (txt varchar(1000));
+
+--eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_ndb_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
+
+--enable_query_log
+# Remove non-deterministic and uninteresting elements from the mysqlbinlog output
+# Right trim of length-17 takes out the initial timestamp
+# We are primarily interested in server id and event type
+--replace_regex /thread_id=[0-9]*/ /     /exec_time=[0-9]*/ /   /end_log_pos [0-9]*/ /   /table id [0-9]*/ /   /error_code=[0-9]*/ /   /mapped to number [0-9]*/ /
+select right(txt, length(txt)-17) as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
+
+--disable_query_log
+drop table raw_binlog_rows;
+set sql_log_bin=1;
+--enable_query_log
\ No newline at end of file

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_binlog_update.inc'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_binlog_update.inc	2009-09-16 16:04:14 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_binlog_update.inc	2010-06-24 15:41:46 +0000
@@ -144,6 +144,9 @@ show variables like 'server_id';
 show variables like 'log_bin';
 show variables like 'log_slave_updates';
 --source include/show_binlog_events2.inc
+let $BINLOG_FILENAME='master-bin';
+--source suite/rpl_ndb/t/rpl_ndb_get_binlog_events.inc
+
 
 connection srv_master1;
 --echo 
@@ -164,6 +167,8 @@ show variables like 'server_id';
 show variables like 'log_bin';
 show variables like 'log_slave_updates';
 --source include/show_binlog_events2.inc
+let $BINLOG_FILENAME='master-bin';
+--source suite/rpl_ndb/t/rpl_ndb_get_binlog_events.inc
 
 connection srv_slave;
 --echo 
@@ -184,6 +189,8 @@ show variables like 'server_id';
 show variables like 'log_bin';
 show variables like 'log_slave_updates';
 --source include/show_binlog_events2.inc
+let $BINLOG_FILENAME='slave-master-bin';
+--source suite/rpl_ndb/t/rpl_ndb_get_binlog_events.inc
 
 connection srv_slave2;
 --echo 
@@ -194,3 +201,6 @@ show variables like 'server_id';
 show variables like 'log_bin';
 show variables like 'log_slave_updates';
 --source include/show_binlog_events2.inc
+let $BINLOG_FILENAME='slave-master-bin';
+--source suite/rpl_ndb/t/rpl_ndb_get_binlog_events.inc
+

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu_anyval.cnf'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu_anyval.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu_anyval.cnf	2010-06-24 15:41:46 +0000
@@ -0,0 +1,8 @@
+!include suite/rpl_ndb/t/rpl_ndb_multi_binlog_update.cnf
+
+[mysqld]
+# Low ServerId bits and NDB_TEST_ANYVALUE_USERDATA below
+server-id-bits=7
+
+[ENV]
+NDB_TEST_ANYVALUE_USERDATA=Y
\ No newline at end of file

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu_anyval.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu_anyval.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_lsu_anyval.test	2010-06-24 15:41:46 +0000
@@ -0,0 +1,39 @@
+###############################################################################
+# Description :
+#   Test that using server-id-bits and composite AnyValues works in that.
+#   1) Composite AnyValues are correctly split into ServerId and UserData
+#      by MySQLDs listening to NdbApi events.
+#   2) Composite AnyValues are placed into the ServerId of events in the
+#      Binary logs of attached binlogging MySQLDs
+#   3) Composite ServerIds are correctly split into ServerId by the replication
+#      framework on the slave-side for the purposes of :
+#      a) Loop detection
+#      b) ndb_apply_status updates
+#   4) Composite ServerIds are placed into the composite AnyValues of row
+#      operations by the slave
+#   5) Binlogging MySQLDs on the slave correctly identify replicated composite
+#      AnyValues as being replicated.
+#
+# This test is a re-run of rpl_ndb_slave_lsu with different configuration :
+#   a) server-id-bits is set to 7, implying that :
+#      - Only the bottom 7 bits of event ServerIds written to the Binlog are
+#        set to the ServerId.  The other bits come from the event AnyValue
+#        received by the Binlog injector. 
+#      - Only the bottom 7 bits of ServerIds received in Binlogs are used as
+#        the ServerId in the Slave, the other bits are ignored, but are placed
+#        in the AnyValue of resulting NdbApi operations.
+#   b) NDB_TEST_ANYVALUE_USERDATA is set to Y
+#      - This causes MySQLD to set the UserData part of the AnyValue (in this
+#        case bits 8-30) to '1'.
+#        This results in AnyValues and replicated ServerIds having an 'offset'
+#        of 2^24 << 7 == 2147483520
+#        This offset can be seen when comparing the SHOW BINLOG EVENTS ServerId
+#        values (which use the server-id-bits to only show the server-id, to 
+#        output from the mysqlbinlog tool when it passed no server-id-bits
+#        option, and shows the full serverid.
+#        It can be seen that events originating on the master are given a
+#        composite server id which is available at the slave as it is written
+#        into the binlog of the slave running with --log-slave-updates on.
+###############################################################################
+
+--source suite/rpl_ndb/t/rpl_ndb_slave_lsu.test

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2010-06-22 07:53:38 +0000
+++ b/sql/ha_ndbcluster.cc	2010-06-24 15:41:46 +0000
@@ -67,7 +67,7 @@ static ulong opt_ndb_cache_check_time;
 static uint opt_ndb_cluster_connection_pool;
 static char* opt_ndb_connectstring;
 static uint opt_ndb_nodeid;
-
+extern ulong opt_server_id_mask;
 
 static MYSQL_THDVAR_UINT(
   autoincrement_prefetch_sz,         /* name */
@@ -3562,6 +3562,7 @@ inline void
 ha_ndbcluster::eventSetAnyValue(THD *thd, 
                                 NdbOperation::OperationOptions *options)
 {
+  options->anyValue= 0;
   if (unlikely(m_slow_path))
   {
     /*
@@ -3573,15 +3574,36 @@ ha_ndbcluster::eventSetAnyValue(THD *thd
     Thd_ndb *thd_ndb= get_thd_ndb(thd);
     if (thd->slave_thread)
     {
+      /*
+        Slave-thread, we are applying a replicated event.
+        We set the server_id to the value received from the log which
+        may be a composite of server_id and other data according
+        to the server_id_bits option.
+        In future it may be useful to support *not* mapping composite
+        AnyValues to/from Binlogged server-ids
+      */
+      assert(thd->server_id == (thd->unmasked_server_id & opt_server_id_mask));
       options->optionsPresent |= NdbOperation::OperationOptions::OO_ANYVALUE;
-      options->anyValue=thd->server_id;
+      options->anyValue = thd->unmasked_server_id;
     }
     else if (thd_ndb->trans_options & TNTO_NO_LOGGING)
     {
       options->optionsPresent |= NdbOperation::OperationOptions::OO_ANYVALUE;
-      options->anyValue=NDB_ANYVALUE_FOR_NOLOGGING;
+      ndbcluster_anyvalue_set_nologging(options->anyValue);
     }
   }
+#ifndef DBUG_OFF
+  /*
+    MySQLD will set the user-portion of AnyValue (if any) to all 1s
+    This tests code filtering ServerIds on the value of server-id-bits.
+  */
+  const char* p = getenv("NDB_TEST_ANYVALUE_USERDATA");
+  if (p != 0  && *p != 0 && *p != '0' && *p != 'n' && *p != 'N')
+  {
+    options->optionsPresent |= NdbOperation::OperationOptions::OO_ANYVALUE;
+    dbug_ndbcluster_anyvalue_set_userbits(options->anyValue);
+  }
+#endif
 }
 
 bool ha_ndbcluster::isManualBinlogExec(THD *thd)

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2010-06-03 14:12:46 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2010-06-24 15:41:46 +0000
@@ -43,6 +43,7 @@ extern my_bool opt_ndb_log_update_as_wri
 extern my_bool opt_ndb_log_updated_only;
 extern my_bool opt_ndb_log_binlog_index;
 extern ulong opt_ndb_extra_logging;
+extern ulong opt_server_id_mask;
 
 /*
   defines for cluster replication table names
@@ -2021,7 +2022,7 @@ int ndbcluster_log_schema_op(THD *thd,
       r|= op->setValue(SCHEMA_TYPE_I, log_type);
       DBUG_ASSERT(r == 0);
       /* any value */
-      Uint32 anyValue;
+      Uint32 anyValue = 0;
       if (! thd->slave_thread)
       {
         /* Schema change originating from this MySQLD, check SQL_LOG_BIN
@@ -2030,23 +2031,43 @@ int ndbcluster_log_schema_op(THD *thd,
         if (thd->options & OPTION_BIN_LOG) /* e.g. SQL_LOG_BIN == on */
         {
           DBUG_PRINT("info", ("Schema event for binlogging"));
-          anyValue = 0;
+          ndbcluster_anyvalue_set_normal(anyValue);
         }
         else
         {
           DBUG_PRINT("info", ("Schema event not for binlogging")); 
-          anyValue = NDB_ANYVALUE_FOR_NOLOGGING;
+          ndbcluster_anyvalue_set_nologging(anyValue);
         }
       }
       else
       {
-        /* Slave applying replicated schema event
-         * Pass original applier's serverId in AnyValue
-         */
+        /* 
+           Slave propagating replicated schema event in ndb_schema
+           In case replicated serverId is composite 
+           (server-id-bits < 31) we copy it into the 
+           AnyValue as-is
+           This is for 'future', as currently Schema operations
+           do not have composite AnyValues.
+           In future it may be useful to support *not* mapping composite
+           AnyValues to/from Binlogged server-ids.
+        */
         DBUG_PRINT("info", ("Replicated schema event with original server id %d",
                             thd->server_id));
-        anyValue = thd->server_id;
+        assert(thd->server_id == (thd->unmasked_server_id & opt_server_id_mask));
+        anyValue = thd->unmasked_server_id;
+      }
+
+#ifndef DBUG_OFF
+      /*
+        MySQLD will set the user-portion of AnyValue (if any) to all 1s
+        This tests code filtering ServerIds on the value of server-id-bits.
+      */
+      const char* p = getenv("NDB_TEST_ANYVALUE_USERDATA");
+      if (p != 0  && *p != 0 && *p != '0' && *p != 'n' && *p != 'N')
+      {
+        dbug_ndbcluster_anyvalue_set_userbits(anyValue);
       }
+#endif  
 
       r|= op->setAnyValue(anyValue);
       DBUG_ASSERT(r == 0);
@@ -2297,38 +2318,50 @@ static void ndb_binlog_query(THD *thd, C
   /* any_value == 0 means local cluster sourced change that
    * should be logged
    */
-  if (schema->any_value != 0)
+  if (ndbcluster_anyvalue_is_reserved(schema->any_value))
+  {
+    /* Originating SQL node did not want this query logged */
+    if (!ndbcluster_anyvalue_is_nologging(schema->any_value))
+      sql_print_warning("NDB: unknown value for binlog signalling 0x%X, "
+                        "query not logged",
+                        schema->any_value);
+    return;
+  }
+  
+  Uint32 queryServerId = ndbcluster_anyvalue_get_serverid(schema->any_value);
+  /* 
+     Start with serverId as received AnyValue, in case it's a composite
+     (server_id_bits < 31).
+     This is for 'future', as currently schema ops do not have composite
+     AnyValues.
+     In future it may be useful to support *not* mapping composite
+     AnyValues to/from Binlogged server-ids.
+  */
+  Uint32 loggedServerId = schema->any_value;
+
+  if (queryServerId)
   {
-    if (schema->any_value & NDB_ANYVALUE_RESERVED)
+    /* 
+       AnyValue has 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)
     {
-      /* 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);
+      /* This MySQLD does not log slave updates */
       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;
-      }
-    }
+  }
+  else
+  {
+    /* No ServerId associated with this query, mark it as ours */
+    ndbcluster_anyvalue_set_serverid(loggedServerId, ::server_id);
   }
 
   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;
-  if (schema->any_value == 0)
-    thd->server_id= ::server_id;
-  else
-    thd->server_id= schema->any_value;
+  thd->server_id = loggedServerId;
   thd->db= schema->db;
   int errcode = query_error_code(thd, thd->killed == THD::NOT_KILLED);
   thd->binlog_query(THD::STMT_QUERY_TYPE, schema->query,
@@ -3240,13 +3273,20 @@ int ndbcluster_binlog_start()
 
   if (::server_id == 0)
   {
-    sql_print_warning("NDB: server id set to zero will cause any other mysqld "
-                      "with bin log to log with wrong server id");
+    sql_print_warning("NDB: server id set to zero - changes logged to "
+                      "bin log with server id zero will be logged with "
+                      "another server id by slave mysqlds");
   }
-  else if (::server_id & 0x1 << 31)
+
+  /* 
+     Check that ServerId is not using the reserved bit or bits reserved
+     for application use
+  */
+  if ((::server_id & 0x1 << 31) ||                             // Reserved bit
+      !ndbcluster_anyvalue_is_serverid_in_range(::server_id))  // server_id_bits
   {
-    sql_print_error("NDB: server id's with high bit set is reserved for internal "
-                    "purposes");
+    sql_print_error("NDB: server id provided is too large to be represented in "
+                    "opt_server_id_bits or is reserved");
     DBUG_RETURN(-1);
   }
 
@@ -5158,17 +5198,20 @@ ndb_binlog_thread_handle_data_event(Ndb 
     return 0;
   }
 
-  uint32 originating_server_id= pOp->getAnyValue();
-  if (originating_server_id == 0)
-    originating_server_id= ::server_id;
-  else if (originating_server_id & NDB_ANYVALUE_RESERVED)
+  uint32 anyValue= pOp->getAnyValue();
+  if (ndbcluster_anyvalue_is_reserved(anyValue))
   {
-    if (originating_server_id != NDB_ANYVALUE_FOR_NOLOGGING)
+    if (!ndbcluster_anyvalue_is_nologging(anyValue))
       sql_print_warning("NDB: unknown value for binlog signalling 0x%X, "
                         "event not logged",
-                        originating_server_id);
+                        anyValue);
     return 0;
   }
+  
+  uint32 originating_server_id= ndbcluster_anyvalue_get_serverid(anyValue);
+
+  if (originating_server_id == 0)
+    originating_server_id= ::server_id;
   else if (!g_ndb_log_slave_updates)
   {
     /*
@@ -5178,6 +5221,16 @@ ndb_binlog_thread_handle_data_event(Ndb 
     return 0;
   }
 
+  /* 
+     Start with logged_server_id as AnyValue in case it's a composite
+     (server_id_bits < 31).  This way any user-values are passed-through
+     to the Binlog in the high bits of the event's Server Id.
+     In future it may be useful to support *not* mapping composite
+     AnyValues to/from Binlogged server-ids.
+  */
+  uint32 logged_server_id= anyValue;
+  ndbcluster_anyvalue_set_serverid(logged_server_id, originating_server_id);
+
   DBUG_ASSERT(trans.good());
   DBUG_ASSERT(table != 0);
 
@@ -5227,7 +5280,7 @@ ndb_binlog_thread_handle_data_event(Ndb 
         DBUG_ASSERT(ret == 0);
       }
       ndb_unpack_record(table, event_data->ndb_value[0], &b, table->record[0]);
-      IF_DBUG(int ret=) trans.write_row(originating_server_id,
+      IF_DBUG(int ret=) trans.write_row(logged_server_id,
                                         injector::transaction::table(table,
                                                                      TRUE),
                                         &b, n_fields, table->record[0]);
@@ -5268,7 +5321,7 @@ ndb_binlog_thread_handle_data_event(Ndb 
       }
       ndb_unpack_record(table, event_data->ndb_value[n], &b, table->record[n]);
       DBUG_EXECUTE("info", print_records(table, table->record[n]););
-      IF_DBUG(int ret =) trans.delete_row(originating_server_id,
+      IF_DBUG(int ret =) trans.delete_row(logged_server_id,
                                           injector::transaction::table(table,
                                                                        TRUE),
                                           &b, n_fields, table->record[n]);
@@ -5300,7 +5353,7 @@ ndb_binlog_thread_handle_data_event(Ndb 
           since table has a primary key, we can do a write
           using only after values
         */
-        IF_DBUG(int ret =) trans.write_row(originating_server_id,
+        IF_DBUG(int ret =) trans.write_row(logged_server_id,
                                            injector::transaction::table(table, TRUE),
                                            &b, n_fields, table->record[0]);// after values
         DBUG_ASSERT(ret == 0);
@@ -5322,7 +5375,7 @@ ndb_binlog_thread_handle_data_event(Ndb 
         }
         ndb_unpack_record(table, event_data->ndb_value[1], &b, table->record[1]);
         DBUG_EXECUTE("info", print_records(table, table->record[1]););
-        IF_DBUG(int ret =) trans.update_row(originating_server_id,
+        IF_DBUG(int ret =) trans.update_row(logged_server_id,
                                             injector::transaction::table(table,
                                                                          TRUE),
                                             &b, n_fields,
@@ -6447,4 +6500,87 @@ ndbcluster_show_status_binlog(THD* thd, 
   DBUG_RETURN(FALSE);
 }
 
+/*
+   AnyValue carries ServerId or Reserved codes
+   Bits from opt_server_id_bits to 30 may carry other data
+   so we ignore them when reading/setting AnyValue.
+ 
+   332        21        10        0
+   10987654321098765432109876543210
+   roooooooooooooooooooooooosssssss
+ 
+   r = Reserved bit indicates whether
+   bits 0-7+ have ServerId (0) or
+   some special reserved code (1).
+   o = Optional bits, depending on value
+       of server-id-bits will be 
+       serverid bits or user-specific 
+       data
+   s = Serverid bits or reserved codes
+       At least 7 bits will be available
+       for serverid or reserved codes
+  
+*/
+
+#define NDB_ANYVALUE_RESERVED_BIT   0x80000000
+#define NDB_ANYVALUE_RESERVED_MASK  0x8000007f
+
+#define NDB_ANYVALUE_NOLOGGING_CODE 0x8000007f
+
+#ifndef DBUG_OFF
+void dbug_ndbcluster_anyvalue_set_userbits(Uint32& anyValue)
+{
+  /* 
+     Set userData part of AnyValue (if there is one) to
+     all 1s to test that it is ignored
+  */
+  const Uint32 userDataMask = ~(opt_server_id_mask | 
+                                NDB_ANYVALUE_RESERVED_BIT);
+
+  anyValue |= userDataMask;
+}
+#endif
+
+bool ndbcluster_anyvalue_is_reserved(Uint32 anyValue)
+{
+  return ((anyValue & NDB_ANYVALUE_RESERVED_BIT) != 0);
+}
+
+bool ndbcluster_anyvalue_is_nologging(Uint32 anyValue)
+{
+  return ((anyValue & NDB_ANYVALUE_RESERVED_MASK) ==
+          NDB_ANYVALUE_NOLOGGING_CODE);
+}
+
+void ndbcluster_anyvalue_set_nologging(Uint32& anyValue)
+{
+  anyValue |= NDB_ANYVALUE_NOLOGGING_CODE;
+}
+
+void ndbcluster_anyvalue_set_normal(Uint32& anyValue)
+{
+  /* Clear reserved bit and serverid bits */
+  anyValue &= ~(NDB_ANYVALUE_RESERVED_BIT);
+  anyValue &= ~(opt_server_id_mask);
+}
+
+bool ndbcluster_anyvalue_is_serverid_in_range(Uint32 serverId)
+{
+  return ((serverId & ~opt_server_id_mask) == 0);
+}
+
+Uint32 ndbcluster_anyvalue_get_serverid(Uint32 anyValue)
+{
+  assert(! (anyValue & NDB_ANYVALUE_RESERVED_BIT) );
+
+  return (anyValue & opt_server_id_mask);
+}
+
+void ndbcluster_anyvalue_set_serverid(Uint32& anyValue, Uint32 serverId)
+{
+  assert(! (anyValue & NDB_ANYVALUE_RESERVED_BIT) );
+  anyValue &= ~(opt_server_id_mask);
+  anyValue |= (serverId & opt_server_id_mask); 
+}
+
 #endif

=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h	2010-06-03 14:12:46 +0000
+++ b/sql/ha_ndbcluster_binlog.h	2010-06-24 15:41:46 +0000
@@ -30,10 +30,6 @@ typedef NdbDictionary::Event  NDBEVENT;
 
 #define NDB_INVALID_SCHEMA_OBJECT 241
 
-/* server id's with high bit set is reservered */
-#define NDB_ANYVALUE_FOR_NOLOGGING 0xFFFFFFFF
-#define NDB_ANYVALUE_RESERVED      0x80000000
-
 extern handlerton *ndbcluster_hton;
 
 class Ndb_event_data
@@ -346,3 +342,16 @@ private:
   THD *m_thd;
   int m_lock;
 };
+
+
+bool ndbcluster_anyvalue_is_reserved(Uint32 anyValue);
+bool ndbcluster_anyvalue_is_nologging(Uint32 anyValue);
+void ndbcluster_anyvalue_set_nologging(Uint32& anyValue);
+bool ndbcluster_anyvalue_is_serverid_in_range(Uint32 serverId);
+void ndbcluster_anyvalue_set_normal(Uint32& anyValue);
+Uint32 ndbcluster_anyvalue_get_serverid(Uint32 anyValue);
+void ndbcluster_anyvalue_set_serverid(Uint32& anyValue, Uint32 serverId);
+
+#ifndef DBUG_OFF
+void dbug_ndbcluster_anyvalue_set_userbits(Uint32& anyValue);
+#endif

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2010-06-16 12:04:53 +0000
+++ b/sql/log_event.cc	2010-06-24 15:41:46 +0000
@@ -665,7 +665,7 @@ const char* Log_event::get_type_str()
 Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
   :log_pos(0), temp_buf(0), exec_time(0), flags(flags_arg), thd(thd_arg)
 {
-  server_id=	thd->server_id;
+  unmasked_server_id= server_id= thd->server_id;
   when=		thd->start_time;
   cache_stmt=	using_trans;
 }
@@ -682,7 +682,7 @@ Log_event::Log_event()
   :temp_buf(0), exec_time(0), flags(0), cache_stmt(0),
    thd(0)
 {
-  server_id=	::server_id;
+  unmasked_server_id= server_id= ::server_id;
   /*
     We can't call my_time() here as this would cause a call before
     my_init() is called
@@ -705,7 +705,15 @@ Log_event::Log_event(const char* buf,
   thd = 0;
 #endif
   when = uint4korr(buf);
-  server_id = uint4korr(buf + SERVER_ID_OFFSET);
+  unmasked_server_id = uint4korr(buf + SERVER_ID_OFFSET);
+  /* 
+     Mask out any irrelevant parts of the server_id
+  */
+#ifdef HAVE_REPLICATION
+  server_id = unmasked_server_id & opt_server_id_mask;
+#else
+  server_id = unmasked_server_id;
+#endif
   data_written= uint4korr(buf + EVENT_LEN_OFFSET);
   if (description_event->binlog_version==1)
   {

=== modified file 'sql/log_event.h'
--- a/sql/log_event.h	2010-06-16 12:04:53 +0000
+++ b/sql/log_event.h	2010-06-24 15:41:46 +0000
@@ -929,6 +929,13 @@ public:
   */
   uint32 server_id;
 
+  /*
+    The server id read from the Binlog.  server_id above has
+    lowest bits of this only according to the value of
+    opt_server_id_bits
+  */
+  uint32 unmasked_server_id;
+
   /**
     Some 16 flags. See the definitions above for LOG_EVENT_TIME_F,
     LOG_EVENT_FORCED_ROTATE_F, LOG_EVENT_THREAD_SPECIFIC_F, and

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-06-16 20:49:05 +0000
+++ b/sql/mysqld.cc	2010-06-24 15:41:46 +0000
@@ -455,6 +455,8 @@ handlerton *partition_hton;
 ulong opt_ndb_wait_setup;
 int(*ndb_wait_setup_func)(ulong)= 0;
 #endif
+uint opt_server_id_bits= 0;
+ulong opt_server_id_mask= 0;
 my_bool opt_readonly, use_temp_pool, relay_log_purge;
 my_bool opt_sync_frm, opt_allow_suspicious_udfs;
 my_bool opt_secure_auth= 0;
@@ -3895,6 +3897,8 @@ with --log-bin instead.");
   DBUG_ASSERT((uint)global_system_variables.binlog_format <=
               array_elements(binlog_format_names)-1);
 
+  opt_server_id_mask = ~ulong(0);
+
 #ifdef HAVE_REPLICATION
   if (opt_log_slave_updates && replicate_same_server_id)
   {
@@ -3904,6 +3908,15 @@ using --replicate-same-server-id in conj
 server.");
     unireg_abort(1);
   }
+  opt_server_id_mask = (opt_server_id_bits == 32)?
+    ~ ulong(0) : (1 << opt_server_id_bits) -1;
+  if (server_id != (server_id & opt_server_id_mask))
+  {
+    sql_print_error("\
+server-id configured is too large to represent with \
+server-id-bits configured.");
+    unireg_abort(1);
+  }
 #endif
 
   if (opt_bin_log)
@@ -6189,6 +6202,12 @@ thread is in the master's binlogs.",
    "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
    (uchar**) &myisam_recover_options_str, (uchar**) &myisam_recover_options_str, 0,
    GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"server-id-bits", 255,
+   "Set number of significant bits in ServerId",
+   (uchar**) &opt_server_id_bits,
+   (uchar**) &opt_server_id_bits,
+   /* Default + Max 32 bits, minimum 7 bits */
+   0, GET_UINT, REQUIRED_ARG, 32, 7, 32, 0, 0, 0},
   {"new", 'n', "Use very new possible 'unsafe' functions.",
    (uchar**) &global_system_variables.new_mode,
    (uchar**) &max_system_variables.new_mode,
@@ -6330,7 +6349,8 @@ Can't be set to 1 if --log-slave-updates
    (uchar**) &opt_secure_file_priv, (uchar**) &opt_secure_file_priv, 0,
    GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"server-id",	OPT_SERVER_ID,
-   "Uniquely identifies the server instance in the community of replication partners.",
+   "Uniquely identifies the server instance in the community of replication partners.  "
+   "Max value is limited by opt-server-id-bits if set.",
    (uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, UINT_MAX32,
    0, 0, 0},
   {"set-variable", 'O',

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2010-06-16 20:49:05 +0000
+++ b/sql/set_var.cc	2010-06-24 15:41:46 +0000
@@ -65,6 +65,8 @@
 
 #include "events.h"
 
+extern uint opt_server_id_bits;
+
 extern CHARSET_INFO *character_set_filesystem;
 
 
@@ -696,6 +698,10 @@ static sys_var_thd_bool
 sys_engine_condition_pushdown(&vars, "engine_condition_pushdown",
 			      &SV::engine_condition_pushdown);
 
+static sys_var_const
+sys_server_id_bits(&vars, "server_id_bits", OPT_GLOBAL, SHOW_INT, 
+                   (uchar*) &opt_server_id_bits);
+
 /* Time/date/datetime formats */
 
 static sys_var_thd_date_time_format sys_time_format(&vars, "time_format",

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2010-06-16 20:49:05 +0000
+++ b/sql/slave.cc	2010-06-24 15:41:46 +0000
@@ -2237,6 +2237,10 @@ int apply_event_and_update_pos(Log_event
     has a Rotate etc).
   */
 
+  /* 
+     Set the unmasked and actual server ids from the event 
+   */
+  thd->unmasked_server_id = ev->unmasked_server_id;
   thd->server_id = ev->server_id; // use the original server id for logging
   thd->set_time();                            // time the query
   thd->lex->current_select= 0;
@@ -3969,6 +3973,12 @@ static int queue_event(Master_info* mi,c
 
   pthread_mutex_lock(log_lock);
   s_id= uint4korr(buf + SERVER_ID_OFFSET);
+  /*
+    If server_id_bits option is set we need to mask out irrelevant bits
+    when checking server_id, but we still put the full unmasked server_id
+    into the Relay log so that it can be accessed when applying the event
+  */
+  s_id&= opt_server_id_mask;
   if ((s_id == ::server_id && !mi->rli.replicate_same_server_id) ||
       /*
         the following conjunction deals with IGNORE_SERVER_IDS, if set

=== modified file 'sql/slave.h'
--- a/sql/slave.h	2010-03-12 10:36:52 +0000
+++ b/sql/slave.h	2010-06-24 15:41:46 +0000
@@ -223,7 +223,8 @@ extern char *report_host, *report_passwo
 extern my_bool master_ssl;
 extern char *master_ssl_ca, *master_ssl_capath, *master_ssl_cert;
 extern char *master_ssl_cipher, *master_ssl_key;
-       
+extern ulong opt_server_id_mask;
+
 extern I_List<THD> threads;
 
 #endif /* HAVE_REPLICATION */

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2010-06-16 20:49:05 +0000
+++ b/sql/sql_class.cc	2010-06-24 15:41:46 +0000
@@ -719,7 +719,7 @@ THD::THD()
   /* Variables with default values */
   proc_info="login";
   where= THD::DEFAULT_WHERE;
-  server_id = ::server_id;
+  unmasked_server_id = server_id = ::server_id;
   slave_net = 0;
   command=COM_CONNECT;
   *scramble= '\0';

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2010-06-16 20:49:05 +0000
+++ b/sql/sql_class.h	2010-06-24 15:41:46 +0000
@@ -1412,6 +1412,7 @@ public:
     first byte of the packet in do_command()
   */
   enum enum_server_command command;
+  uint32     unmasked_server_id;
   uint32     server_id;
   uint32     file_id;			// for LOAD DATA INFILE
   /* remote (peer) port */

=== modified file 'storage/ndb/tools/restore/consumer_restore.cpp'
--- a/storage/ndb/tools/restore/consumer_restore.cpp	2010-06-11 11:58:22 +0000
+++ b/storage/ndb/tools/restore/consumer_restore.cpp	2010-06-24 15:41:46 +0000
@@ -24,7 +24,7 @@
 #include <ndb_internal.hpp>
 #include <ndb_logevent.h>
 
-#define NDB_ANYVALUE_FOR_NOLOGGING 0xFFFFFFFF
+#define NDB_ANYVALUE_FOR_NOLOGGING 0x8000007f
 
 extern FilteredNdbOut err;
 extern FilteredNdbOut info;


Attachment: [text/bzr-bundle] bzr/frazer@mysql.com-20100624154146-erqd4quz7tlgf6my.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (frazer:3628) Frazer Clement24 Jun