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

MYSQL_OPT_RECONNECT is deprecated in MySQL 8.0.34. #45

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

jk2
Copy link

@jk2 jk2 commented Aug 30, 2023

The MySQL client library currently supports performing an automatic reconnection to the server if it finds that the connection is down and an application attempts to send a statement to the server to be executed. Now, this feature is deprecated and subject to removal in a future release of MySQL.

The related MYSQL_OPT_RECONNECT option is still available but it is also deprecated. C API functions mysql_get_option() and mysql_options() now write a deprecation warning to the standard error output when an application specifies MYSQL_OPT_RECONNECT. (WL #15766)

https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-34.html#mysqld-8-0-34-deprecation-removal
https://dev.mysql.com/doc/relnotes/mysql/8.1/en/news-8-1-0.html#mysqld-8-1-0-deprecation-removal

Similar to issue in DBD-mysql: perl5-dbi/DBD-mysql#354

@setharnold
Copy link

It looks like it's been since MYSQL_VERSION_ID >= 50013 that the automatic reconnection behaviour has been in place. I could imagine since then that there's new code in APR that isn't prepared to handle error returns from the client library that say "disconnected, retry manually" or however the library is going to work in the future. (At least, I assume it'll work like it did in the past. That might be a very poor assumption.)

Is the responsibility for these forthcoming new errors going to be on APR or on APR's users? Do those changes need to happen ASAP with this flag being removed?

Thanks

@jk2
Copy link
Author

jk2 commented Sep 1, 2023

Reconnect is MySQL specific option not affecting functionality of any other code in APR whether enabled or disabled. Apache dbd and authn_dbd modules that use APR correctly identified lost connection with this patch and showed/logged error. The connection was restored on next request when MySQL was available again.

As other database drivers in APR (e.g. oracle/postgresql) do not support reconnect, there should not be programs using APR relying on option available only on one database driver.

@setharnold
Copy link

Awesome, thanks!

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.

2 participants