From 2392c3abd754f0cf8a9b73aca73e84dfa8c1f1e4 Mon Sep 17 00:00:00 2001 From: "sasha@mysql.sashanet.com" <> Date: Wed, 11 Apr 2001 16:29:15 -0600 Subject: [PATCH 1/2] fixed bugs in the new stuff in rpl000001 test start slave thread if master.info is present and server_id is set updates for rpl000015 and rpl000016 to remove master.info to make sure master info struct does not get auto-initialized --- BitKeeper/etc/logging_ok | 1 + Docs/manual.texi | 12 ++++++++++++ mysql-test/r/rpl000001.result | 2 +- mysql-test/t/rpl000001.test | 8 ++++++++ mysql-test/t/rpl000015-slave.sh | 1 + mysql-test/t/rpl000015.test | 2 +- mysql-test/t/rpl000016-slave.sh | 1 + sql/mysqld.cc | 13 +++++++++++++ 8 files changed, 38 insertions(+), 2 deletions(-) create mode 100755 mysql-test/t/rpl000015-slave.sh create mode 100755 mysql-test/t/rpl000016-slave.sh diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 1c3bdac2b9f..1083d6ebbab 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -1 +1,2 @@ heikki@donna.mysql.fi +sasha@mysql.sashanet.com diff --git a/Docs/manual.texi b/Docs/manual.texi index c8b15e16036..d804e7b506a 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -42845,6 +42845,18 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.37 @itemize @bullet @item +Slave thread will now be started even if @code{master-host} is not set, as +long as @code{server-id} is set and valid @code{master.info} is present +@item +Partial updates ( terminated with kill) are now logged with a special error +code to the binary log. Slave will refuse to execute them if the error code +indicates the update was terminated abnormally, and will have to be recovered +with @code{SET SQL_SLAVE_SKIP_COUNTER=1; SLAVE START} after a manual sanity +check/correction of data integrity +@item +Fixed bug that erroneously logged a drop of internal temporary table + on thread termination to the binary log - bug affected replication +@item Fixed a bug in @code{REGEXP()} on 64-bit machines. @item @code{UPDATE} and @code{DELETE} with @code{WHERE unique_key_part IS NULL} diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result index 57621d1ec0b..925c5599d77 100644 --- a/mysql-test/r/rpl000001.result +++ b/mysql-test/r/rpl000001.result @@ -6,7 +6,7 @@ sum(length(word)) (@id := id) - id 0 Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter -127.0.0.1 root 9306 1 master-bin.001 1729584 No 1053 Slave: query ' update t1 set n = n + 1' partially completed on the master and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET SQL_SLAVE_SKIP_COUNTER=1; SLAVE START; 0 +127.0.0.1 root 9306 1 master-bin.001 1729137 No 1053 Slave: query ' update t1 set n = n + 1' partially completed on the master and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET SQL_SLAVE_SKIP_COUNTER=1; SLAVE START; 0 count(*) 30000 n diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test index c2a6b2aaec9..1170cbebeaf 100644 --- a/mysql-test/t/rpl000001.test +++ b/mysql-test/t/rpl000001.test @@ -20,7 +20,13 @@ drop table t1; save_master_pos; connection slave; sync_with_master; + #test handling of aborted connection in the middle of update +connection master; +reset master; +connection slave; +reset slave; + connection master; drop table if exists t1,t2; create table t1(n int); @@ -44,6 +50,8 @@ connection master; reap; connection slave; sync_with_master ; +#give the slave a chance to exit +sleep 0.5; show slave status; set sql_slave_skip_counter=1; slave start; diff --git a/mysql-test/t/rpl000015-slave.sh b/mysql-test/t/rpl000015-slave.sh new file mode 100755 index 00000000000..a421a6f287b --- /dev/null +++ b/mysql-test/t/rpl000015-slave.sh @@ -0,0 +1 @@ +rm $MYSQL_TEST_DIR/var/slave-data/master.info diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index ce04b18d2e8..0cf87d0fae4 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -13,7 +13,7 @@ show slave status; change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=9306; show slave status; -slave start; +!slave start; sync_with_master; show slave status; connection master; diff --git a/mysql-test/t/rpl000016-slave.sh b/mysql-test/t/rpl000016-slave.sh new file mode 100755 index 00000000000..a421a6f287b --- /dev/null +++ b/mysql-test/t/rpl000016-slave.sh @@ -0,0 +1 @@ +rm $MYSQL_TEST_DIR/var/slave-data/master.info diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d09ad7513e0..ccdcda7f180 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -17,6 +17,7 @@ #include "mysql_priv.h" #include #include +#include #include "sql_acl.h" #include "slave.h" #ifdef HAVE_BERKELEY_DB @@ -1712,6 +1713,18 @@ int main(int argc, char **argv) using_update_log=1; } + //make sure slave thread gets started + // if server_id is set, valid master.info is present, and master_host has + // not been specified + if(server_id && !master_host) + { + char fname[FN_REFLEN+128]; + MY_STAT stat_area; + fn_format(fname, master_info_file, mysql_data_home, "", 4+16+32); + if(my_stat(fname, &stat_area, MYF(0)) && !init_master_info(&glob_mi)) + master_host = glob_mi.host; + } + if (opt_bin_log && !server_id) { server_id= !master_host ? 1 : 2; From b292cdc2e95fd963d35b264540bdb25a718a28f6 Mon Sep 17 00:00:00 2001 From: "sasha@mysql.sashanet.com" <> Date: Wed, 11 Apr 2001 16:36:07 -0600 Subject: [PATCH 2/2] mysql-test/t/rpl000015.test reversed incorrect temporary change --- mysql-test/t/rpl000015.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index 0cf87d0fae4..ce04b18d2e8 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -13,7 +13,7 @@ show slave status; change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=9306; show slave status; -!slave start; +slave start; sync_with_master; show slave status; connection master;