Skip to content

Allow compilation with mariadb-connector-c #1

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

Merged
merged 1 commit into from
Mar 5, 2020

Conversation

bibstha
Copy link

@bibstha bibstha commented Mar 4, 2020

In the original PR where we introduce session_tracking on mysql2 gem, we used the constant CLIENT_SESSION_TRACK.

I found out that mariadb-connector-c uses CLIENT_SESSION_TRACKING instead and therefore the mysql2 gem wouldn't work.
mariadb also defines an enum value SESSION_TRACK_TRANSACTION_TYPE instead of mysql's SESSION_TRACK_TRANSACTION_STATE.

In our codebase, we use mariadb-connector-c on dev while mysql-connector-c on ci and production. To make it work on all, we need this patch.

@bibstha bibstha requested review from insom and sabidib March 4, 2020 20:48
@bibstha bibstha force-pushed the allow_compilation_with_mariadb branch from 96af6b2 to 360e63d Compare March 4, 2020 20:49
#if defined(CLIENT_SESSION_TRACK)
#elif defined(CLIENT_SESSION_TRACKING)
#define CLIENT_SESSION_TRACK CLIENT_SESSION_TRACKING
#endif
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar hacks are used in few lines above in

#if defined(MARIADB_CLIENT_VERSION_STR)
#define MYSQL_LINK_VERSION MARIADB_CLIENT_VERSION_STR
#elif defined(LIBMYSQL_VERSION)
#define MYSQL_LINK_VERSION LIBMYSQL_VERSION

@bibstha bibstha force-pushed the allow_compilation_with_mariadb branch from 360e63d to 2fa5a5d Compare March 4, 2020 21:12
@bibstha bibstha force-pushed the allow_compilation_with_mariadb branch from 2fa5a5d to eec4cc0 Compare March 4, 2020 21:47
Copy link

@insom insom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍴-- Hooray for copying a feature but changing it very slightly from the original 😁. I am also curious why we use a different connector in Railgun than we do for CI and production, but that seems like a bigger yak than this 5 line code change.

@bibstha
Copy link
Author

bibstha commented Mar 4, 2020

🍴-- Hooray for copying a feature but changing it very slightly from the original 😁. I am also curious why we use a different connector in Railgun than we do for CI and production, but that seems like a bigger yak than this 5 line code change.

We recently moved to nix on dev. And turns out in nix, all gems and their dependencies (in our case mysql2 and it's dependency on libmysqlclient) is defined deep in nix config. We can ofcourse override that, however if we are to get the session tracker patch on the mainline mysql2 gem, we need this patch so it works for everyone. Therefore fixing it here.

@bibstha bibstha merged commit d3c815c into session-tracking Mar 5, 2020
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.

3 participants