From: Date: January 10 2007 7:45pm Subject: bk commit into 5.0 tree (cbell:1.2350) BUG#22645 List-Archive: http://lists.mysql.com/commits/17879 X-Bug: 22645 Message-Id: <20070110184549.9A0E3ED43D@suse.vabb.com> Below is the list of changes that have just been committed into a local 5.0 repository of cbell. When cbell 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-01-10 13:45:41-05:00, cbell@stripped +2 -0 BUG#22645 - LC_TIME_NAMES: Statement not replicated This patch is an additional code change to the get_str_len_and_pointer method in log_events.cc. This change is necessary to correct a problem encountered on 64-bit SUSE where the auto_increment_* variables were being overwritten. The change corrects a cast mismatch which caused the problem. sql/log_event.cc@stripped, 2007-01-10 13:44:35-05:00, Chuck@stripped +36 -29 BUG#22645 - LC_TIME_NAMES: Statement not replicated This patch is an additional code change to the get_str_len_and_pointer, copy_str_and_move methods and the Query_leg_event constructor to correct a type mismatch encountered during testing on SUSE 64-bit. The patch changes the data type of the buffer variables was changed to a new typedef defined in the Log_event class. The new type is: typedef unsigned char Byte; The variables changed include: pos, start, end, and data_buf sql/log_event.h@stripped, 2007-01-10 13:44:36-05:00, Chuck@stripped +8 -1 BUG#22645 - LC_TIME_NAMES: Statement not replicated This patch adds a new type definition to the Log_event class. The new type is typedef unsigned char Byte. It is used in place of the uchar and usigned char definitions in the Query_log_event constructor to eliminate type conversion problems encountere on SUSE 64-bit. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: cbell # Host: suse.vabb.com # Root: /home/Chuck/development/mysql-5.0-red --- 1.221/sql/log_event.cc 2006-12-29 07:40:55 -05:00 +++ 1.222/sql/log_event.cc 2007-01-10 13:44:35 -05:00 @@ -1315,23 +1315,30 @@ Query_log_event::Query_log_event(THD* th /* 2 utility functions for the next method */ -static void get_str_len_and_pointer(const char **dst, const char **src, uint *len) +/* + Get the pointer for a string (src) that contains the length in + the first byte. Set the output string (dst) to the string value + and place the length of the string in the byte after the string. +*/ +static void get_str_len_and_pointer(const Log_event::Byte **src, + const char **dst, + uint *len) { if ((*len= **src)) - *dst= *src + 1; // Will be copied later - (*src)+= *len+1; + *dst= (char *)*src + 1; // Will be copied later + (*src)+= *len + 1; } - -static void copy_str_and_move(char **dst, const char **src, uint len) +static void copy_str_and_move(const char **src, + Log_event::Byte **dst, + uint len) { memcpy(*dst, *src, len); - *src= *dst; + *src= (const char *)*dst; (*dst)+= len; *(*dst)++= 0; } - /* Query_log_event::Query_log_event() This is used by the SQL slave thread to prepare the event before execution. @@ -1349,8 +1356,8 @@ Query_log_event::Query_log_event(const c ulong data_len; uint32 tmp; uint8 common_header_len, post_header_len; - char *start; - const char *end; + Log_event::Byte *start; + const Log_event::Byte *end; bool catalog_nz= 1; DBUG_ENTER("Query_log_event::Query_log_event(char*,...)"); @@ -1396,9 +1403,9 @@ Query_log_event::Query_log_event(const c /* variable-part: the status vars; only in MySQL 5.0 */ - start= (char*) (buf+post_header_len); - end= (const char*) (start+status_vars_len); - for (const uchar* pos= (const uchar*) start; pos < (const uchar*) end;) + start= (Log_event::Byte*) (buf+post_header_len); + end= (const Log_event::Byte*) (start+status_vars_len); + for (const Log_event::Byte* pos= start; pos < end;) { switch (*pos++) { case Q_FLAGS2_CODE: @@ -1420,7 +1427,7 @@ Query_log_event::Query_log_event(const c break; } case Q_CATALOG_NZ_CODE: - get_str_len_and_pointer(&catalog, (const char **)(&pos), &catalog_len); + get_str_len_and_pointer(&pos, &catalog, &catalog_len); break; case Q_AUTO_INCREMENT: auto_increment_increment= uint2korr(pos); @@ -1436,7 +1443,7 @@ Query_log_event::Query_log_event(const c } case Q_TIME_ZONE_CODE: { - get_str_len_and_pointer(&time_zone_str, (const char **)(&pos), &time_zone_len); + get_str_len_and_pointer(&pos, &time_zone_str, &time_zone_len); break; } case Q_CATALOG_CODE: /* for 5.0.x where 0<=x<=3 masters */ @@ -1458,38 +1465,38 @@ Query_log_event::Query_log_event(const c } #if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE) - if (!(start= data_buf = (char*) my_malloc(catalog_len + 1 + - time_zone_len + 1 + - data_len + 1 + - QUERY_CACHE_FLAGS_SIZE + - db_len + 1, - MYF(MY_WME)))) + if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 + + time_zone_len + 1 + + data_len + 1 + + QUERY_CACHE_FLAGS_SIZE + + db_len + 1, + MYF(MY_WME)))) #else - if (!(start= data_buf = (char*) my_malloc(catalog_len + 1 + - time_zone_len + 1 + - data_len + 1, - MYF(MY_WME)))) + if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 + + time_zone_len + 1 + + data_len + 1, + MYF(MY_WME)))) #endif DBUG_VOID_RETURN; if (catalog_len) // If catalog is given { if (likely(catalog_nz)) // true except if event comes from 5.0.0|1|2|3. - copy_str_and_move(&start, &catalog, catalog_len); + copy_str_and_move(&catalog, &start, catalog_len); else { memcpy(start, catalog, catalog_len+1); // copy end 0 - catalog= start; + catalog= (const char *)start; start+= catalog_len+1; } } if (time_zone_len) - copy_str_and_move(&start, &time_zone_str, time_zone_len); + copy_str_and_move(&time_zone_str, &start, time_zone_len); /* A 2nd variable part; this is common to all versions */ memcpy((char*) start, end, data_len); // Copy db and query start[data_len]= '\0'; // End query with \0 (For safetly) - db= start; - query= start + db_len + 1; + db= (char *)start; + query= (char *)(start + db_len + 1); q_len= data_len - db_len -1; DBUG_VOID_RETURN; } --- 1.128/sql/log_event.h 2006-12-14 05:14:04 -05:00 +++ 1.129/sql/log_event.h 2007-01-10 13:44:36 -05:00 @@ -547,6 +547,13 @@ class Log_event { public: /* + The following type definition is to be used whenever data is placed + and manipulated in a common buffer. Use this typedef for buffers + that contain data containing binary and character data. + */ + typedef unsigned char Byte; + + /* The offset in the log where this event originally appeared (it is preserved in relay logs, making SHOW SLAVE STATUS able to print coordinates of the event in the master's binlog). Note: when a @@ -719,7 +726,7 @@ public: class Query_log_event: public Log_event { protected: - char* data_buf; + Log_event::Byte* data_buf; public: const char* query; const char* catalog;