MySQL 事务隔离级别被破坏了吗?
我似乎无法在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
默认情况下,您的表似乎是在
MyISAM
中创建的。它不支持交易。
您能否运行以下命令:
Your tables seem to be created in
MyISAM
by default.It doesn't support transactions.
Could you please run the following:
抱歉问题,但是你确定你使用的是 innodb 表吗?您必须检查您的默认存储引擎。
Sorry for question, but are you sure you are usign innodb table? You have to check your default storage engine.