MySQL speaks its own proprietary protocol. It cannot be routed by
a HTTP proxy, and a MySQL connection is entire unlike a HTTP
connection. Specifically, a lot of state and configuration is
tied to a MySQL connection, and it cannot be recovered on
disconnect.
What state is tied to a connection?
Transactions
A disconnect implies a ROLLBACK. So if you are in a
transaction, all changes to the database that you attempted are
lost, rolled back, as if they never happened. It is not enough to
retry the last statement, you need to jump back to the begin of
the transaction.
This is not unexpected. All transactions can fail, in the middle
of a transaction or even on COMMIT (you attempt to
COMMIT, but get a ROLLBACK due to a
deadlock or a failed transaction certification in Group
Replication).
Applications need to be able to detect that and handle that at
any …
[Read more]