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

Avoid string formatting during gtid event data deserialization and st… #101

Merged
merged 2 commits into from
Feb 14, 2023

Conversation

janickr
Copy link

@janickr janickr commented Feb 9, 2023

…ring parsing when adding the gtid to a GtidSet

This is a PR for item 1) in #98

Afaik I did not break any interfaces, except I changed the protected gtid field in BinaryLogClient from String to Object

I didn't change the MariadbGtid handling until I know more about #100

…ring parsing when adding the gtid to a GtidSet
@osheroff
Copy link
Owner

not quite quite right:

mysql> select @@server_uuid;
+--------------------------------------+
| @@server_uuid                        |
+--------------------------------------+
| dd2ea913-aa87-11ed-af75-0242ac110002 |
+--------------------------------------+
1 row in set (0.01 sec)

but with this change the uuid is being to-string'ed as ed1187aa-13a9-2edd-0200-11ac420275af.
so if we take that string and pass it back to mysql, boom.

@osheroff
Copy link
Owner

i presume it's a different view between mysql's uuid and java's uuid?

…ring parsing when adding the gtid to a GtidSet - Fixed incorrect serverId handling
@janickr
Copy link
Author

janickr commented Feb 12, 2023

Thanks for catching this. It was not a different view between mysql and java, it was me constructing the UUID with the bytes in the wrong order.

I wrote an integration test for this, fixed the bug, and fixed my unit test.

MySql writes the bytes of the serverId to the stream most significant byte first (big endian). But I read the bytes with byteArrayInputStream.readLong(8) which assumes little endian.

@osheroff osheroff merged commit 6eb2de5 into osheroff:master Feb 14, 2023
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 this pull request may close these issues.

None yet

2 participants