Below is the list of changes that have just been commited into a local
3.23. repository of sasha. When sasha 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
ChangeSet@stripped, 2001-06-28 18:22:29-06:00, sasha@stripped
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-outgoing
1.1 01/06/28 18:22:28 sasha@stripped +3 -0
mysql-test/r/rpl_sporadic_master.result
1.1 01/06/28 18:22:28 sasha@stripped +7 -0
mysql-test/t/rpl_sporadic_master-master.opt
1.1 01/06/28 18:22:28 sasha@stripped +1 -0
mysql-test/t/rpl_sporadic_master.test
1.1 01/06/28 18:22:28 sasha@stripped +24 -0
BitKeeper/triggers/post-incoming
1.1 01/06/28 18:22:27 sasha@stripped +3 -0
BitKeeper/triggers/post-outgoing
1.0 01/06/28 18:22:28 sasha@stripped +0 -0
BitKeeper file /home/sasha/src/bk/mysql/BitKeeper/triggers/post-outgoing
mysql-test/r/rpl_sporadic_master.result
1.0 01/06/28 18:22:28 sasha@stripped +0 -0
BitKeeper file /home/sasha/src/bk/mysql/mysql-test/r/rpl_sporadic_master.result
mysql-test/t/rpl_sporadic_master-master.opt
1.0 01/06/28 18:22:28 sasha@stripped +0 -0
BitKeeper file /home/sasha/src/bk/mysql/mysql-test/t/rpl_sporadic_master-master.opt
mysql-test/t/rpl_sporadic_master.test
1.0 01/06/28 18:22:28 sasha@stripped +0 -0
BitKeeper file /home/sasha/src/bk/mysql/mysql-test/t/rpl_sporadic_master.test
BitKeeper/triggers/post-commit
1.12 01/06/28 18:22:27 sasha@stripped +6 -3
fixed message
BitKeeper/triggers/post-incoming
1.0 01/06/28 18:22:27 sasha@stripped +0 -0
BitKeeper file /home/sasha/src/bk/mysql/BitKeeper/triggers/post-incoming
sql/mysqld.cc
1.187 01/06/28 18:22:27 sasha@stripped +18 -1
added debugging options to force the master to occasionally break
replication
sql/slave.cc
1.105 01/06/28 18:22:27 sasha@stripped +8 -8
cosmetic change to improve readability
sql/sql_repl.cc
1.38 01/06/28 18:22:27 sasha@stripped +33 -0
support for --sporadic-binlog-dump-fail and --max-binlog-dump-events
sql/sql_repl.h
1.6 01/06/28 18:22:27 sasha@stripped +5 -0
support for --sporadic-binlog-dump-fail and --max-binlog-dump-events
# 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: sasha
# Host: mysql.sashanet.com
# Root: /home/sasha/src/bk/mysql
--- 1.186/sql/mysqld.cc Sun Jun 24 11:45:28 2001
+++ 1.187/sql/mysqld.cc Thu Jun 28 18:22:27 2001
@@ -20,6 +20,7 @@
#include <my_dir.h>
#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 @@
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 @@
(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 @@
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;
--- 1.104/sql/slave.cc Thu Jun 21 15:59:50 2001
+++ 1.105/sql/slave.cc Thu Jun 28 18:22:27 2001
@@ -1236,6 +1236,8 @@
goto err;
}
+connected:
+
while (!slave_killed(thd))
{
thd->proc_info = "Requesting binlog dump";
@@ -1278,10 +1280,9 @@
goto err;
}
- continue;
+ goto connected;
}
-
while(!slave_killed(thd))
{
thd->proc_info = "Reading master update";
@@ -1291,7 +1292,6 @@
sql_print_error("Slave thread killed while reading event");
goto err;
}
-
if (event_len == packet_error)
{
@@ -1329,8 +1329,9 @@
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 @@
events_till_disconnect++;
}
#endif
-
- }
- }
+ } // while(!slave_killed(thd)) - read/exec loop
+ } // while(!slave_killed(thd)) - slave loop
// error = 0;
err:
--- 1.11/BitKeeper/triggers/post-commit Mon Jun 11 20:26:21 2001
+++ 1.12/BitKeeper/triggers/post-commit Thu Jun 28 18:22:27 2001
@@ -37,9 +37,12 @@
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+
--- New file ---
+++ BitKeeper/triggers/post-incoming 01/06/28 18:22:27
#! /bin/sh
echo "Test: post-incoming works"
--- New file ---
+++ BitKeeper/triggers/post-outgoing 01/06/28 18:22:28
#! /bin/sh
echo "Test: post-outgoing works"
--- New file ---
+++ mysql-test/r/rpl_sporadic_master.result 01/06/28 18:22:28
n
1
2
3
4
5
6
--- New file ---
+++ mysql-test/t/rpl_sporadic_master-master.opt 01/06/28 18:22:28
--sporadic-binlog-dump-fail --max-binlog-dump-events=2
--- New file ---
+++ mysql-test/t/rpl_sporadic_master.test 01/06/28 18:22:28
#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;
--- 1.37/sql/sql_repl.cc Thu May 31 16:54:15 2001
+++ 1.38/sql/sql_repl.cc Thu Jun 28 18:22:27 2001
@@ -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 @@
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 @@
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()";
@@ -398,6 +422,15 @@
pthread_mutex_unlock(&thd->mysys_var->mutex);
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
--- 1.5/sql/sql_repl.h Tue Apr 24 17:39:26 2001
+++ 1.6/sql/sql_repl.h Thu Jun 28 18:22:27 2001
@@ -9,6 +9,11 @@
extern bool server_id_supplied;
extern I_List<i_string> 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);
| Thread |
|---|
| • bk commit into 3.23 tree | sasha | 29 Jun |