Commit d75aa055 authored by unknown's avatar unknown

Bug#27171 mysqlbinlog produces different output depends from option -R

a better fix, that works with 4.1 servers which don't send a fake
Format_description_log_event.

parent 27a116aa
...@@ -1042,7 +1042,7 @@ static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, ...@@ -1042,7 +1042,7 @@ static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
uint logname_len; uint logname_len;
NET* net; NET* net;
int error= 0; int error= 0;
my_off_t old_off= min(start_position_mot, BIN_LOG_HEADER_SIZE); my_off_t old_off= start_position_mot;
char fname[FN_REFLEN+1]; char fname[FN_REFLEN+1];
DBUG_ENTER("dump_remote_log_entries"); DBUG_ENTER("dump_remote_log_entries");
...@@ -1160,6 +1160,18 @@ could be out of memory"); ...@@ -1160,6 +1160,18 @@ could be out of memory");
len= 1; // fake Rotate, so don't increment old_off len= 1; // fake Rotate, so don't increment old_off
} }
} }
else if (type == FORMAT_DESCRIPTION_EVENT)
{
/*
This could be an fake Format_description_log_event that server
(5.0+) automatically sends to a slave on connect, before sending
a first event at the requested position. If this is the case,
don't increment old_off. Real Format_description_log_event always
starts from BIN_LOG_HEADER_SIZE position.
*/
if (old_off != BIN_LOG_HEADER_SIZE)
len= 1; // fake event, don't increment old_off
}
if ((error= process_event(print_event_info, ev, old_off))) if ((error= process_event(print_event_info, ev, old_off)))
{ {
error= ((error < 0) ? 0 : 1); error= ((error < 0) ? 0 : 1);
...@@ -1196,14 +1208,7 @@ could be out of memory"); ...@@ -1196,14 +1208,7 @@ could be out of memory");
/* /*
Let's adjust offset for remote log as for local log to produce Let's adjust offset for remote log as for local log to produce
similar text and to have --stop-position to work identically. similar text and to have --stop-position to work identically.
Exception - the server sends Format_description_log_event
in the beginning of the dump, and only after it the event from
start_position. Let the old_off reflect it.
*/ */
if (old_off < start_position_mot)
old_off= start_position_mot;
else
old_off+= len-1; old_off+= len-1;
} }
......
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