Commit e022ba60 authored by guilhem@mysql.com's avatar guilhem@mysql.com

Fix for BUG#3017

"wrong Relay_Log_Pos if Rotate is in the middle of a transaction in relay log"
increment 'pending' instead of 'relay_log_pos'.
parent e175101a
......@@ -10,4 +10,4 @@ reset slave;
start slave;
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.002 4 slave-relay-bin.002 161 master-bin.001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. Probably cause is that the master died while writing the transaction to it's binary log. 0 79 #
127.0.0.1 root MASTER_PORT 1 master-bin.002 4 slave-relay-bin.002 120 master-bin.001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. A probable cause is that the master died while writing the transaction to its binary log. 0 79 #
......@@ -2121,7 +2121,7 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
slave_print_error(rli, 0,
"\
Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. \
Probably cause is that the master died while writing the transaction to it's \
A probable cause is that the master died while writing the transaction to its \
binary log.");
return(1);
}
......@@ -2221,13 +2221,15 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
In that case, we don't want to touch the coordinates which correspond to the
beginning of the transaction.
*/
if (!rli->inside_transaction)
if (rli->inside_transaction)
rli->inc_pending(get_event_len());
else
{
memcpy(rli->master_log_name, new_log_ident, ident_len+1);
rli->master_log_pos= pos;
rli->relay_log_pos += get_event_len();
DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) rli->master_log_pos));
}
rli->relay_log_pos += get_event_len();
pthread_mutex_unlock(&rli->data_lock);
pthread_cond_broadcast(&rli->data_cond);
flush_relay_log_info(rli);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment