3481 He Zhenxing 2011-01-11
BUG#59123 rpl_stm_binlog_max_cache_size fails sporadically with found warnings
rpl_stm_binlog_max_cache_size.test fails sporadically on PB2
daily-trunk-bugfixing with binlog-checksum enabled, the expected
incident error message was not properly suppressed, and the
incident message would have extra strange characters appended.
The cause is that the incident error message restored from log event
is not properly ended with '\0'. This does not cause problem normally
because the error message is at the end of the event, and we add
a '\0' at the end of an event. but when binlog-checksum is enabled,
the checksum value will be after the message, and so extra strange
characters could be shown and cause the suppression rule to fail.
Fixed the problem by allocate memory for the string and added '\0'
at the end of the message.
modified:
sql/log_event.cc
sql/log_event.h
3480 Mattias Jonsson 2011-01-10 [merge]
merge
modified:
mysql-test/r/partition.result
mysql-test/r/partition_error.result
mysql-test/r/partition_range.result
mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc
mysql-test/suite/parts/r/part_supported_sql_func_innodb.result
mysql-test/suite/parts/r/part_supported_sql_func_myisam.result
mysql-test/t/partition.test
mysql-test/t/partition_error.test
mysql-test/t/partition_range.test
sql/item.h
sql/item_func.h
sql/item_timefunc.h
sql/sql_partition.cc
sql/table.cc
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2010-12-29 05:35:31 +0000
+++ b/sql/log_event.cc 2011-01-11 05:13:23 +0000
@@ -10324,6 +10324,8 @@ Incident_log_event::Incident_log_event(c
DBUG_PRINT("info",("event_len: %u; common_header_len: %d; post_header_len: %d",
event_len, common_header_len, post_header_len));
+ m_message.str= NULL;
+ m_message.length= 0;
int incident_number= uint2korr(buf + common_header_len);
if (incident_number >= INCIDENT_COUNT ||
incident_number <= INCIDENT_NONE)
@@ -10340,7 +10342,13 @@ Incident_log_event::Incident_log_event(c
uint8 len= 0; // Assignment to keep compiler happy
const char *str= NULL; // Assignment to keep compiler happy
read_str(&ptr, str_end, &str, &len);
- m_message.str= const_cast<char*>(str);
+ if (!(m_message.str= (char*) my_malloc(len+1, MYF(MY_WME))))
+ {
+ /* Mark this event invalid */
+ m_incident= INCIDENT_NONE;
+ DBUG_VOID_RETURN;
+ }
+ strmake(m_message.str, str, len);
m_message.length= len;
DBUG_PRINT("info", ("m_incident: %d", m_incident));
DBUG_VOID_RETURN;
@@ -10349,6 +10357,8 @@ Incident_log_event::Incident_log_event(c
Incident_log_event::~Incident_log_event()
{
+ if (m_message.str)
+ my_free(m_message.str);
}
=== modified file 'sql/log_event.h'
--- a/sql/log_event.h 2010-12-21 10:39:20 +0000
+++ b/sql/log_event.h 2011-01-11 05:13:23 +0000
@@ -4014,7 +4014,16 @@ public:
{
DBUG_ENTER("Incident_log_event::Incident_log_event");
DBUG_PRINT("enter", ("m_incident: %d", m_incident));
- m_message= msg;
+ m_message.str= NULL;
+ m_message.length= 0;
+ if (!(m_message.str= (char*) my_malloc(msg.length+1, MYF(MY_WME))))
+ {
+ /* Mark this event invalid */
+ m_incident= INCIDENT_NONE;
+ DBUG_VOID_RETURN;
+ }
+ strmake(m_message.str, msg.str, msg.length);
+ m_message.length= msg.length;
set_direct_logging();
DBUG_VOID_RETURN;
}
Attachment: [text/bzr-bundle] bzr/zhenxing.he@sun.com-20110111051323-w2xnzvcjn46x6h6u.bundle
| Thread |
|---|
| • bzr push into mysql-trunk branch (zhenxing.he:3480 to 3481) Bug#59123 | He Zhenxing | 11 Jan |