MySQL 事务隔离级别被破坏了吗?

发布于 2024-08-02 09:10:02 字数 618 浏览 2 评论 0原文

我似乎无法在 32 位 x86 Debian 上使用 MySQL 5.0.32 来支持事务隔离级别。

我已将问题简化为最简单的形式,并使用 mysql 命令行客户端进行了测试:

-- On node writer:
--

DROP TABLE test;
CREATE TABLE test (
    name VARCHAR(255)
);

set autocommit=0;
set transaction isolation level read committed;
begin;

-- On node reader:
--

set autocommit=0;
set transaction isolation level read committed;
begin;

-- On node writer:
--

INSERT INTO test VALUES ('bob');

-- On node reader:
--

SELECT * from test;
-- Returns the row with bob in it!!!

可能相关,我注意到即使在回滚后该行仍然存在!

所以我的问题是自动提交并没有真正被禁用,并且事务隔离级别因此被有效地忽略了?

再见, 谢尔顿。

I can't seem to get MySQL 5.0.32 on 32bit x86 Debian to honour transaction isolation levels.

I've reduced my problem to its simplest form, tested with the mysql command-line client:

-- On node writer:
--

DROP TABLE test;
CREATE TABLE test (
    name VARCHAR(255)
);

set autocommit=0;
set transaction isolation level read committed;
begin;

-- On node reader:
--

set autocommit=0;
set transaction isolation level read committed;
begin;

-- On node writer:
--

INSERT INTO test VALUES ('bob');

-- On node reader:
--

SELECT * from test;
-- Returns the row with bob in it!!!

Probably related, I've noticed that the row remains even after a rollback!

So my quess is that autocommit isn't really disabled, and that transaction isolation levels are thus effectively ignored?

Ciao,
Sheldon.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

铁憨憨 2024-08-09 09:10:02

默认情况下,您的表似乎是在 MyISAM 中创建的。

它不支持交易。

您能否运行以下命令:

SELECT @@storage_engine

Your tables seem to be created in MyISAM by default.

It doesn't support transactions.

Could you please run the following:

SELECT @@storage_engine
jJeQQOZ5 2024-08-09 09:10:02

抱歉问题,但是你确定你使用的是 innodb 表吗?您必须检查您的默认存储引擎。

Sorry for question, but are you sure you are usign innodb table? You have to check your default storage engine.

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