Bug #71687 TABLE_MAP_EVENT is too sparse
Submitted: 12 Feb 2014 20:01
Reporter: Luke Scott Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S4 (Feature request)
Version:5.x OS:Any
Assigned to: CPU Architecture:Any

[12 Feb 2014 20:01] Luke Scott
Description:
TALBE_MAP_EVENT is missing some helpful information.

Protocol::MYSQL_TYPE_LONG (and other integer types) have a meta-len of 0 and omit whether or not the integer is signed or not. When replicating from MySQL->MySQL this is fine because only the number of bytes matter. When replicating from MySQL->JSON this is problematic.

Here is an example of why this is important: http://play.golang.org/p/UJKdBw3Nwq

As you can see the source data (4 bytes) is the same. When I cast from uint32 to int64 the value is wrong. I need to cast to int32 first before casting to int64 to get the correct value, but I have no indication when I should do this.

It would also be helpful to have the column names as my target isn't a SQL database, so I have on schema to start with, and parsing ALTER TABLE queries doesn't really help much.

How to repeat:
http://play.golang.org/p/UJKdBw3Nwq
[12 Feb 2014 23:23] Davi Arnaut
A solution is to add a new event for this purpose: https://github.com/twitter/mysql/commit/19b251446