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

Implementation of binlog::misc::my_{datetime/time}_packed_from_binary functions do not match MySql implementation #145

Closed
vassili-zarouba opened this issue Sep 11, 2024 · 4 comments

Comments

@vassili-zarouba
Copy link

vassili-zarouba commented Sep 11, 2024

We are trying to read json opaque values for temporal types from the binlog, and discovered the binlog::misc::* functions which are meant to read the binary into i64, do not return correct result. After looking into the MySql source code for the same operation, it turned out the binlog::misc::* functions implementation is different from MySql, though the functions binlog::misc::{datetime_from_packed, time_from_packed} do match the MySql implementation.
All worked, after we replaced the binlog::misc::{my_datetime_packed_from_binary, my_time_packed_from_binary} with a simple code which matches the MySql implementation.

Here is the MySql source code GitHub URL:
https://github.com/mysql/mysql-server/blob/mysql-8.0.39/sql-common/json_dom.cc#L721

@blackbeam
Copy link
Owner

Hi.

my_datetime_packed_from_binary and my_time_packed_from_binary are for reading on-disk binary representation (see here and here). They are used to read binlog values of types MYSQL_TYPE_DATETIME2 and MYSQL_TYPE_TIME2.

@vassili-zarouba
Copy link
Author

vassili-zarouba commented Oct 1, 2024

Hi, @blackbeam
So that, the API was meant to read the binary content which has nothing to do with the JSON opaque blocks ...
Look like we misused it ...
Thank you for the explanation!
Regards

@vassili-zarouba
Copy link
Author

Improper use of the API

@blackbeam
Copy link
Owner

@vassili-zarouba, you may find #147 useful (see the docstring here)

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

No branches or pull requests

2 participants