-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binary(16) field with trailing 0 in bytes is truncated #169
Comments
@criccomini confirmed. Problem identified at https://github.com/shyiko/mysql-binlog-connector-java/blob/master/src/main/java/com/github/shyiko/mysql/binlog/event/deserialization/AbstractRowsEventDataDeserializer.java#L362 ( |
@criccomini it looks like I'm not gonna be able to fix this on the mysql-binlog-connector-java side. BINARY data is zero-padded (see https://dev.mysql.com/doc/refman/5.7/en/binary-varbinary.html). As you probably know, binary log does not contain information about the types (there is no way to distinguish between BINARY and CHAR for example) and so there is just not enough information to zero-pad it automatically. Debezium (considering that it knows the precise column types) will have to zero-pad the values on its own (whenever the value is shorter then expected). I'll keep ticket open until I update the readme.md (quirks section). |
Got it. Thanks for looking into this! |
Will this work, though? If I |
@criccomini I guess it depends on what comes back from the MySQL binlog event. For example, given a column of type |
But if it's 1, wouldn't you not know whether |
It's going to be 1 in both cases ( |
@shyiko if that's the case, I think it's actually a pretty fair argument to make DBZ assume that a fixed-length BINARY column should include the right padded 0's. Basically, my take away is if you're using fixed-length BINARY cols in MySQL, you must be writing binary values that are ONLY that length (or are following a VERY predictable write pattern). Otherwise, you just can't use this data type predictably. @rhauch what do you think about making DBZ assume, and force right padded 0s? |
We are observing that binary(16) fields appear to be truncated when they have trailing 0 bytes (i.e. null terminated) in them. A detailed write up is here:
https://issues.jboss.org/browse/DBZ-254
We are on Debezium 0.4.0, which seems to use 0.9.0 of the mysql-binlog-connector-java library.
The text was updated successfully, but these errors were encountered: