From: Date: December 12 2006 7:58pm Subject: bk commit into 5.0 tree (aelkin:1.2347) BUG#20435 List-Archive: http://lists.mysql.com/commits/16851 X-Bug: 20435 Message-Id: <200612121858.kBCIwBlU011059@dsl-hkibras-fe30f900-107.dhcp.inet.fi> Below is the list of changes that have just been committed into a local 5.0 repository of elkin. When elkin does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2006-12-12 20:58:02+02:00, aelkin@stripped +1 -0 Bug #20435 Relay logs are rotated at slave_net_timeout when there's no activity Rotate events were generated locally on slave after reconnecting to the master upon slave_net_timeout expired while there were no events from master. That's the way how failure detection for master was originally implemented. Leaving aside the algorithm of failure detection (the first patch tries to solve rotation problem from that perspective) we refine behavour on slave's side to not rotate relay log files when master does not bring with rotate event its current postion different from slave's view. Relay logs don't rotate while master postion in rotate events is stable. sql/slave.cc@stripped, 2006-12-12 20:57:59+02:00, aelkin@stripped +7 -3 boolean flag in process_io_rotate to call the file rotating function iff master has moved on relatively the last position slave has known. # 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: aelkin # Host: dsl-hkibras-fe30f900-107.dhcp.inet.fi # Root: /home/elkin/MySQL/TEAM/FIXES/5.0/bug20435_relay_rot_reconn_fix2 --- 1.286/sql/slave.cc 2006-12-12 20:58:11 +02:00 +++ 1.287/sql/slave.cc 2006-12-12 20:58:11 +02:00 @@ -4131,15 +4131,18 @@ err: static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev) { + bool master_moved= FALSE; DBUG_ENTER("process_io_rotate"); safe_mutex_assert_owner(&mi->data_lock); if (unlikely(!rev->is_valid())) DBUG_RETURN(1); + if ((master_moved= strcmp(mi->master_log_name, rev->new_log_ident)) != 0) /* Safe copy as 'rev' has been "sanitized" in Rotate_log_event's ctor */ - memcpy(mi->master_log_name, rev->new_log_ident, rev->ident_len+1); - mi->master_log_pos= rev->pos; + memcpy(mi->master_log_name, rev->new_log_ident, rev->ident_len+1); + if ((master_moved= master_moved || (mi->master_log_pos != rev->pos))) + mi->master_log_pos= rev->pos; DBUG_PRINT("info", ("master_log_pos: '%s' %lu", mi->master_log_name, (ulong) mi->master_log_pos)); #ifndef DBUG_OFF @@ -4169,7 +4172,8 @@ static int process_io_rotate(MASTER_INFO Rotate the relay log makes binlog format detection easier (at next slave start or mysqlbinlog) */ - rotate_relay_log(mi); /* will take the right mutexes */ + if (master_moved) + rotate_relay_log(mi); /* will take the right mutexes */ DBUG_RETURN(0); }