From 617ea4d631e57704fcba39db8edbd0807d5adc04 Mon Sep 17 00:00:00 2001 From: "sven@riska.(none)" <> Date: Thu, 10 Jan 2008 16:39:44 +0100 Subject: BUG#27779: Slave cannot read old rows log events. Problem: Replication fails when master is mysql-5.1-wl2325-5.0-drop6 and slave is mysql-5.1-new-rpl. The reason is that, in mysql-5.1-wl2325-5.0-drop6, the event type id's were different than in mysql-5.1-new-rpl. Fix (in mysql-5.1-new-rpl): (1) detect that the server that generated the events uses the old format, by checking the server version of the format_description_log_event This patch recognizes mysql-5.1-wl2325-5.0-drop6p13-alpha, mysql-5.1-wl2325-5.0-drop6, mysql-5.1-wl2325-5.0, mysql-5.1-wl2325-no-dd. (2) if the generating server is old, map old event types to new event types using a permutation array. I've also added a test case which reads binlogs for four different versions. --- sql/log_event.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sql/log_event.h') diff --git a/sql/log_event.h b/sql/log_event.h index 4a75f330203..31c1ab7173a 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -2106,12 +2106,16 @@ public: /* The list of post-headers' lengthes */ uint8 *post_header_len; uchar server_version_split[3]; + const uint8 *event_type_permutation; Format_description_log_event(uint8 binlog_ver, const char* server_ver=0); Format_description_log_event(const char* buf, uint event_len, const Format_description_log_event *description_event); - ~Format_description_log_event() { my_free((uchar*)post_header_len, MYF(0)); } + ~Format_description_log_event() + { + my_free((uchar*)post_header_len, MYF(MY_ALLOW_ZERO_PTR)); + } Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;} #ifndef MYSQL_CLIENT bool write(IO_CACHE* file); -- cgit v1.2.1