mysql 崩溃时事务超时和连接心跳

mysql transaction timeout and connection heartbeat when crash

我的问题是:假设 process-A 有一个 mysql 客户端并开始一个事务。 process-A commit or rollback之前,导致OOM或者net-wire被人掐断。 mysql 服务器将如何处理它(在上述两种情况下)?

我知道 innodb 引擎上的默认事务超时是 50 秒,并且 mysql 客户端在这里有一个连接池。我想连接池有它自己的心跳,如果没有收到心跳,mysql 服务器会认为客户端已关闭。

你能告诉我,具体会发生什么并给出参考吗?版本是 10.1.29-MariaDB-6ubuntu2 Ubuntu 18.10

谢谢。 :)

让我自己回答。如果需要自定义,请在打开数据库客户端时查看 net_read_timeout, there is default 30 seconds before server regard client as shutdown, and cancel the transaction. To me, by using go-sql-driver, it's recommended to setup this variable

我还不知道服务器-客户端协议的细节,是有心跳还是只有TCP keep alive?等待更多潜水。