Skip to content
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

unsigned mediumint value through binlog streamer wrongfully parsed #299

Open
HemeraOne opened this issue Jul 12, 2021 · 2 comments
Open

Comments

@HemeraOne
Copy link
Contributor

table:
CREATE TABLE `customer` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `geo_city` mediumint(8) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4

queries:
insert into customer values (null, 1);
update customer set geo_city = 8592090 where id = 1; //crashes

error:
ERRO[0009] fatal error detected                          errfrom=binlog_writer error="exec query at pos (mysql-bin.049833, 1049512401) -> (mysql-bin.049833, 1049512401) (163 bytes): Error 1264: Out of range value for column 'geo_city' at row 1" tag=error_handler

ghostferry query:
/*application:ghostferry*/ BEGIN;\n/*application:ghostferry*/ UPDATE `martijntest`.`customer` SET `id`=6,`geo_city`=4286782170 WHERE `id`=6 AND `geo_city`=1;\nCOMMIT

so somehow the unsigned value which lies outside of the signed value gets wrongfully converted: 8592090 -> 4286782170

value parsed from binlog: -8185126

should be converted to int24 which seems to be not a thing in golang

HemeraOne added a commit to HemeraOne/ghostferry that referenced this issue Jul 12, 2021
HemeraOne added a commit to HemeraOne/ghostferry that referenced this issue Jul 12, 2021
HemeraOne added a commit to HemeraOne/ghostferry that referenced this issue Jul 12, 2021
@Manan007224
Copy link
Contributor

There is an issue in the upstream library go-mysql regarding unsigned integer issues - go-mysql-org/go-mysql#206

@HemeraOne
Copy link
Contributor Author

as quoted from the library maintainer in the issue:

binlog event doesn't contain unsigned type, you should convert outside with your own schema.

Which is done for uInt8,uInt16,uInt32 and uInt64 but there is no native uint24 in go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants