Description
When Connection Reset = true
, the connection is reset (with a COM_RESET
packet) when it's retrieved from the pool. This has the side-effect of checking connection liveness.
When Connection Reset = false
, no reset occurs, but a COM_PING
packet is still sent to check liveness (thus incurring a server roundtrip). Clients who wish to opt out of this can set Connection Idle Ping Time = <large value>
but this is documented as an experimental setting.
There's no ADO.NET requirement that the server be pinged; it was just done to improve the odds that MySqlConnection.Open
always returns a valid connection (instead of one that is in the pool but has been closed by the server). We could allow Connection Reset = false
to be a "power user" / performance setting that also disables any server roundtrip (both reset and ping) and simply returns a connection from the pool if one is present. (This supersedes the more complicated options proposed in #967.)
The documentation would be updated to call out the effects of this change, and to note that MySqlConnection.Open
might actually return an invalid connection that throws as soon as it's used. (Technically, this is always possible, because a network partition can happen at any time. Thus, code that's already written to retry wouldn't be affected.) Users could always call MySqlConnection.Ping(Async)
if they still want the old behaviour; there's no reason it needs to be built into the library.
MySqlConnectionStringBuilder.ConnectionIdlePingTime
would be marked [Obsolete]
, stop having any effect, and eventually be removed.