diff options
Diffstat (limited to 'client/mysqlbinlog.cc')
-rw-r--r-- | client/mysqlbinlog.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 2a070d14f0d..a371981e24d 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1105,7 +1105,7 @@ could be out of memory"); } if (len < 8 && net->read_pos[0] == 254) break; // end of data - DBUG_PRINT("info",( "len: %lu, net->read_pos[5]: %d\n", + DBUG_PRINT("info",( "len: %lu net->read_pos[5]: %d\n", len, net->read_pos[5])); if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 , len - 1, &error_msg, @@ -1160,6 +1160,18 @@ could be out of memory"); 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))) { error= ((error < 0) ? 0 : 1); @@ -1172,16 +1184,16 @@ could be out of memory"); const char *old_fname= le->fname; uint old_len= le->fname_len; File file; - + if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0) { error= 1; goto err; } - + if ((error= process_event(print_event_info, ev, old_off))) { - my_close(file,MYF(MY_WME)); + my_close(file,MYF(MY_WME)); error= ((error < 0) ? 0 : 1); goto err; } @@ -1194,8 +1206,8 @@ could be out of memory"); } } /* - Let's adjust offset for remote log as for local log to produce - similar text. + Let's adjust offset for remote log as for local log to produce + similar text and to have --stop-position to work identically. */ old_off+= len-1; } |