diff options
author | Sven Sandberg <sven.sandberg@oracle.com> | 2011-03-25 15:16:13 +0100 |
---|---|---|
committer | Sven Sandberg <sven.sandberg@oracle.com> | 2011-03-25 15:16:13 +0100 |
commit | 257e39aa44a9d035575846ad4f3e3a0fbeff0667 (patch) | |
tree | 2b5fa95c1dfd66757d984c5d237e2ff8432bd415 /client | |
parent | aee26192c79a1c92eed376d2fa3b4067c4c9e8a4 (diff) | |
download | mariadb-git-257e39aa44a9d035575846ad4f3e3a0fbeff0667.tar.gz |
BUG#11766427, BUG#59539: Filter by server id in mysqlbinlog fails
Problem: mysqlbinlog --server-id may filter out Format_description_log_events.
If mysqlbinlog does not process the Format_description_log_event,
then mysqlbinlog cannot read the rest of the binary log correctly.
This can have the effect that mysqlbinlog crashes, generates an error,
or generates output that causes mysqld to crash, generate an error,
or corrupt data.
Fix: Never filter out Format_description_log_events. Also, never filter
out Rotate_log_events.
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqlbinlog.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index dec3f142798..30a8bddc17c 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -705,10 +705,18 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, */ start_datetime= 0; offset= 0; // print everything and protect against cycling rec_count + /* + Skip events according to the --server-id flag. However, don't + skip format_description or rotate events, because they they + are really "global" events that are relevant for the entire + binlog, even if they have a server_id. Also, we have to read + the format_description event so that we can parse subsequent + events. + */ + if (ev_type != ROTATE_EVENT && + server_id && (server_id != ev->server_id)) + goto end; } - if (server_id && (server_id != ev->server_id)) - /* skip just this event, continue processing the log. */ - goto end; if (((my_time_t)(ev->when) >= stop_datetime) || (pos >= stop_position_mot)) { |