以下の例に従おうとしましたが、セッション A の 2 番目の選択がセッション B によって挿入された新しい行を返すという別の結果が得られます。
例はhttp://dev.mysql.com/doc/refman/5.6/en/innodb-consistent-read.htmlからのものです。5.5を使用しています。
Session A Session B
SET autocommit=0; SET autocommit=0;
time
| SELECT * FROM t;
| empty set
| INSERT INTO t VALUES (1, 2);
|
v SELECT * FROM t;
empty set
COMMIT;
SELECT * FROM t;
empty set
COMMIT;
SELECT * FROM t;
---------------------
| 1 | 2 |
---------------------
1 row in set
更新 以下のようにトランザクションのセッション A と B の両方で変更しましたが、問題はまだ存在します。
SET autocommit=0; -- I think this line is redundant given the line below
set transaction isolation level read committed;
start transaction;
何か案が?