“InnoDB 并不真正支持事务” - 什么?

发布于 2024-10-31 06:38:40 字数 528 浏览 3 评论 0原文

我们的系统工程师利用一切机会提醒大家他是多么讨厌 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

长梦不多时 2024-11-07 06:38:40

你可以证明这是错误的:用一些虚拟数据创建一个 InnoDB 表,然后

BEGIN TRANSACTION

做一些愚蠢的事情,比如

DELETE FROM TABLE

(注意缺少 where 子句),然后执行 a

ROLLBACK

,当表中的数据再次神秘地出现时,InnoDB 有事务,你的同事只是——误导了。

请注意,他可能只是将 InnoDB 与 MyISAM 混淆了。

You can prove this wrong: Create an InnoDB Table with some dummy data, then

BEGIN TRANSACTION

then do something stupid like

DELETE FROM TABLE

(note the missing where clause) and then do a

ROLLBACK

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.

听风念你 2024-11-07 06:38:40

不,这是错误的。我敢打赌他的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文