diff options
author | unknown <mats@kindahl-laptop.dnsalias.net> | 2007-12-05 20:00:14 +0100 |
---|---|---|
committer | unknown <mats@kindahl-laptop.dnsalias.net> | 2007-12-05 20:00:14 +0100 |
commit | 7a5f3f12bc45f7f1db9ba97be0337dfd256b96d3 (patch) | |
tree | 765c8d4850f2afc52ed14acacbda74ef2762a538 /sql/log_event_old.cc | |
parent | a196adacfdd06e556e042dd5a072c9b0a8abcb3a (diff) | |
download | mariadb-git-7a5f3f12bc45f7f1db9ba97be0337dfd256b96d3.tar.gz |
BUG#31583 (5.1-telco-6.1 -> 5.1.22. Slave returns Error in unknown event):
In the patch for BUG#21842, the code for handling old rows events were
refactored. There were a bug in the refactored code (possibly introduced
after the patch for BUG#21842) that caused caused the refactored old events
to read a columns bitmap after image even though there is no such bitmap
for old events. As a result, the reading got out of sync, and started reading
invalid data.
This patch removes all trace of the after image column bitmap from the refactored
old events and removes functions that are no longer needed because they are empty.
sql/log_event.cc:
Adding debug printouts and adding old rows events names to output
so that they are not printed as unknown events.
sql/log_event_old.cc:
Adding debug printouts to see how the old events are partitioned
when being decoded. Removing all traces of the column bitmap for
the after image in the old events since there is none.
Removing the following functions since they are no longer needed:
- Update_rows_log_event_old::init()
- Update_rows_log_event_old::~Update_rows_log_event_old()
Removing unused local variable.
sql/log_event_old.h:
Removing all traces of the column bitmap for the after image in
the old events since there is none.
Removing the following functions since they are no longer needed:
- Update_rows_log_event_old::init()
- Update_rows_log_event_old::is_valid()
- Update_rows_log_event_old::~Update_rows_log_event_old()
Removing unused local variable.
mysql-test/suite/bugs/r/rpl_bug31583.result:
New BitKeeper file ``mysql-test/suite/bugs/r/rpl_bug31583.result''
mysql-test/suite/bugs/t/rpl_bug31583.test:
New BitKeeper file ``mysql-test/suite/bugs/t/rpl_bug31583.test''
Diffstat (limited to 'sql/log_event_old.cc')
-rw-r--r-- | sql/log_event_old.cc | 76 |
1 files changed, 3 insertions, 73 deletions
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index b16af43f24e..12c3b2a6dc3 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -1317,6 +1317,7 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len, post_header_len)); const char *post_start= buf + common_header_len; + DBUG_DUMP("post_header", (uchar*) post_start, post_header_len); post_start+= RW_MAPID_OFFSET; if (post_header_len == 6) { @@ -1358,38 +1359,11 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len, DBUG_VOID_RETURN; } - m_cols_ai.bitmap= m_cols.bitmap; /* See explanation in is_valid() */ - - if (event_type == PRE_GA_UPDATE_ROWS_EVENT) - { - DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); - - /* if bitmap_init fails, caught in is_valid() */ - if (likely(!bitmap_init(&m_cols_ai, - m_width <= sizeof(m_bitbuf_ai)*8 ? m_bitbuf_ai : NULL, - m_width, - false))) - { - DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); - memcpy(m_cols_ai.bitmap, ptr_after_width, (m_width + 7) / 8); - create_last_word_mask(&m_cols_ai); - ptr_after_width+= (m_width + 7) / 8; - DBUG_DUMP("m_cols_ai", (uchar*) m_cols_ai.bitmap, - no_bytes_in_map(&m_cols_ai)); - } - else - { - // Needed because bitmap_init() does not set it to null on failure - m_cols_ai.bitmap= 0; - DBUG_VOID_RETURN; - } - } - const uchar* const ptr_rows_data= (const uchar*) ptr_after_width; - size_t const data_size= event_len - (ptr_rows_data - (const uchar *) buf); DBUG_PRINT("info",("m_table_id: %lu m_flags: %d m_width: %lu data_size: %lu", m_table_id, m_flags, m_width, (ulong) data_size)); + DBUG_DUMP("rows_data", (uchar*) ptr_rows_data, data_size); m_rows_buf= (uchar*) my_malloc(data_size, MYF(MY_WME)); if (likely((bool)m_rows_buf)) @@ -1419,24 +1393,18 @@ Old_rows_log_event::~Old_rows_log_event() int Old_rows_log_event::get_data_size() { - int const type_code= get_type_code(); - 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 == 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 == PRE_GA_UPDATE_ROWS_EVENT) - data_size+= no_bytes_in_map(&m_cols_ai); - data_size+= (m_rows_cur - m_rows_buf); - return data_size; + return data_size; } @@ -2011,16 +1979,6 @@ bool Old_rows_log_event::write_data_body(IO_CACHE*file) DBUG_DUMP("m_cols", (uchar*) m_cols.bitmap, no_bytes_in_map(&m_cols)); res= res || my_b_safe_write(file, (uchar*) m_cols.bitmap, no_bytes_in_map(&m_cols)); - /* - TODO[refactor write]: Remove the "down cast" here (and elsewhere). - */ - 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)); - res= res || my_b_safe_write(file, (uchar*) m_cols_ai.bitmap, - no_bytes_in_map(&m_cols_ai)); - } DBUG_DUMP("rows", m_rows_buf, data_size); res= res || my_b_safe_write(file, m_rows_buf, (size_t) data_size); @@ -2831,38 +2789,10 @@ Update_rows_log_event_old::Update_rows_log_event_old(THD *thd_arg, // This constructor should not be reached. assert(0); - - init(cols); -} - - -void Update_rows_log_event_old::init(MY_BITMAP const *cols) -{ - /* if bitmap_init fails, caught in is_valid() */ - if (likely(!bitmap_init(&m_cols_ai, - m_width <= sizeof(m_bitbuf_ai)*8 ? m_bitbuf_ai : NULL, - m_width, - false))) - { - /* Cols can be zero if this is a dummy binrows event */ - if (likely(cols != NULL)) - { - memcpy(m_cols_ai.bitmap, cols->bitmap, no_bytes_in_map(cols)); - create_last_word_mask(&m_cols_ai); - } - } } #endif /* !defined(MYSQL_CLIENT) */ -Update_rows_log_event_old::~Update_rows_log_event_old() -{ - if (m_cols_ai.bitmap == m_bitbuf_ai) // no my_malloc happened - m_cols_ai.bitmap= 0; // so no my_free in bitmap_free - bitmap_free(&m_cols_ai); // To pair with bitmap_init(). -} - - /* Constructor used by slave to read the event from the binary log. */ |