mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user