Hi Sven!
I'm missing a test case to check that it really can replicate old
events. You could construct one by taking the old slave, generating a
binary log with write, delete, and update events, and then dump it using
mysqlbinlog. You can then take the BINLOG statements in the binary log
and create a test case from them.
Just my few cents,
Mats Kindahl
Sven Sandberg wrote:
> Below is the list of changes that have just been committed into a local
> 5.1 repository of sven. When sven does a push these changes will
> be propagated to the main repository and, within 24 hours after the
> push, to the public repository.
> For information on how to access the public repository
> see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
>
> ChangeSet@stripped, 2007-10-31 11:43:35+01:00, sven@murkla.(none) +2 -0
> BUG#31581: 5.1-telco-6.1 -> 5.1.22. Slave crashes during starting
>
> Made the event_type argument for Old_rows_log_event(char *...) constructor
> be PRE_GA_*_ROWS_EVENT instead of *_ROWS_EVENT (this fixes the bug).
>
> Also removed xget_type_code() and used get_type_code() instead (the x version
> was introduced in previous patch just to make it compile).
>
> sql/log_event_old.cc@stripped, 2007-10-31 11:43:31+01:00, sven@murkla.(none) +11 -8
> Made the event_type argument for Old_rows_log_event(char *...) constructor
> be PRE_GA_*_ROWS_EVENT instead of *_ROWS_EVENT (this fixes the bug). Also
> removed xget_type_code() and used get_type_code() instead.
>
> sql/log_event_old.h@stripped, 2007-10-31 11:43:31+01:00, sven@murkla.(none) +0 -25
> Removed xget_type_code(), it was only used to make previous patch work.
>
> diff -Nrup a/sql/log_event_old.cc b/sql/log_event_old.cc
> --- a/sql/log_event_old.cc 2007-10-31 11:09:13 +01:00
> +++ b/sql/log_event_old.cc 2007-10-31 11:43:31 +01:00
> @@ -1338,7 +1338,7 @@ Old_rows_log_event::Old_rows_log_event(c
>
> m_cols_ai.bitmap= m_cols.bitmap; /* See explanation in is_valid() */
>
> - if (event_type == UPDATE_ROWS_EVENT)
> + if (event_type == PRE_GA_UPDATE_ROWS_EVENT)
>
Ah, good. Then some of the comments on the previous patch can be ignored.
> {
> DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
>
> @@ -1395,20 +1395,20 @@ Old_rows_log_event::~Old_rows_log_event(
>
> int Old_rows_log_event::get_data_size()
> {
> - int const type_code= xget_type_code();
> + int const type_code= get_type_code();
>
See above.
>
> uchar buf[sizeof(m_width)+1];
> uchar *end= net_store_length(buf, (m_width + 7) / 8);
>
> DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
> return 6 + no_bytes_in_map(&m_cols) + (end - buf) +
> - (type_code == UPDATE_ROWS_EVENT ? no_bytes_in_map(&m_cols_ai)
> : 0) +
> + (type_code == PRE_GA_UPDATE_ROWS_EVENT ?
> no_bytes_in_map(&m_cols_ai) : 0) +
> (m_rows_cur - m_rows_buf););
> int data_size= ROWS_HEADER_LEN;
> data_size+= no_bytes_in_map(&m_cols);
> data_size+= end - buf;
>
> - if (type_code == UPDATE_ROWS_EVENT)
> + if (type_code == PRE_GA_UPDATE_ROWS_EVENT)
> data_size+= no_bytes_in_map(&m_cols_ai);
>
> data_size+= (m_rows_cur - m_rows_buf);
> @@ -1978,7 +1978,7 @@ bool Old_rows_log_event::write_data_body
> /*
> TODO[refactor write]: Remove the "down cast" here (and elsewhere).
> */
> - if (xget_type_code() == UPDATE_ROWS_EVENT)
> + if (get_type_code() == PRE_GA_UPDATE_ROWS_EVENT)
> {
> DBUG_DUMP("m_cols_ai", (uchar*) m_cols_ai.bitmap,
> no_bytes_in_map(&m_cols_ai));
> @@ -2056,7 +2056,8 @@ Write_rows_log_event_old::Write_rows_log
> uint event_len,
> const
> Format_description_log_event
> *description_event)
> -: Old_rows_log_event(buf, event_len, WRITE_ROWS_EVENT, description_event)
> +: Old_rows_log_event(buf, event_len, PRE_GA_WRITE_ROWS_EVENT,
> + description_event)
> {
> }
> #endif
> @@ -2685,7 +2686,8 @@ Delete_rows_log_event_old::Delete_rows_l
> uint event_len,
> const
> Format_description_log_event
> *description_event)
> - : Old_rows_log_event(buf, event_len, DELETE_ROWS_EVENT, description_event),
> + : Old_rows_log_event(buf, event_len, PRE_GA_DELETE_ROWS_EVENT,
> + description_event),
> m_after_image(NULL), m_memory(NULL)
> {
> }
> @@ -2808,7 +2810,8 @@ Update_rows_log_event_old::Update_rows_l
> const
> Format_description_log_event
> *description_event)
> - : Old_rows_log_event(buf, event_len, UPDATE_ROWS_EVENT, description_event),
> + : Old_rows_log_event(buf, event_len, PRE_GA_UPDATE_ROWS_EVENT,
> + description_event),
> m_after_image(NULL), m_memory(NULL)
> {
> }
> diff -Nrup a/sql/log_event_old.h b/sql/log_event_old.h
> --- a/sql/log_event_old.h 2007-10-31 11:09:13 +01:00
> +++ b/sql/log_event_old.h 2007-10-31 11:43:31 +01:00
> @@ -25,7 +25,6 @@ class Old_rows_log_event : public Log_ev
> {
> /********** BEGIN CUT & PASTE FROM Rows_log_event **********/
> public:
> - virtual Log_event_type xget_type_code() = 0;
> /**
> Enumeration of the errors that can be returned.
> */
> @@ -326,12 +325,6 @@ class Write_rows_log_event_old : public
> {
> /********** BEGIN CUT & PASTE FROM Write_rows_log_event **********/
> public:
> - enum
> - {
> - /* Support interface to THD::binlog_prepare_pending_rows_event */
> - XTYPE_CODE = WRITE_ROWS_EVENT
> - };
> -
> #if !defined(MYSQL_CLIENT)
> Write_rows_log_event_old(THD*, TABLE*, ulong table_id,
> MY_BITMAP const *cols, bool is_transactional);
> @@ -355,8 +348,6 @@ public:
> #endif
>
> private:
> - virtual Log_event_type xget_type_code() { return (Log_event_type)XTYPE_CODE; }
> -
> #ifdef MYSQL_CLIENT
> void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
> #endif
> @@ -398,12 +389,6 @@ class Update_rows_log_event_old : public
> {
> /********** BEGIN CUT & PASTE FROM Update_rows_log_event **********/
> public:
> - enum
> - {
> - /* Support interface to THD::binlog_prepare_pending_rows_event */
> - XTYPE_CODE = UPDATE_ROWS_EVENT
> - };
> -
> #ifndef MYSQL_CLIENT
> Update_rows_log_event_old(THD*, TABLE*, ulong table_id,
> MY_BITMAP const *cols,
> @@ -438,8 +423,6 @@ public:
> }
>
> protected:
> - virtual Log_event_type xget_type_code() { return (Log_event_type)XTYPE_CODE; }
> -
> #ifdef MYSQL_CLIENT
> void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
> #endif
> @@ -482,12 +465,6 @@ class Delete_rows_log_event_old : public
> {
> /********** BEGIN CUT & PASTE FROM Update_rows_log_event **********/
> public:
> - enum
> - {
> - /* Support interface to THD::binlog_prepare_pending_rows_event */
> - XTYPE_CODE = DELETE_ROWS_EVENT
> - };
> -
> #ifndef MYSQL_CLIENT
> Delete_rows_log_event_old(THD*, TABLE*, ulong,
> MY_BITMAP const *cols, bool is_transactional);
> @@ -511,8 +488,6 @@ public:
> #endif
>
> protected:
> - virtual Log_event_type xget_type_code() { return (Log_event_type)XTYPE_CODE; }
> -
> #ifdef MYSQL_CLIENT
> void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
> #endif
>
>
--
Mats Kindahl
Lead Software Developer
Replication Team
MySQL AB, www.mysql.com