From 0640b4b5b4c022eab4507824eb45187bb9161137 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jun 2001 17:19:42 +0300 Subject: [PATCH 1/6] ha_innobase.cc Update possible row timestamp column also in an update sql/ha_innobase.cc: Update possible row timestamp column also in an update --- sql/ha_innobase.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 6bae31902c3..184c97837db 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -1523,6 +1523,10 @@ ha_innobase::update_row( DBUG_ENTER("ha_innobase::update_row"); + if (table->time_stamp) { + update_timestamp(new_row + table->time_stamp - 1); + } + if (last_query_id != user_thd->query_id) { prebuilt->sql_stat_start = TRUE; last_query_id = user_thd->query_id; From c7e200cdd8fcb0429442f6441e42500fea8f899c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jun 2001 18:22:29 -0600 Subject: [PATCH 2/6] fixed message in post-commit trigger added debugging options to master to behave sporadically, and a test case to make sure the slave can deal with it BitKeeper/triggers/post-commit: fixed message sql/mysqld.cc: added debugging options to force the master to occasionally break replication sql/slave.cc: cosmetic change to improve readability sql/sql_repl.cc: support for --sporadic-binlog-dump-fail and --max-binlog-dump-events sql/sql_repl.h: support for --sporadic-binlog-dump-fail and --max-binlog-dump-events --- BitKeeper/triggers/post-commit | 9 ++++-- BitKeeper/triggers/post-incoming | 3 ++ BitKeeper/triggers/post-outgoing | 3 ++ mysql-test/r/rpl_sporadic_master.result | 7 +++++ mysql-test/t/rpl_sporadic_master-master.opt | 1 + mysql-test/t/rpl_sporadic_master.test | 24 +++++++++++++++ sql/mysqld.cc | 19 +++++++++++- sql/slave.cc | 16 +++++----- sql/sql_repl.cc | 33 +++++++++++++++++++++ sql/sql_repl.h | 5 ++++ 10 files changed, 108 insertions(+), 12 deletions(-) create mode 100644 BitKeeper/triggers/post-incoming create mode 100755 BitKeeper/triggers/post-outgoing create mode 100644 mysql-test/r/rpl_sporadic_master.result create mode 100644 mysql-test/t/rpl_sporadic_master-master.opt create mode 100644 mysql-test/t/rpl_sporadic_master.test diff --git a/BitKeeper/triggers/post-commit b/BitKeeper/triggers/post-commit index 619b6f88cea..dc5f2f2b824 100755 --- a/BitKeeper/triggers/post-commit +++ b/BitKeeper/triggers/post-commit @@ -37,9 +37,12 @@ From: $FROM To: $INTERNALS Subject: bk commit into 3.23 tree -Below is the list of changes that have just been pushed into main -3.23. repository. For information on how to access the repository -see http://www.mysql.com/doc/I/n/Installing_source_tree.html +Below is the list of changes that have just been commited into a local +3.23. repository of $USER. When $USER does a push, they will be +propogaged to the main repository and within 24 hours after the push into +the public repository. For information on how to access +the public repository see +http://www.mysql.com/doc/I/n/Installing_source_tree.html EOF bk changes -v -r+ diff --git a/BitKeeper/triggers/post-incoming b/BitKeeper/triggers/post-incoming new file mode 100644 index 00000000000..f1ea2255de9 --- /dev/null +++ b/BitKeeper/triggers/post-incoming @@ -0,0 +1,3 @@ +#! /bin/sh + +echo "Test: post-incoming works" diff --git a/BitKeeper/triggers/post-outgoing b/BitKeeper/triggers/post-outgoing new file mode 100755 index 00000000000..3fc2cdbad67 --- /dev/null +++ b/BitKeeper/triggers/post-outgoing @@ -0,0 +1,3 @@ +#! /bin/sh + +echo "Test: post-outgoing works" diff --git a/mysql-test/r/rpl_sporadic_master.result b/mysql-test/r/rpl_sporadic_master.result new file mode 100644 index 00000000000..414468f0998 --- /dev/null +++ b/mysql-test/r/rpl_sporadic_master.result @@ -0,0 +1,7 @@ +n +1 +2 +3 +4 +5 +6 diff --git a/mysql-test/t/rpl_sporadic_master-master.opt b/mysql-test/t/rpl_sporadic_master-master.opt new file mode 100644 index 00000000000..6d5b66bed61 --- /dev/null +++ b/mysql-test/t/rpl_sporadic_master-master.opt @@ -0,0 +1 @@ +--sporadic-binlog-dump-fail --max-binlog-dump-events=2 diff --git a/mysql-test/t/rpl_sporadic_master.test b/mysql-test/t/rpl_sporadic_master.test new file mode 100644 index 00000000000..ce6568f659e --- /dev/null +++ b/mysql-test/t/rpl_sporadic_master.test @@ -0,0 +1,24 @@ +#test to see if replication can continue when master sporadically fails on +# COM_BINLOG_DUMP and additionally limits the number of events per dump +source include/master-slave.inc; +connection master; +drop table if exists t1; +create table t1(n int not null auto_increment primary key); +insert into t1 values (NULL),(NULL); +delete from t1; +insert into t1 values (NULL),(NULL); +insert into t1 values (NULL),(NULL); +flush logs; +delete from t1; +insert into t1 values (NULL),(NULL); +insert into t1 values (NULL),(NULL); +insert into t1 values (NULL),(NULL); +save_master_pos; +connection slave; +sync_with_master; +select * from t1; +connection master; +drop table t1; +save_master_pos; +connection slave; +sync_with_master; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 991b0e73c51..361479b4365 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -20,6 +20,7 @@ #include #include "sql_acl.h" #include "slave.h" +#include "sql_repl.h" #include "stacktrace.h" #ifdef HAVE_BERKELEY_DB #include "ha_berkeley.h" @@ -2461,7 +2462,8 @@ enum options { OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_GEMINI_FLUSH_LOG, OPT_GEMINI_RECOVER, OPT_GEMINI_UNBUFFERED_IO, OPT_SKIP_SAFEMALLOC, - OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS + OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, + OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL }; static struct option long_options[] = { @@ -2545,6 +2547,10 @@ static struct option long_options[] = { (int) OPT_DISCONNECT_SLAVE_EVENT_COUNT}, {"abort-slave-event-count", required_argument, 0, (int) OPT_ABORT_SLAVE_EVENT_COUNT}, + {"max-binlog-dump-events", required_argument, 0, + (int) OPT_MAX_BINLOG_DUMP_EVENTS}, + {"sporadic-binlog-dump-fail", no_argument, 0, + (int) OPT_SPORADIC_BINLOG_DUMP_FAIL}, {"safemalloc-mem-limit", required_argument, 0, (int) OPT_SAFEMALLOC_MEM_LIMIT}, {"new", no_argument, 0, 'n'}, @@ -3301,6 +3307,17 @@ static void get_options(int argc,char **argv) abort_slave_event_count = atoi(optarg); #endif break; + case (int)OPT_SPORADIC_BINLOG_DUMP_FAIL: +#ifndef DBUG_OFF + opt_sporadic_binlog_dump_fail = 1; +#endif + break; + case (int)OPT_MAX_BINLOG_DUMP_EVENTS: +#ifndef DBUG_OFF + max_binlog_dump_events = atoi(optarg); +#endif + break; + case (int) OPT_LOG_SLAVE_UPDATES: opt_log_slave_updates = 1; break; diff --git a/sql/slave.cc b/sql/slave.cc index a768e8494a0..9b9a4041616 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1236,6 +1236,8 @@ pthread_handler_decl(handle_slave,arg __attribute__((unused))) goto err; } +connected: + while (!slave_killed(thd)) { thd->proc_info = "Requesting binlog dump"; @@ -1278,10 +1280,9 @@ try again, log '%s' at postion %s", RPL_LOG_NAME, goto err; } - continue; + goto connected; } - while(!slave_killed(thd)) { thd->proc_info = "Reading master update"; @@ -1291,7 +1292,6 @@ try again, log '%s' at postion %s", RPL_LOG_NAME, sql_print_error("Slave thread killed while reading event"); goto err; } - if (event_len == packet_error) { @@ -1329,8 +1329,9 @@ reconnecting to retry, log '%s' position %s", RPL_LOG_NAME, reconnect done to recover from failed read"); goto err; } - break; - } + + goto connected; + } // if(event_len == packet_error) thd->proc_info = "Processing master log event"; if(exec_event(thd, &mysql->net, &glob_mi, event_len)) @@ -1373,9 +1374,8 @@ the slave thread with \"mysqladmin start-slave\". We stopped at log \ events_till_disconnect++; } #endif - - } - } + } // while(!slave_killed(thd)) - read/exec loop + } // while(!slave_killed(thd)) - slave loop // error = 0; err: diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 7ddf04f1b9a..a5bbe8551cb 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -27,6 +27,11 @@ extern const char* any_db; extern pthread_handler_decl(handle_slave,arg); +#ifndef DBUG_OFF +int max_binlog_dump_events = 0; // unlimited +bool opt_sporadic_binlog_dump_fail = 0; +static int binlog_dump_count = 0; +#endif static int fake_rotate_event(NET* net, String* packet, char* log_file_name, const char**errmsg) @@ -265,8 +270,19 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags) int error; const char *errmsg = "Unknown error"; NET* net = &thd->net; +#ifndef DBUG_OFF + int left_events = max_binlog_dump_events; +#endif DBUG_ENTER("mysql_binlog_send"); +#ifndef DBUF_OFF + if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2)) + { + errmsg = "Master failed COM_BINLOG_DUMP to test if slave can recover"; + goto err; + } +#endif + bzero((char*) &log,sizeof(log)); if(!mysql_bin_log.is_open()) @@ -325,6 +341,14 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags) while (!(error = Log_event::read_log_event(&log, packet, log_lock))) { +#ifndef DBUG_OFF + if(max_binlog_dump_events && !left_events--) + { + net_flush(net); + errmsg = "Debugging binlog dump abort"; + goto err; + } +#endif if (my_net_write(net, (char*)packet->ptr(), packet->length()) ) { errmsg = "Failed on my_net_write()"; @@ -399,6 +423,15 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags) bool read_packet = 0, fatal_error = 0; +#ifndef DBUG_OFF + if(max_binlog_dump_events && !left_events--) + { + net_flush(net); + errmsg = "Debugging binlog dump abort"; + goto err; + } +#endif + // no one will update the log while we are reading // now, but we'll be quick and just read one record pthread_mutex_lock(log_lock); diff --git a/sql/sql_repl.h b/sql/sql_repl.h index 68f2b4ba6c4..c6a79ec4650 100644 --- a/sql/sql_repl.h +++ b/sql/sql_repl.h @@ -9,6 +9,11 @@ extern uint32 server_id; extern bool server_id_supplied; extern I_List binlog_do_db, binlog_ignore_db; +#ifndef DBUG_OFF +extern int max_binlog_dump_events; +extern bool opt_sporadic_binlog_dump_fail; +#endif + File open_binlog(IO_CACHE *log, const char *log_file_name, const char **errmsg); From 656d118a586d99180843899f33b5963e4c832da3 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jun 2001 18:41:51 -0600 Subject: [PATCH 3/6] chmod +x on post-incoming trigger BitKeeper/triggers/post-incoming: Change mode to -rwxrwxr-x --- BitKeeper/triggers/post-incoming | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 BitKeeper/triggers/post-incoming diff --git a/BitKeeper/triggers/post-incoming b/BitKeeper/triggers/post-incoming old mode 100644 new mode 100755 From 0a584af4617ee25f06aa5aedb5274ec657f24e7f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jun 2001 19:17:04 -0600 Subject: [PATCH 4/6] fixed typo --- sql/sql_repl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index a5bbe8551cb..b0c7e64a5e0 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -275,7 +275,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags) #endif DBUG_ENTER("mysql_binlog_send"); -#ifndef DBUF_OFF +#ifndef DBUG_OFF if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2)) { errmsg = "Master failed COM_BINLOG_DUMP to test if slave can recover"; From 7c7647850b3cea2cf99c81cb994565042c8b0e9e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jun 2001 19:19:23 -0600 Subject: [PATCH 5/6] fixed float test result for updated test case mysql-test/r/type_float.result: fixed test result --- mysql-test/r/type_float.result | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 93a38e9967f..30a2f884557 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -2,6 +2,8 @@ 10 10.0 10 10 10 6e-05 -6e-05 --6e-05 -6e-05+1.000000 6e-05 -6e-05 6e-05 0.99994 +1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1 +10 10 10 10 10 10 0.1 0.1 0.1 Field Type Null Key Default Extra Privileges f1 float YES NULL select,insert,update,references f2 double YES NULL select,insert,update,references From 96eb526088b58b4930219fdb46eb6bd2fc3adcbc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 Jun 2001 04:21:01 +0300 Subject: [PATCH 6/6] Updated float test result --- mysql-test/r/type_float.result | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 93a38e9967f..30a2f884557 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -2,6 +2,8 @@ 10 10.0 10 10 10 6e-05 -6e-05 --6e-05 -6e-05+1.000000 6e-05 -6e-05 6e-05 0.99994 +1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1 +10 10 10 10 10 10 0.1 0.1 0.1 Field Type Null Key Default Extra Privileges f1 float YES NULL select,insert,update,references f2 double YES NULL select,insert,update,references