“InnoDB 并不真正支持事务” - 什么?
我们的系统工程师利用一切机会提醒大家他是多么讨厌 MySQL,他是多么喜欢 postgres,我们需要进行切换。他的抱怨有时看起来很有道理,但最近却变得荒唐可笑。他现在声称的一件事是“InnoDB 并不真正执行事务。它只是假装”。是的,这是直接引用。事实上,他声称 innodb 中所有与事务相关的命令实际上都是 NOP。以下是他五分钟前刚刚说过的话的释义:
“我最近发现了这一点,因为我将所有内容都保存在事务中。我去做了回滚,但它不允许我。经过一番挖掘,我发现 innodb 中的所有事务命令实际上都是 NOP ”
这对我来说显然很荒谬。这意味着没有人曾经使用 innodb 成功回滚过事务,甚至没有人执行过事务。这意味着 innodb 的开发者完全在撒谎,并认为我们都愚蠢到会被他们的谎言所欺骗。
他的主张是否有一点点真实性?或者也许,有某种扭曲的方式来解释这个听起来不那么疯狂的方式?
编辑澄清:我并不是想咆哮。由于我找不到他的说法的证据,我想问他是否完全错误,或者是否有一些我应该意识到的事实。
Our system engineer takes every opportunity to remind everyone how much he hates MySQL, and how much he loves postgres and that we need to switch. His complaints sometimes seem reasonable, but recently they've included the ridiculous. One of the things he's claiming now is that "InnoDB doesn't really do transactions. It only pretends to." Yes, that's a direct quote. In fact, he claims that all of the transaction related commands in innodb are in fact NOPs. Here's a paraphrasing of something he just said about five minutes ago:
"I found that out recently, because I keep everything in a transaction. I went to do a rollback, and it wouldn't let me. After some digging I found out that all of the transaction commands in innodb are actually NOPs."
This sounds patently ridiculous to me. It would mean no one has ever successfully rolled back a transaction using innodb, or in fact even performed one. It would mean the developers of innodb are outright lying, and think we are all stupid enough to fall for their fakery.
Is there any possible way, in the slightest, that there is a grain of truth to his claims? Or maybe, that there's some twisted way to interpret this in a way that doesn't sound so crazy?
edit to clarify: I'm not trying to rant. I'm asking, since I can't find evidence of his claims, whether he is outright wrong, or whether there's some truth that I should be aware of.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以证明这是错误的:用一些虚拟数据创建一个 InnoDB 表,然后
做一些愚蠢的事情,比如
(注意缺少 where 子句),然后执行 a
,当表中的数据再次神秘地出现时,InnoDB 有事务,你的同事只是——误导了。
请注意,他可能只是将 InnoDB 与 MyISAM 混淆了。
You can prove this wrong: Create an InnoDB Table with some dummy data, then
then do something stupid like
(note the missing where clause) and then do a
and when the data in the table is mysteriously there again, InnoDB has transactions and your collegue is just - misinformed.
Note that he might just mixed up InnoDB with MyISAM.
不,这是错误的。我敢打赌他的 InnoDB 提交刷新设置错误,因此事务无法回滚。
基本答案是:InnoDB 的全部要点是事务和行级锁定,但事务是 InnoDB 的组成部分。
他也可能做了一些愚蠢的事情,比如不关闭 AutoCommit,因此他的“事务”中的每个 SQL 语句都会提交,从而变成自己的事务。
No. This is just wrong. I bet he has his InnoDB commit flush set wrong, so that transaction are not able to roll back.
The basic answer is: the entire point of InnoDB is transactions, and row level locking, but transactions is an integral part of InnoDB.
Also he could be doing something stupid like not turning off AutoCommit and thus each SQL statement in his "transaction" is committing and thus turning into its own transaction.