mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
row_search_for_mysql(): Never try semi-consistent read in unique searches.
They are only useful in table scans. (Bug #52663)
This commit is contained in:
26
mysql-test/suite/innodb/r/innodb_bug52663.result
Normal file
26
mysql-test/suite/innodb/r/innodb_bug52663.result
Normal file
@ -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;
|
1
mysql-test/suite/innodb/t/innodb_bug52663-master.opt
Normal file
1
mysql-test/suite/innodb/t/innodb_bug52663-master.opt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--innodb_lock_wait_timeout=1
|
34
mysql-test/suite/innodb/t/innodb_bug52663.test
Normal file
34
mysql-test/suite/innodb/t/innodb_bug52663.test
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
--source include/have_innodb.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;
|
26
mysql-test/suite/innodb_plugin/r/innodb_bug52663.result
Normal file
26
mysql-test/suite/innodb_plugin/r/innodb_bug52663.result
Normal file
@ -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;
|
34
mysql-test/suite/innodb_plugin/t/innodb_bug52663.test
Normal file
34
mysql-test/suite/innodb_plugin/t/innodb_bug52663.test
Normal file
@ -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;
|
@ -3956,6 +3956,7 @@ no_gap_lock:
|
|||||||
case DB_LOCK_WAIT:
|
case DB_LOCK_WAIT:
|
||||||
if (UNIV_LIKELY(prebuilt->row_read_type
|
if (UNIV_LIKELY(prebuilt->row_read_type
|
||||||
!= ROW_READ_TRY_SEMI_CONSISTENT)
|
!= ROW_READ_TRY_SEMI_CONSISTENT)
|
||||||
|
|| unique_search
|
||||||
|| index != clust_index) {
|
|| index != clust_index) {
|
||||||
|
|
||||||
goto lock_wait_or_error;
|
goto lock_wait_or_error;
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2010-04-26 The InnoDB Team
|
||||||
|
|
||||||
|
* row/row0sel.c:
|
||||||
|
Fix Bug#52663 Lost update incrementing column value under
|
||||||
|
READ COMMITTED isolation level
|
||||||
|
|
||||||
2010-04-22 The InnoDB Team
|
2010-04-22 The InnoDB Team
|
||||||
|
|
||||||
* include/dict0boot.h, dict/dict0boot.c:
|
* include/dict0boot.h, dict/dict0boot.c:
|
||||||
|
@ -4027,6 +4027,7 @@ no_gap_lock:
|
|||||||
case DB_LOCK_WAIT:
|
case DB_LOCK_WAIT:
|
||||||
if (UNIV_LIKELY(prebuilt->row_read_type
|
if (UNIV_LIKELY(prebuilt->row_read_type
|
||||||
!= ROW_READ_TRY_SEMI_CONSISTENT)
|
!= ROW_READ_TRY_SEMI_CONSISTENT)
|
||||||
|
|| unique_search
|
||||||
|| index != clust_index) {
|
|| index != clust_index) {
|
||||||
|
|
||||||
goto lock_wait_or_error;
|
goto lock_wait_or_error;
|
||||||
|
Reference in New Issue
Block a user