From f18d97ace8c4afb1c3426e9be77ab1b64ea59faf Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 4 May 2010 12:51:25 +0300 Subject: [PATCH] Merge from mysql-5.1-innodb: ------------------------------------------------------------ revno: 3417 revision-id: marko.makela@oracle.com-20100426102725-as2vc44ddykg1786 parent: marko.makela@oracle.com-20100426073949-txnbqldrl9fdlapx committer: Marko M?kel? branch nick: 5.1-innodb timestamp: Mon 2010-04-26 13:27:25 +0300 message: row_search_for_mysql(): Never try semi-consistent read in unique searches. They are only useful in table scans. (Bug #52663) added: mysql-test/suite/innodb/r/innodb_bug52663.result innodb_bug52663.resu-20100426102328-fymyevkummgyc3gm-1 mysql-test/suite/innodb/t/innodb_bug52663-master.opt innodb_bug52663maste-20100426102328-fymyevkummgyc3gm-2 mysql-test/suite/innodb/t/innodb_bug52663.test innodb_bug52663.test-20100426102328-fymyevkummgyc3gm-3 mysql-test/suite/innodb_plugin/r/innodb_bug52663.result innodb_bug52663.resu-20100426102328-fymyevkummgyc3gm-4 mysql-test/suite/innodb_plugin/t/innodb_bug52663.test innodb_bug52663.test-20100426102328-fymyevkummgyc3gm-5 modified: storage/innobase/row/row0sel.c 2@cee13dc7-1704-0410-992b-c9b4543f1246:trunk%2Frow%2Frow0sel.c storage/innodb_plugin/ChangeLog 2425@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2FChangeLog storage/innodb_plugin/row/row0sel.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Frow%2Frow0sel.c ------------------------------------------------------------ --- .../suite/innodb/r/innodb_bug52663.result | 26 ++++++++++++++ .../suite/innodb/t/innodb_bug52663.test | 34 +++++++++++++++++++ storage/innobase/row/row0sel.c | 1 + 3 files changed, 61 insertions(+) create mode 100644 mysql-test/suite/innodb/r/innodb_bug52663.result create mode 100644 mysql-test/suite/innodb/t/innodb_bug52663.test diff --git a/mysql-test/suite/innodb/r/innodb_bug52663.result b/mysql-test/suite/innodb/r/innodb_bug52663.result new file mode 100644 index 00000000000..89add18617b --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug52663.result @@ -0,0 +1,26 @@ +set session transaction isolation level read committed; +create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key +(what, id)) engine=innodb; +insert into innodb_bug52663 values ('total', 0, 0); +begin; +set session transaction isolation level read committed; +begin; +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +select * from innodb_bug52663; +what id count +total 0 1 +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from innodb_bug52663; +what id count +total 0 0 +commit; +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +commit; +select * from innodb_bug52663; +what id count +total 0 2 +select * from innodb_bug52663; +what id count +total 0 2 +drop table innodb_bug52663; diff --git a/mysql-test/suite/innodb/t/innodb_bug52663.test b/mysql-test/suite/innodb/t/innodb_bug52663.test new file mode 100644 index 00000000000..927044fb2ca --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug52663.test @@ -0,0 +1,34 @@ +--source include/have_innodb_plugin.inc + +set session transaction isolation level read committed; + +create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key +(what, id)) engine=innodb; +insert into innodb_bug52663 values ('total', 0, 0); +begin; + +connect (addconroot, localhost, root,,); +connection addconroot; +set session transaction isolation level read committed; +begin; + +connection default; +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +select * from innodb_bug52663; + +connection addconroot; +--error ER_LOCK_WAIT_TIMEOUT +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +select * from innodb_bug52663; + +connection default; +commit; + +connection addconroot; +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +commit; +select * from innodb_bug52663; + +connection default; +select * from innodb_bug52663; +drop table innodb_bug52663; diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 16d4f2f7bfd..92ecca2c75d 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -4027,6 +4027,7 @@ no_gap_lock: case DB_LOCK_WAIT: if (UNIV_LIKELY(prebuilt->row_read_type != ROW_READ_TRY_SEMI_CONSISTENT) + || unique_search || index != clust_index) { goto lock_wait_or_error;