r24126 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24125‎ | r24126 | r24127 >
Date:12:35, 15 July 2007
Author:river
Status:old
Tags:
Comment:
would crash when rotating binlogs, check e->le_database is actually valid (not
for ET_SYNC events)
Modified paths:
  • /trunk/tools/trainwreck/trainwreck.c (modified) (history)

Diff [purge]

Index: trunk/tools/trainwreck/trainwreck.c
@@ -937,15 +937,18 @@
938938
939939 self->wr_status = ST_EXECUTING;
940940 self->wr_last_executed_time = e->le_time;
941 - if (mysql_select_db(self->wr_conn, e->le_database) != 0) {
942 - logmsg("%s,%lu: cannot select \"%s\": %s",
943 - e->le_file, (unsigned long) e->le_pos,
944 - e->le_database, mysql_error(self->wr_conn));
945 - exit(1);
946 - }
 941+
 942+ if (e->le_database && *e->le_database)
 943+ if (mysql_select_db(self->wr_conn, e->le_database) != 0) {
 944+ logmsg("%s,%lu: cannot select \"%s\": %s",
 945+ e->le_file, (unsigned long) e->le_pos,
 946+ e->le_database, mysql_error(self->wr_conn));
 947+ exit(1);
 948+ }
947949
948950 switch (e->le_type) {
949951 case ET_SYNC:
 952+ logmsg("syncing for binlog rotation...");
950953 sync_ack(self);
951954 break;
952955
@@ -993,6 +996,7 @@
994997 {
995998 pthread_mutex_lock(&sync_mtx);
996999 --nsyncs;
 1000+ pthread_cond_signal(&sync_cond);
9971001 pthread_mutex_unlock(&sync_mtx);
9981002 }
9991003

Status & tagging log