MySQL rollback on transaction with lost/disconnected connection

喜你入骨 提交于 2019-11-27 18:52:39

When you are physically disconnecting a client you're not sending a normal disconnect (which would have caused a rollback) and the MySQL protocol isn't very chatty so the server never knows that the client isn't there. I think this is a flaw in the protocol when comparing to other database systems where the client and server talks internally much more.

Anyway. There are two variables that you could change. They basically do the same but for different clients.

The first is wait_timeout and it is used by application clients like java or php.

The other is interactive_timeout and it is used by the mysql client (as in your tests)

In both cases the server to kills the connection after a number of seconds and when doing so rollbacks all transactions and releases all locks.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!