Hello everyone!
I've created a PR to send COM_RESET_CONNECTION in mysqlnd when
reusing a persistent connection [1]. This ensures that the connection
is in a blank-slate state, and not possibly in a transaction or
operating with any variables set from a previous request, etc.
Tim had opened a GitHub issue for this a while back [2]. A user
commented there to point out that COM_RESET_CONNECTION is supported
in MySQL 5.7.3+ and MariaDB 10.2+, and so my implementation would
necessitate at least those versions as a minimum supported version.
Personally, given that both of these versions are EOL, this feels
acceptable, but I'm curious what others think. Notably, if we were to
implement configuration for this we'd likely need to introduce yet
another INI variable; I have an impression that PHP maintainers are
somewhat skeptical of adding new INI settings.
Secondly, I'm curious what people think about implementing this in
both PDO and mysqlnd. In PDO, we can replace the liveness check
with this command, which would act as both a liveness check and a
reset for no additional round-trip cost.
Please take a look and let me know what you think. I would like to
think this is something that is possible without submitting an RFC,
but of course if people feel that is necessary I'm able to go that
route.
Thanks!
[1] https://github.com/php/php-src/pull/21857
[2] https://github.com/php/php-src/issues/20225