summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-03-01 00:46:31 +0100
committerunknown <guilhem@mysql.com>2004-03-01 00:46:31 +0100
commitbf53c870499fac500ef34f0880a4da18c08e417d (patch)
treec457d38e3e145f030e60533c5b35346abfbe4a23 /sql/log_event.cc
parent343680f46e4100c98d82e1190b37dbbc9c5e5341 (diff)
downloadmariadb-git-bf53c870499fac500ef34f0880a4da18c08e417d.tar.gz
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'. mysql-test/r/rpl_trunc_binlog.result: result update sql/log_event.cc: - corrected error message - in Rotate_log_event::exec_event(), if we're in a transaction (which can happen if the I/O slave thread reconnected while reading a transaction), don't increment relay_log_pos but pending instead. Otherwise, relay_log_pos becomes garbage (and so if slave stops at that moment, it will never restart).
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 61a1ee24973..038c17ffaba 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -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);