MySQL Innodb中的悬空事务 [英] Dangling Transactions in MySQL Innodb

查看:156
本文介绍了MySQL Innodb中的悬空事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我执行以下SQL语句:

Suppose that I execute the following SQL statements:

start transaction;
insert into someTable (userId, amount) values (33, 44);

请注意,该语句的末尾没有Commit或Rollback.我也没有要求启用autoCommit的选项.

Notice that there is no Commit or Rollback at the end of this statement. I also do not have the option of requiring autoCommit being enabled.

dba如何检测这种未完成的交易?我尝试使用显示innodb状态",但它提供了太多信息.我正在尝试查找未提交的事务,并强制它们进行提交或回滚.

How can a dba detect this sort of unfinished transaction? I've tried using 'show innodb status' but it provides too much information. I'm trying to find uncommitted transactions and force them to commit or rollback.

谢谢.

推荐答案

自动提交在这里无济于事,start transaction会覆盖它.

Autocommit will not help you here, start transaction overrides it.

连接超时或客户端重新连接后,悬空的事务将回滚(以先发生的为准).
无法提交悬空事务,唯一可能的选择是回滚.

The dangling transactions will be rolled back as soon as the connection times out OR the client reconnects, whichever happens first.
There is no way to commit a dangling transaction, the only possible option is a rollback.

如果您想了解InnoDB状态输出,请参阅:
http://www.mysqlperformanceblog.com/2006/07/17/show-innodb-status-walk-through/

If you want to understand the InnoDB status output, see:
http://www.mysqlperformanceblog.com/2006/07/17/show-innodb-status-walk-through/

这篇关于MySQL Innodb中的悬空事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆