1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +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
This commit is contained in:
sasha@mysql.sashanet.com
2001-06-28 18:22:29 -06:00
parent a3208140f9
commit 2e4d264c27
10 changed files with 108 additions and 12 deletions

View File

@@ -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);