From: Date: April 12 2007 4:13pm Subject: bk commit into 5.1 tree (tomas:1.2554) BUG#17095 List-Archive: http://lists.mysql.com/commits/24386 X-Bug: 17095 Message-Id: <20070412141356.0400E336B60@whalegate.ndb.mysql.com> Below is the list of changes that have just been committed into a local 5.1 repository of tomas. When tomas does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-04-12 16:13:49+02:00, tomas@stripped +4 -0 Bug#17095 circular replication for ndb - test case - reset server id in injector client/mysqltest.c@stripped, 2007-04-12 16:13:46+02:00, tomas@stripped +3 -3 save master pos for ndb should look at handled epoch instead of applied mysql-test/r/rpl_ndb_circular.result@stripped, 2007-04-12 16:13:46+02:00, tomas@stripped +95 -0 New BitKeeper file ``mysql-test/r/rpl_ndb_circular.result'' mysql-test/r/rpl_ndb_circular.result@stripped, 2007-04-12 16:13:46+02:00, tomas@stripped +0 -0 mysql-test/t/rpl_ndb_circular.test@stripped, 2007-04-12 16:13:46+02:00, tomas@stripped +57 -0 New BitKeeper file ``mysql-test/t/rpl_ndb_circular.test'' mysql-test/t/rpl_ndb_circular.test@stripped, 2007-04-12 16:13:46+02:00, tomas@stripped +0 -0 sql/rpl_injector.cc@stripped, 2007-04-12 16:13:46+02:00, tomas@stripped +8 -0 Bug#17095 circular replication for ndb - reset server id in injector # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: tomas # Host: whalegate.ndb.mysql.com # Root: /home/tomas/mysql-5.1-new-rpl --- 1.285/client/mysqltest.c 2007-03-27 19:26:26 +02:00 +++ 1.286/client/mysqltest.c 2007-04-12 16:13:46 +02:00 @@ -2573,7 +2573,7 @@ if (have_ndbcluster) { - ulonglong start_epoch= 0, applied_epoch= 0, + ulonglong start_epoch= 0, applied_epoch= 0, handled_epoch= 0, latest_epoch=0, latest_trans_epoch=0, latest_handled_binlog_epoch= 0, latest_received_binlog_epoch= 0, latest_applied_binlog_epoch= 0; @@ -2676,9 +2676,9 @@ if (!row) die("result does not contain '%s' in '%s'", binlog, query); - if (latest_applied_binlog_epoch > applied_epoch) + if (latest_handled_binlog_epoch > handled_epoch) count= 0; - applied_epoch= latest_applied_binlog_epoch; + handled_epoch= latest_handled_binlog_epoch; count++; if (latest_handled_binlog_epoch >= start_epoch) do_continue= 0; --- 1.10/sql/rpl_injector.cc 2007-04-03 14:31:43 +02:00 +++ 1.11/sql/rpl_injector.cc 2007-04-12 16:13:46 +02:00 @@ -75,9 +75,11 @@ if ((error= check_state(TABLE_STATE))) DBUG_RETURN(error); + server_id_type save_id= m_thd->server_id; m_thd->set_server_id(sid); error= m_thd->binlog_write_table_map(tbl.get_table(), tbl.is_transactional()); + m_thd->set_server_id(save_id); DBUG_RETURN(error); } @@ -91,9 +93,11 @@ if (int error= check_state(ROW_STATE)) DBUG_RETURN(error); + server_id_type save_id= m_thd->server_id; m_thd->set_server_id(sid); m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(), cols, colcnt, record); + m_thd->set_server_id(save_id); DBUG_RETURN(0); } @@ -107,9 +111,11 @@ if (int error= check_state(ROW_STATE)) DBUG_RETURN(error); + server_id_type save_id= m_thd->server_id; m_thd->set_server_id(sid); m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(), cols, colcnt, record); + m_thd->set_server_id(save_id); DBUG_RETURN(0); } @@ -123,9 +129,11 @@ if (int error= check_state(ROW_STATE)) DBUG_RETURN(error); + server_id_type save_id= m_thd->server_id; m_thd->set_server_id(sid); m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(), cols, colcnt, before, after); + m_thd->set_server_id(save_id); DBUG_RETURN(0); } --- New file --- +++ mysql-test/r/rpl_ndb_circular.result 07/04/12 16:13:46 stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; RESET MASTER; CHANGE MASTER TO master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root"; START SLAVE; CREATE TABLE t1 (a int key, b int) ENGINE=ndb; SHOW TABLES; Tables_in_test t1 INSERT INTO t1 VALUES (1,2); INSERT INTO t1 VALUES (2,3); SELECT * FROM t1 ORDER BY a; a b 1 2 2 3 show slave status;; Slave_IO_State # Master_Host 127.0.0.1 Master_User root Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 Slave_IO_Running Yes Slave_SQL_Running Yes Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 Exec_Master_Log_Pos # Relay_Log_Space # Until_Condition None Until_Log_File Until_Log_Pos 0 Master_SSL_Allowed No Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No SELECT * FROM t1 ORDER BY a; a b 1 2 2 3 show slave status;; Slave_IO_State # Master_Host 127.0.0.1 Master_User root Master_Port # Connect_Retry 60 Master_Log_File slave-bin.000001 Read_Master_Log_Pos # Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File slave-bin.000001 Slave_IO_Running Yes Slave_SQL_Running Yes Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 Exec_Master_Log_Pos # Relay_Log_Space # Until_Condition None Until_Log_File Until_Log_Pos 0 Master_SSL_Allowed No Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No STOP SLAVE; DROP TABLE t1; --- New file --- +++ mysql-test/t/rpl_ndb_circular.test 07/04/12 16:13:46 --source include/have_ndb.inc --source include/have_binlog_format_row.inc --source include/master-slave.inc # set up circular replication --connection slave RESET MASTER; --connection master --replace_result $SLAVE_MYPORT SLAVE_PORT --eval CHANGE MASTER TO master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root" START SLAVE; # create the table on the "slave" --connection slave CREATE TABLE t1 (a int key, b int) ENGINE=ndb; #CREATE TABLE t2 (a int key, b int) ENGINE=ndb; --save_master_pos --connection master --sync_with_master # now we should have a table on the master as well SHOW TABLES; # insert some values on the slave and master --connection master INSERT INTO t1 VALUES (1,2); --connection slave INSERT INTO t1 VALUES (2,3); # ensure data has propagated both ways --connection slave --save_master_pos --connection master --sync_with_master --sync_slave_with_master # connect to slave and ensure data it there. --connection slave SELECT * FROM t1 ORDER BY a; #SELECT * FROM t2 ORDER BY a; --replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # --query_vertical show slave status; # connect to master and ensure data it there. --connection master SELECT * FROM t1 ORDER BY a; #SELECT * FROM t2 ORDER BY a; --replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # --query_vertical show slave status; # stop replication on "master" as not to replicate # shutdown circularly, eg drop table --connection master STOP SLAVE; # cleanup --connection master DROP TABLE t1;