READ COMMITTED isolation level doesn't work (at least with InnoDB)
Bug #587772 reported by
Stewart Smith
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Drizzle |
Fix Released
|
Medium
|
Stewart Smith | ||
7.0 |
Fix Released
|
Medium
|
Stewart Smith |
Bug Description
Relatively simple test to see if READ COMMITTED actually does, well, READ COMMITTED fails:
(result file generated on mysql 5.1.47)
--- r/trx_isolation
+++ r/trx_isolation
@@ -6,23 +6,16 @@
BEGIN;
SELECT * from t1;
a
-1
INSERT INTO t1 values (2);
SELECT * from t1;
a
-1
-2
COMMIT;
BEGIN;
SELECT * FROM t1;
a
-1
-2
COMMIT;
SELECT * from t1 order by a;
a
-1
-2
COMMIT;
BEGIN;
SELECT * from t1 order by a;
Related branches
lp:~stewart/drizzle/bug587772-read-committed
- Drizzle Developers: Pending requested
-
Diff: 945 lines (+745/-31)22 files modifieddrizzled/transaction_services.cc (+12/-2)
plugin/haildb/haildb_engine.cc (+1/-2)
plugin/innobase/handler/ha_innodb.cc (+24/-17)
plugin/pbxt/src/ha_pbxt.cc (+3/-10)
plugin/storage_engine_api_tester/cursor_states.cc (+42/-0)
plugin/storage_engine_api_tester/cursor_states_to_dot.cc (+49/-0)
plugin/storage_engine_api_tester/engine_states.cc (+61/-0)
plugin/storage_engine_api_tester/engine_states_to_dot.cc (+49/-0)
plugin/storage_engine_api_tester/plugin.am (+9/-0)
plugin/storage_engine_api_tester/plugin.ini (+6/-0)
plugin/storage_engine_api_tester/storage_engine_api_tester.cc (+386/-0)
plugin/storage_engine_api_tester/tests/r/create_table.result (+2/-0)
plugin/storage_engine_api_tester/tests/r/init.result (+3/-0)
plugin/storage_engine_api_tester/tests/r/rollback_statement.result (+4/-0)
plugin/storage_engine_api_tester/tests/r/select.result (+5/-0)
plugin/storage_engine_api_tester/tests/t/create_table.test (+2/-0)
plugin/storage_engine_api_tester/tests/t/init.test (+1/-0)
plugin/storage_engine_api_tester/tests/t/master.opt (+1/-0)
plugin/storage_engine_api_tester/tests/t/rollback_statement.test (+4/-0)
plugin/storage_engine_api_tester/tests/t/select.test (+5/-0)
tests/r/trx_isolation_read_committed.result (+33/-0)
tests/t/trx_isolation_read_committed.test (+43/-0)
Changed in drizzle: | |
assignee: | nobody → Stewart Smith (stewart) |
Changed in drizzle: | |
status: | Confirmed → Fix Committed |
milestone: | none → 2010-11-08 |
To post a comment you must log in.
It turns out that this isn't tested by the mysql test suite either, but it does work there.
InnoDB starts a statement (i.e. gets a consistent snapshot for the statement) for statements in READ COMMITTED isolation level transactions by setting sql_stat_start to TRUE in Cursor: :external_ lock().
This is mirrored in Embedded InnoDB Cursor by calling the Embedded InnoDB ib_cursor_ stmt_begin( ) (which encapsulates the exact same thing).... except that it takes a cursor, so must be done as part of the Cursor, not the Storage Engine (so we can't call it in startStatement) - the same limitation as the innobase handler has.
then... later on, during execution, InnoDB finally actually assigns the snapshot.
anyway.... READ COMMITTED is broken and it shouldn't be.