diff options
author | unknown <guilhem@mysql.com> | 2003-11-18 17:31:17 +0100 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2003-11-18 17:31:17 +0100 |
commit | 80649ee8746aab02a198285248668cb49ce70f33 (patch) | |
tree | ec5bb0041cb8165d054181972fb92a7953f20ec4 /mysql-test | |
parent | fdd0e7078dcec0aa07c4719125d94241d9d0d6b1 (diff) | |
download | mariadb-git-80649ee8746aab02a198285248668cb49ce70f33.tar.gz |
Fix for BUG#1870
"CHANGE MASTER makes SQL thread restart from coordinates of I/O thread".
So, in CHANGE MASTER:
when it seems reasonable that the user did not want to discontinue
its replication (i.e. when he is not specifying host or port or master_log_file
or master_log_pos; this will be documented), set the coordinates of the
I/O thread to those of the SQL thread. This way, the SQL thread will see
no discontinuity in the relay log (i.e. will skip no events), because
the I/O thread will fill the brand new relay log with the events which
are just after the position where the SQL thread had stopped
(before CHANGE MASTER was issued).
And a new test for this bug.
mysql-test/r/rpl_loaddata.result:
Now, after CHANGE MASTER the coordinates of the I/O thread are the last ones of the SQL thread, so result update.
sql/sql_repl.cc:
Fix for BUG#1870
"CHANGE MASTER makes SQL thread restart from coordinates of I/O thread".
So, in CHANGE MASTER:
when it seems reasonable that the user did not want to discontinue
its replication (i.e. when he is not specifying host or port or master_log_file
or master_log_pos; this will be documented), set the coordinates of the
I/O thread to those of the SQL thread. This way, the SQL thread will see
no discontinuity in the relay log (i.e. will skip no events), because
the I/O thread will fill the brand new relay log with the events which
are just after the position where the SQL thread had stopped
(before CHANGE MASTER was issued).
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/rpl_change_master.result | 32 | ||||
-rw-r--r-- | mysql-test/r/rpl_loaddata.result | 2 | ||||
-rw-r--r-- | mysql-test/t/rpl_change_master.test | 26 |
3 files changed, 59 insertions, 1 deletions
diff --git a/mysql-test/r/rpl_change_master.result b/mysql-test/r/rpl_change_master.result new file mode 100644 index 00000000000..be2aec616b0 --- /dev/null +++ b/mysql-test/r/rpl_change_master.result @@ -0,0 +1,32 @@ +slave stop; +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; +slave start; +select get_lock("a",5); +get_lock("a",5) +1 +create table t1(n int); +insert into t1 values(1+get_lock("a",10)*0); +insert into t1 values(2); +stop slave; +select * from t1; +n +1 +show slave status; +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root 9306 1 master-bin.001 273 slave-relay-bin.002 255 master-bin.001 No No 0 0 214 314 +change master to master_user='root'; +show slave status; +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root 9306 1 master-bin.001 214 slave-relay-bin.001 4 master-bin.001 No No 0 0 214 4 +select release_lock("a"); +release_lock("a") +1 +start slave; +select * from t1; +n +1 +2 +drop table t1; diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index 8b910d0d183..268e383ce69 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -43,7 +43,7 @@ change master to master_user='test'; change master to master_user='root'; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.001 1442 slave-relay-bin.001 4 master-bin.001 No No 0 0 1442 4 +127.0.0.1 root MASTER_PORT 1 master-bin.001 1419 slave-relay-bin.001 4 master-bin.001 No No 0 0 1419 4 set global sql_slave_skip_counter=1; start slave; set sql_log_bin=0; diff --git a/mysql-test/t/rpl_change_master.test b/mysql-test/t/rpl_change_master.test new file mode 100644 index 00000000000..61de22fe57b --- /dev/null +++ b/mysql-test/t/rpl_change_master.test @@ -0,0 +1,26 @@ +source include/master-slave.inc; + +connection slave; +select get_lock("a",5); +connection master; +create table t1(n int); +insert into t1 values(1+get_lock("a",10)*0); +insert into t1 values(2); +save_master_pos; +connection slave; +sleep 3; # can't sync_with_master as we should be blocked +stop slave; +select * from t1; +show slave status; +change master to master_user='root'; +show slave status; +# Will restart from after the values(2), which is bug +select release_lock("a"); +start slave; +sync_with_master; +select * from t1; +connection master; +drop table t1; +save_master_pos; +connection slave; +sync_with_master; |