summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorLuis Soares <luis.soares@sun.com>2009-05-12 12:53:46 +0100
committerLuis Soares <luis.soares@sun.com>2009-05-12 12:53:46 +0100
commit60a2bbb8ddc1c3fe8ef3814794838c2ca17f2193 (patch)
tree4709ddc35e2a86a72509206b4e9e66727bbc4921 /sql/log_event.cc
parentb1a02aef5096ea386597bc4b7bffff5fb09c3b27 (diff)
downloadmariadb-git-60a2bbb8ddc1c3fe8ef3814794838c2ca17f2193.tar.gz
BUG#42749: infinite loop writing to row based binlog - processlist shows
"freeing items" The calculation of the table map log event in the event constructor was one byte shorter than what would be actually written. This would lead to a mismatch between the number of bytes written and the event end_log_pos, causing bad event alignment in the binlog (corrupted binlog) or in the transaction cache while fixing positions (MYSQL_BIN_LOG::write_cache). This could lead to impossible to read binlog or even infinite loops in MYSQL_BIN_LOG::write_cache. This patch addresses this issue by correcting the expected event length in the Table_map_log_event constructor, when the field metadata size exceeds 255. sql/log_event.cc: Added the extra byte as net_store_length imposes.
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index a10a36f3b43..a878e9a2f9d 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -7861,10 +7861,11 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
/*
Now set the size of the data to the size of the field metadata array
- plus one or two bytes for number of elements in the field metadata array.
+ plus one or three bytes (see pack.c:net_store_length) for number of
+ elements in the field metadata array.
*/
if (m_field_metadata_size > 255)
- m_data_size+= m_field_metadata_size + 2;
+ m_data_size+= m_field_metadata_size + 3;
else
m_data_size+= m_field_metadata_size + 1;