问题描述
假设我执行以下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中的悬空事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!