summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorSven Sandberg <sven.sandberg@oracle.com>2011-03-25 15:16:13 +0100
committerSven Sandberg <sven.sandberg@oracle.com>2011-03-25 15:16:13 +0100
commitf1b638d33cdf95b70fa925cce304864c96fdf7ee (patch)
tree2b5fa95c1dfd66757d984c5d237e2ff8432bd415 /client
parent5af973582dcec824411f2d43bf41d38d8298abf3 (diff)
downloadmariadb-git-f1b638d33cdf95b70fa925cce304864c96fdf7ee.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. client/mysqlbinlog.cc: Process Format_description_log_events even when the server_id does not match the number given by --server-id. mysql-test/t/mysqlbinlog.test: Add test case.
Diffstat (limited to 'client')
-rw-r--r--client/mysqlbinlog.cc14
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))
{