Commit d72725e5 authored by John Esmet's avatar John Esmet

close[t:4116] close[t:3532] fixed read queries to use explicit begin/commit statements

instead of autocommit. tests now pass.


git-svn-id: file:///svn/mysql/tests/mysql-test@36839 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2900620e
...@@ -44,7 +44,7 @@ def mysqlgen_reload_table(): ...@@ -44,7 +44,7 @@ def mysqlgen_reload_table():
def mysqlgen_cleanup(): def mysqlgen_cleanup():
print "# clean it all up" print "# clean it all up"
print "drop table t;" print "drop table t;"
print "set global tokudb_lock_timeout=30000000;" print "set global tokudb_lock_timeout=4000;"
print "" print ""
write_point_queries = [ write_point_queries = [
("select for update", mysqlgen_select_for_update), ("select for update", mysqlgen_select_for_update),
...@@ -54,7 +54,7 @@ write_point_queries = [ ...@@ -54,7 +54,7 @@ write_point_queries = [
write_range_queries = [ write_range_queries = [
("select for update", mysqlgen_select_for_update_range), ("select for update", mysqlgen_select_for_update_range),
("update", mysqlgen_update_range) ] ("update", mysqlgen_update_range) ]
timeouts = [0, 500000] timeouts = [0, 500]
# Here's where all the magic happens # Here's where all the magic happens
print "# Tokutek" print "# Tokutek"
...@@ -74,7 +74,7 @@ for timeout in timeouts: ...@@ -74,7 +74,7 @@ for timeout in timeouts:
print "# testing conflict \"%s\" vs. \"%s\"" % (ta, tb) print "# testing conflict \"%s\" vs. \"%s\"" % (ta, tb)
print "connection conn1;" print "connection conn1;"
print "begin;" print "begin;"
print "" print "# about to do qa.."
qa("a", "1", "b", "100") qa("a", "1", "b", "100")
print "connection conn2;" print "connection conn2;"
for k in range(1, 5): for k in range(1, 5):
...@@ -83,18 +83,22 @@ for timeout in timeouts: ...@@ -83,18 +83,22 @@ for timeout in timeouts:
qb("a", k, "b", "100") qb("a", k, "b", "100")
# point write lock vs read query # point write lock vs read query
print "# make sure we can't read that row, but can read others." print "# make sure we can't read that row, but can read others."
print "begin;"
print "--error ER_LOCK_WAIT_TIMEOUT" print "--error ER_LOCK_WAIT_TIMEOUT"
mysqlgen_select_star() mysqlgen_select_star()
print "--error ER_LOCK_WAIT_TIMEOUT" print "--error ER_LOCK_WAIT_TIMEOUT"
mysqlgen_select_where("a", "=1") mysqlgen_select_where("a", "=1")
mysqlgen_select_where("a", ">=2") mysqlgen_select_where("a", ">=2")
print "commit;"
# Always check in the end that a commit # Always check in the end that a commit
# allows the other transaction full access # allows the other transaction full access
print "connection conn1;" print "connection conn1;"
print "commit;" print "commit;"
print "connection conn2;" print "connection conn2;"
qb("a", "1", "b", "100") qb("a", "1", "b", "100")
print "begin;"
mysqlgen_select_star() mysqlgen_select_star()
print "commit;"
print "connection conn1;" print "connection conn1;"
print "" print ""
# test early commit # test early commit
...@@ -128,11 +132,13 @@ for timeout in timeouts: ...@@ -128,11 +132,13 @@ for timeout in timeouts:
rq("a", "b", ">2") rq("a", "b", ">2")
# write range lock vs read query # write range lock vs read query
print "# make sure we can't read that row, but can read others." print "# make sure we can't read that row, but can read others."
print "begin;"
print "--error ER_LOCK_WAIT_TIMEOUT" print "--error ER_LOCK_WAIT_TIMEOUT"
mysqlgen_select_star() mysqlgen_select_star()
print "--error ER_LOCK_WAIT_TIMEOUT" print "--error ER_LOCK_WAIT_TIMEOUT"
mysqlgen_select_where("a", "=1") mysqlgen_select_where("a", "=1")
mysqlgen_select_where("a", ">=2") mysqlgen_select_where("a", ">=2")
print "commit;"
# Always check in the end that a commit # Always check in the end that a commit
# allows the other transaction full access # allows the other transaction full access
print "connection conn1;" print "connection conn1;"
...@@ -140,7 +146,9 @@ for timeout in timeouts: ...@@ -140,7 +146,9 @@ for timeout in timeouts:
print "connection conn2;" print "connection conn2;"
rq("a", "b", "<=2") rq("a", "b", "<=2")
rq("a", "b", ">=0") rq("a", "b", ">=0")
print "begin;"
mysqlgen_select_star() mysqlgen_select_star()
print "commit;"
print "connection conn1;" print "connection conn1;"
print "" print ""
# test early commit # test early commit
...@@ -176,6 +184,7 @@ for timeout in timeouts: ...@@ -176,6 +184,7 @@ for timeout in timeouts:
rqb("a", "b", ">=5") rqb("a", "b", ">=5")
# point write lock vs read query # point write lock vs read query
print "# make sure we can't read that row, but can read others." print "# make sure we can't read that row, but can read others."
print "begin;"
print "--error ER_LOCK_WAIT_TIMEOUT" print "--error ER_LOCK_WAIT_TIMEOUT"
mysqlgen_select_star() mysqlgen_select_star()
print "--error ER_LOCK_WAIT_TIMEOUT" print "--error ER_LOCK_WAIT_TIMEOUT"
...@@ -183,6 +192,7 @@ for timeout in timeouts: ...@@ -183,6 +192,7 @@ for timeout in timeouts:
print "--error ER_LOCK_WAIT_TIMEOUT" print "--error ER_LOCK_WAIT_TIMEOUT"
mysqlgen_select_where("a", ">=3 and a<=5") mysqlgen_select_where("a", ">=3 and a<=5")
mysqlgen_select_where("a", ">=5") mysqlgen_select_where("a", ">=5")
print "commit;"
# Always check in the end that a commit # Always check in the end that a commit
# allows the other transaction full access # allows the other transaction full access
print "connection conn1;" print "connection conn1;"
...@@ -191,7 +201,9 @@ for timeout in timeouts: ...@@ -191,7 +201,9 @@ for timeout in timeouts:
rqb("a", "b", ">=0 and a<=3") rqb("a", "b", ">=0 and a<=3")
rqb("a", "b", ">=3 and a<=6") rqb("a", "b", ">=3 and a<=6")
rqb("a", "b", "<=2") rqb("a", "b", "<=2")
print "begin;"
mysqlgen_select_star() mysqlgen_select_star()
print "commit;"
print "connection conn1;" print "connection conn1;"
print "" print ""
# test early commit # test early commit
......
...@@ -24,6 +24,7 @@ a b ...@@ -24,6 +24,7 @@ a b
select * from t where a=4 for update; select * from t where a=4 for update;
a b a b
4 16 4 16
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -36,9 +37,11 @@ a b ...@@ -36,9 +37,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
1 1 1 1
begin;
select * from t; select * from t;
a b a b
1 1 1 1
...@@ -47,6 +50,7 @@ a b ...@@ -47,6 +50,7 @@ a b
4 16 4 16
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
...@@ -56,6 +60,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -56,6 +60,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a=2; update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -68,7 +73,9 @@ a b ...@@ -68,7 +73,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
a b a b
1 1 1 1
...@@ -77,6 +84,7 @@ a b ...@@ -77,6 +84,7 @@ a b
4 16 4 16
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
...@@ -86,6 +94,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -86,6 +94,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
insert ignore t values(2, 100); insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -98,7 +107,9 @@ a b ...@@ -98,7 +107,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 1 1 1
...@@ -107,6 +118,7 @@ a b ...@@ -107,6 +118,7 @@ a b
4 16 4 16
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
...@@ -116,6 +128,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -116,6 +128,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
replace t values(2, 100); replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -128,7 +141,9 @@ a b ...@@ -128,7 +141,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -137,6 +152,7 @@ a b ...@@ -137,6 +152,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
...@@ -151,6 +167,7 @@ a b ...@@ -151,6 +167,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -163,6 +180,7 @@ a b ...@@ -163,6 +180,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a<=2 for update; select * from t where a<=2 for update;
a b a b
1 100 1 100
...@@ -175,6 +193,7 @@ a b ...@@ -175,6 +193,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -183,6 +202,7 @@ a b ...@@ -183,6 +202,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
...@@ -192,6 +212,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -192,6 +212,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=0; update t set b=b where a>=0;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>2; update t set b=b where a>2;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -204,8 +225,10 @@ a b ...@@ -204,8 +225,10 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -214,6 +237,7 @@ a b ...@@ -214,6 +237,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
select * from t where a=1 for update; select * from t where a=1 for update;
...@@ -227,6 +251,7 @@ a b ...@@ -227,6 +251,7 @@ a b
select * from t where a=4 for update; select * from t where a=4 for update;
a b a b
4 100 4 100
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -239,9 +264,11 @@ a b ...@@ -239,9 +264,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
1 100 1 100
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -250,6 +277,7 @@ a b ...@@ -250,6 +277,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
update t set b=b where a=1; update t set b=b where a=1;
...@@ -257,6 +285,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -257,6 +285,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a=2; update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -269,7 +298,9 @@ a b ...@@ -269,7 +298,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -278,6 +309,7 @@ a b ...@@ -278,6 +309,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
insert ignore t values(1, 100); insert ignore t values(1, 100);
...@@ -285,6 +317,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -285,6 +317,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
insert ignore t values(2, 100); insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -297,7 +330,9 @@ a b ...@@ -297,7 +330,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -306,6 +341,7 @@ a b ...@@ -306,6 +341,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
replace t values(1, 100); replace t values(1, 100);
...@@ -313,6 +349,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -313,6 +349,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
replace t values(2, 100); replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -325,7 +362,9 @@ a b ...@@ -325,7 +362,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -334,6 +373,7 @@ a b ...@@ -334,6 +373,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
select * from t where a<=2 for update; select * from t where a<=2 for update;
...@@ -346,6 +386,7 @@ a b ...@@ -346,6 +386,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -358,6 +399,7 @@ a b ...@@ -358,6 +399,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a<=2 for update; select * from t where a<=2 for update;
a b a b
1 100 1 100
...@@ -370,6 +412,7 @@ a b ...@@ -370,6 +412,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -378,6 +421,7 @@ a b ...@@ -378,6 +421,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
update t set b=b where a<=2; update t set b=b where a<=2;
...@@ -385,6 +429,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -385,6 +429,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=0; update t set b=b where a>=0;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>2; update t set b=b where a>2;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -397,8 +442,10 @@ a b ...@@ -397,8 +442,10 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -407,6 +454,7 @@ a b ...@@ -407,6 +454,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 100); insert ignore t values(1, 100);
select * from t where a=1 for update; select * from t where a=1 for update;
...@@ -420,6 +468,7 @@ a b ...@@ -420,6 +468,7 @@ a b
select * from t where a=4 for update; select * from t where a=4 for update;
a b a b
4 100 4 100
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -432,9 +481,11 @@ a b ...@@ -432,9 +481,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
1 100 1 100
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -443,6 +494,7 @@ a b ...@@ -443,6 +494,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 100); insert ignore t values(1, 100);
update t set b=b where a=1; update t set b=b where a=1;
...@@ -450,6 +502,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -450,6 +502,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a=2; update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -462,7 +515,9 @@ a b ...@@ -462,7 +515,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -471,6 +526,7 @@ a b ...@@ -471,6 +526,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 100); insert ignore t values(1, 100);
insert ignore t values(1, 100); insert ignore t values(1, 100);
...@@ -478,6 +534,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -478,6 +534,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
insert ignore t values(2, 100); insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -490,7 +547,9 @@ a b ...@@ -490,7 +547,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -499,6 +558,7 @@ a b ...@@ -499,6 +558,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 100); insert ignore t values(1, 100);
replace t values(1, 100); replace t values(1, 100);
...@@ -506,6 +566,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -506,6 +566,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
replace t values(2, 100); replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -518,7 +579,9 @@ a b ...@@ -518,7 +579,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -527,6 +590,7 @@ a b ...@@ -527,6 +590,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 100); insert ignore t values(1, 100);
select * from t where a<=2 for update; select * from t where a<=2 for update;
...@@ -539,6 +603,7 @@ a b ...@@ -539,6 +603,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -551,6 +616,7 @@ a b ...@@ -551,6 +616,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a<=2 for update; select * from t where a<=2 for update;
a b a b
1 100 1 100
...@@ -563,6 +629,7 @@ a b ...@@ -563,6 +629,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -571,6 +638,7 @@ a b ...@@ -571,6 +638,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 100); insert ignore t values(1, 100);
update t set b=b where a<=2; update t set b=b where a<=2;
...@@ -578,6 +646,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -578,6 +646,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=0; update t set b=b where a>=0;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>2; update t set b=b where a>2;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -590,8 +659,10 @@ a b ...@@ -590,8 +659,10 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -600,6 +671,7 @@ a b ...@@ -600,6 +671,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 100); replace t values(1, 100);
select * from t where a=1 for update; select * from t where a=1 for update;
...@@ -613,6 +685,7 @@ a b ...@@ -613,6 +685,7 @@ a b
select * from t where a=4 for update; select * from t where a=4 for update;
a b a b
4 100 4 100
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -625,9 +698,11 @@ a b ...@@ -625,9 +698,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
1 100 1 100
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -636,6 +711,7 @@ a b ...@@ -636,6 +711,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 100); replace t values(1, 100);
update t set b=b where a=1; update t set b=b where a=1;
...@@ -643,6 +719,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -643,6 +719,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a=2; update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -655,7 +732,9 @@ a b ...@@ -655,7 +732,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -664,6 +743,7 @@ a b ...@@ -664,6 +743,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 100); replace t values(1, 100);
insert ignore t values(1, 100); insert ignore t values(1, 100);
...@@ -671,6 +751,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -671,6 +751,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
insert ignore t values(2, 100); insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -683,7 +764,9 @@ a b ...@@ -683,7 +764,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -692,6 +775,7 @@ a b ...@@ -692,6 +775,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 100); replace t values(1, 100);
replace t values(1, 100); replace t values(1, 100);
...@@ -699,6 +783,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -699,6 +783,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
replace t values(2, 100); replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -711,7 +796,9 @@ a b ...@@ -711,7 +796,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -720,6 +807,7 @@ a b ...@@ -720,6 +807,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 100); replace t values(1, 100);
select * from t where a<=2 for update; select * from t where a<=2 for update;
...@@ -732,6 +820,7 @@ a b ...@@ -732,6 +820,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -744,6 +833,7 @@ a b ...@@ -744,6 +833,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a<=2 for update; select * from t where a<=2 for update;
a b a b
1 100 1 100
...@@ -756,6 +846,7 @@ a b ...@@ -756,6 +846,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -764,6 +855,7 @@ a b ...@@ -764,6 +855,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 100); replace t values(1, 100);
update t set b=b where a<=2; update t set b=b where a<=2;
...@@ -771,6 +863,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -771,6 +863,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=0; update t set b=b where a>=0;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>2; update t set b=b where a>2;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -783,8 +876,10 @@ a b ...@@ -783,8 +876,10 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -793,6 +888,7 @@ a b ...@@ -793,6 +888,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a>=2 and a<=4 for update; select * from t where a>=2 and a<=4 for update;
a b a b
...@@ -809,6 +905,7 @@ select * from t where a>=5 for update; ...@@ -809,6 +905,7 @@ select * from t where a>=5 for update;
a b a b
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=2; select * from t where a=2;
...@@ -820,6 +917,7 @@ a b ...@@ -820,6 +917,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a>=0 and a<=3 for update; select * from t where a>=0 and a<=3 for update;
a b a b
1 100 1 100
...@@ -835,6 +933,7 @@ select * from t where a<=2 for update; ...@@ -835,6 +933,7 @@ select * from t where a<=2 for update;
a b a b
1 100 1 100
2 100 2 100
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -843,6 +942,7 @@ a b ...@@ -843,6 +942,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a>=2 and a<=4 for update; select * from t where a>=2 and a<=4 for update;
a b a b
...@@ -856,6 +956,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -856,6 +956,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a<=2; update t set b=b where a<=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=5; update t set b=b where a>=5;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=2; select * from t where a=2;
...@@ -867,9 +968,11 @@ a b ...@@ -867,9 +968,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a>=0 and a<=3; update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6; update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -878,6 +981,7 @@ a b ...@@ -878,6 +981,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a>=2 and a<=4; update t set b=b where a>=2 and a<=4;
select * from t where a>=0 and a<=3 for update; select * from t where a>=0 and a<=3 for update;
...@@ -890,6 +994,7 @@ select * from t where a>=5 for update; ...@@ -890,6 +994,7 @@ select * from t where a>=5 for update;
a b a b
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=2; select * from t where a=2;
...@@ -901,6 +1006,7 @@ a b ...@@ -901,6 +1006,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a>=0 and a<=3 for update; select * from t where a>=0 and a<=3 for update;
a b a b
1 100 1 100
...@@ -916,6 +1022,7 @@ select * from t where a<=2 for update; ...@@ -916,6 +1022,7 @@ select * from t where a<=2 for update;
a b a b
1 100 1 100
2 100 2 100
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -924,6 +1031,7 @@ a b ...@@ -924,6 +1031,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a>=2 and a<=4; update t set b=b where a>=2 and a<=4;
update t set b=b where a>=0 and a<=3; update t set b=b where a>=0 and a<=3;
...@@ -933,6 +1041,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -933,6 +1041,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a<=2; update t set b=b where a<=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=5; update t set b=b where a>=5;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=2; select * from t where a=2;
...@@ -944,9 +1053,11 @@ a b ...@@ -944,9 +1053,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a>=0 and a<=3; update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6; update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -955,6 +1066,7 @@ a b ...@@ -955,6 +1066,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
set global tokudb_lock_timeout=500; set global tokudb_lock_timeout=500;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
...@@ -971,6 +1083,7 @@ a b ...@@ -971,6 +1083,7 @@ a b
select * from t where a=4 for update; select * from t where a=4 for update;
a b a b
4 100 4 100
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -983,9 +1096,11 @@ a b ...@@ -983,9 +1096,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
1 100 1 100
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -994,6 +1109,7 @@ a b ...@@ -994,6 +1109,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
...@@ -1011,6 +1127,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1011,6 +1127,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a=2; update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1023,7 +1140,9 @@ a b ...@@ -1023,7 +1140,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -1032,6 +1151,7 @@ a b ...@@ -1032,6 +1151,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
...@@ -1047,6 +1167,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1047,6 +1167,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
insert ignore t values(2, 100); insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1059,7 +1180,9 @@ a b ...@@ -1059,7 +1180,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -1068,6 +1191,7 @@ a b ...@@ -1068,6 +1191,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
...@@ -1083,6 +1207,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1083,6 +1207,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
replace t values(2, 100); replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1095,7 +1220,9 @@ a b ...@@ -1095,7 +1220,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -1104,6 +1231,7 @@ a b ...@@ -1104,6 +1231,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
...@@ -1124,6 +1252,7 @@ a b ...@@ -1124,6 +1252,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1136,6 +1265,7 @@ a b ...@@ -1136,6 +1265,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a<=2 for update; select * from t where a<=2 for update;
a b a b
1 175 1 175
...@@ -1148,6 +1278,7 @@ a b ...@@ -1148,6 +1278,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1156,6 +1287,7 @@ a b ...@@ -1156,6 +1287,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
...@@ -1174,6 +1306,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1174,6 +1306,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=0; update t set b=b where a>=0;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>2; update t set b=b where a>2;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1186,8 +1319,10 @@ a b ...@@ -1186,8 +1319,10 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1196,6 +1331,7 @@ a b ...@@ -1196,6 +1331,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
...@@ -1215,6 +1351,7 @@ a b ...@@ -1215,6 +1351,7 @@ a b
select * from t where a=4 for update; select * from t where a=4 for update;
a b a b
4 100 4 100
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1227,9 +1364,11 @@ a b ...@@ -1227,9 +1364,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
1 175 1 175
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1238,6 +1377,7 @@ a b ...@@ -1238,6 +1377,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
select * from t where a=1 for update; select * from t where a=1 for update;
...@@ -1251,6 +1391,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1251,6 +1391,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a=2; update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1263,7 +1404,9 @@ a b ...@@ -1263,7 +1404,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1272,6 +1415,7 @@ a b ...@@ -1272,6 +1415,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
update t set b=b where a=1; update t set b=b where a=1;
...@@ -1283,6 +1427,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1283,6 +1427,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
insert ignore t values(2, 100); insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1295,7 +1440,9 @@ a b ...@@ -1295,7 +1440,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1304,6 +1451,7 @@ a b ...@@ -1304,6 +1451,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
insert ignore t values(1, 175); insert ignore t values(1, 175);
...@@ -1315,6 +1463,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1315,6 +1463,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
replace t values(2, 100); replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1327,7 +1476,9 @@ a b ...@@ -1327,7 +1476,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -1336,6 +1487,7 @@ a b ...@@ -1336,6 +1487,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
replace t values(1, 175); replace t values(1, 175);
...@@ -1352,6 +1504,7 @@ a b ...@@ -1352,6 +1504,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1364,6 +1517,7 @@ a b ...@@ -1364,6 +1517,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a<=2 for update; select * from t where a<=2 for update;
a b a b
1 175 1 175
...@@ -1376,6 +1530,7 @@ a b ...@@ -1376,6 +1530,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1384,6 +1539,7 @@ a b ...@@ -1384,6 +1539,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
select * from t where a<=2 for update; select * from t where a<=2 for update;
...@@ -1398,6 +1554,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1398,6 +1554,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=0; update t set b=b where a>=0;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>2; update t set b=b where a>2;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1410,8 +1567,10 @@ a b ...@@ -1410,8 +1567,10 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1420,6 +1579,7 @@ a b ...@@ -1420,6 +1579,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a=1; update t set b=b where a=1;
update t set b=b where a<=2; update t set b=b where a<=2;
...@@ -1437,6 +1597,7 @@ a b ...@@ -1437,6 +1597,7 @@ a b
select * from t where a=4 for update; select * from t where a=4 for update;
a b a b
4 100 4 100
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1449,9 +1610,11 @@ a b ...@@ -1449,9 +1610,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
1 175 1 175
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1460,6 +1623,7 @@ a b ...@@ -1460,6 +1623,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 150); insert ignore t values(1, 150);
select * from t where a=1 for update; select * from t where a=1 for update;
...@@ -1473,6 +1637,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1473,6 +1637,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a=2; update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1485,7 +1650,9 @@ a b ...@@ -1485,7 +1650,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1494,6 +1661,7 @@ a b ...@@ -1494,6 +1661,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 150); insert ignore t values(1, 150);
update t set b=b where a=1; update t set b=b where a=1;
...@@ -1505,6 +1673,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1505,6 +1673,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
insert ignore t values(2, 100); insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1517,7 +1686,9 @@ a b ...@@ -1517,7 +1686,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1526,6 +1697,7 @@ a b ...@@ -1526,6 +1697,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 150); insert ignore t values(1, 150);
insert ignore t values(1, 175); insert ignore t values(1, 175);
...@@ -1537,6 +1709,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1537,6 +1709,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
replace t values(2, 100); replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1549,7 +1722,9 @@ a b ...@@ -1549,7 +1722,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -1558,6 +1733,7 @@ a b ...@@ -1558,6 +1733,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 150); insert ignore t values(1, 150);
replace t values(1, 175); replace t values(1, 175);
...@@ -1574,6 +1750,7 @@ a b ...@@ -1574,6 +1750,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1586,6 +1763,7 @@ a b ...@@ -1586,6 +1763,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a<=2 for update; select * from t where a<=2 for update;
a b a b
1 175 1 175
...@@ -1598,6 +1776,7 @@ a b ...@@ -1598,6 +1776,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1606,6 +1785,7 @@ a b ...@@ -1606,6 +1785,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 150); insert ignore t values(1, 150);
select * from t where a<=2 for update; select * from t where a<=2 for update;
...@@ -1620,6 +1800,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1620,6 +1800,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=0; update t set b=b where a>=0;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>2; update t set b=b where a>2;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1632,8 +1813,10 @@ a b ...@@ -1632,8 +1813,10 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
a b a b
1 175 1 175
...@@ -1642,6 +1825,7 @@ a b ...@@ -1642,6 +1825,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
insert ignore t values(1, 150); insert ignore t values(1, 150);
update t set b=b where a<=2; update t set b=b where a<=2;
...@@ -1659,6 +1843,7 @@ a b ...@@ -1659,6 +1843,7 @@ a b
select * from t where a=4 for update; select * from t where a=4 for update;
a b a b
4 100 4 100
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1671,9 +1856,11 @@ a b ...@@ -1671,9 +1856,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a=1 for update; select * from t where a=1 for update;
a b a b
1 100 1 100
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -1682,6 +1869,7 @@ a b ...@@ -1682,6 +1869,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 150); replace t values(1, 150);
select * from t where a=1 for update; select * from t where a=1 for update;
...@@ -1695,6 +1883,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1695,6 +1883,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a=2; update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1707,7 +1896,9 @@ a b ...@@ -1707,7 +1896,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -1716,6 +1907,7 @@ a b ...@@ -1716,6 +1907,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 150); replace t values(1, 150);
update t set b=b where a=1; update t set b=b where a=1;
...@@ -1727,6 +1919,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1727,6 +1919,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
insert ignore t values(2, 100); insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1739,7 +1932,9 @@ a b ...@@ -1739,7 +1932,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -1748,6 +1943,7 @@ a b ...@@ -1748,6 +1943,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 150); replace t values(1, 150);
insert ignore t values(1, 175); insert ignore t values(1, 175);
...@@ -1759,6 +1955,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1759,6 +1955,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
replace t values(2, 100); replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1771,7 +1968,9 @@ a b ...@@ -1771,7 +1968,9 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -1780,6 +1979,7 @@ a b ...@@ -1780,6 +1979,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 150); replace t values(1, 150);
replace t values(1, 175); replace t values(1, 175);
...@@ -1796,6 +1996,7 @@ a b ...@@ -1796,6 +1996,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1808,6 +2009,7 @@ a b ...@@ -1808,6 +2009,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a<=2 for update; select * from t where a<=2 for update;
a b a b
1 100 1 100
...@@ -1820,6 +2022,7 @@ a b ...@@ -1820,6 +2022,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -1828,6 +2031,7 @@ a b ...@@ -1828,6 +2031,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 150); replace t values(1, 150);
select * from t where a<=2 for update; select * from t where a<=2 for update;
...@@ -1842,6 +2046,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1842,6 +2046,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=0; update t set b=b where a>=0;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>2; update t set b=b where a>2;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=1; select * from t where a=1;
...@@ -1854,8 +2059,10 @@ a b ...@@ -1854,8 +2059,10 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
a b a b
1 100 1 100
...@@ -1864,6 +2071,7 @@ a b ...@@ -1864,6 +2071,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
replace t values(1, 150); replace t values(1, 150);
update t set b=b where a<=2; update t set b=b where a<=2;
...@@ -1884,6 +2092,7 @@ select * from t where a>=5 for update; ...@@ -1884,6 +2092,7 @@ select * from t where a>=5 for update;
a b a b
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=2; select * from t where a=2;
...@@ -1895,6 +2104,7 @@ a b ...@@ -1895,6 +2104,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a>=0 and a<=3 for update; select * from t where a>=0 and a<=3 for update;
a b a b
1 150 1 150
...@@ -1910,6 +2120,7 @@ select * from t where a<=2 for update; ...@@ -1910,6 +2120,7 @@ select * from t where a<=2 for update;
a b a b
1 150 1 150
2 100 2 100
begin;
select * from t; select * from t;
a b a b
1 150 1 150
...@@ -1918,6 +2129,7 @@ a b ...@@ -1918,6 +2129,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a>=2 and a<=4 for update; select * from t where a>=2 and a<=4 for update;
a b a b
...@@ -1943,6 +2155,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -1943,6 +2155,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a<=2; update t set b=b where a<=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=5; update t set b=b where a>=5;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=2; select * from t where a=2;
...@@ -1954,9 +2167,11 @@ a b ...@@ -1954,9 +2167,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a>=0 and a<=3; update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6; update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
begin;
select * from t; select * from t;
a b a b
1 150 1 150
...@@ -1965,6 +2180,7 @@ a b ...@@ -1965,6 +2180,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
select * from t where a>=2 and a<=4 for update; select * from t where a>=2 and a<=4 for update;
a b a b
...@@ -1985,6 +2201,7 @@ select * from t where a>=5 for update; ...@@ -1985,6 +2201,7 @@ select * from t where a>=5 for update;
a b a b
5 25 5 25
6 36 6 36
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=2; select * from t where a=2;
...@@ -1996,6 +2213,7 @@ a b ...@@ -1996,6 +2213,7 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
select * from t where a>=0 and a<=3 for update; select * from t where a>=0 and a<=3 for update;
a b a b
1 150 1 150
...@@ -2011,6 +2229,7 @@ select * from t where a<=2 for update; ...@@ -2011,6 +2229,7 @@ select * from t where a<=2 for update;
a b a b
1 150 1 150
2 100 2 100
begin;
select * from t; select * from t;
a b a b
1 150 1 150
...@@ -2019,6 +2238,7 @@ a b ...@@ -2019,6 +2238,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a>=2 and a<=4; update t set b=b where a>=2 and a<=4;
select * from t where a>=0 and a<=3 for update; select * from t where a>=0 and a<=3 for update;
...@@ -2036,6 +2256,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction ...@@ -2036,6 +2256,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a<=2; update t set b=b where a<=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t set b=b where a>=5; update t set b=b where a>=5;
begin;
select * from t; select * from t;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t where a=2; select * from t where a=2;
...@@ -2047,9 +2268,11 @@ a b ...@@ -2047,9 +2268,11 @@ a b
5 25 5 25
6 36 6 36
commit; commit;
commit;
update t set b=b where a>=0 and a<=3; update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6; update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
begin;
select * from t; select * from t;
a b a b
1 150 1 150
...@@ -2058,6 +2281,7 @@ a b ...@@ -2058,6 +2281,7 @@ a b
4 100 4 100
5 25 5 25
6 36 6 36
commit;
begin; begin;
update t set b=b where a>=2 and a<=4; update t set b=b where a>=2 and a<=4;
update t set b=b where a>=0 and a<=3; update t set b=b where a>=0 and a<=3;
......
# Tokutek # Tokutek
# Blocking row lock tests; # Blocking row lock tests;
# Generated by blocking-row-locks-testgen.py on 2011-09-26; # Generated by blocking-row-locks-testgen.py on 2011-11-11;
# prepare with some common parameters # prepare with some common parameters
connect(conn1, localhost, root); connect(conn1, localhost, root);
...@@ -28,7 +28,7 @@ set global tokudb_lock_timeout=0; ...@@ -28,7 +28,7 @@ set global tokudb_lock_timeout=0;
# testing conflict "select for update" vs. "select for update" # testing conflict "select for update" vs. "select for update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
select * from t where a=1 for update; select * from t where a=1 for update;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -37,22 +37,26 @@ select * from t where a=2 for update; ...@@ -37,22 +37,26 @@ select * from t where a=2 for update;
select * from t where a=3 for update; select * from t where a=3 for update;
select * from t where a=4 for update; select * from t where a=4 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a=1 for update; select * from t where a=1 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "select for update" vs. "update" # testing conflict "select for update" vs. "update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
select * from t where a=1 for update; select * from t where a=1 for update;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -61,22 +65,26 @@ update t set b=b where a=2; ...@@ -61,22 +65,26 @@ update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "select for update" vs. "insert" # testing conflict "select for update" vs. "insert"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
select * from t where a=1 for update; select * from t where a=1 for update;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -85,22 +93,26 @@ insert ignore t values(2, 100); ...@@ -85,22 +93,26 @@ insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "select for update" vs. "replace" # testing conflict "select for update" vs. "replace"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
select * from t where a=1 for update; select * from t where a=1 for update;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -109,16 +121,20 @@ replace t values(2, 100); ...@@ -109,16 +121,20 @@ replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "select for update" vs "select for update" # testing range query "select for update" vs "select for update"
...@@ -133,17 +149,21 @@ select * from t where a<=2 for update; ...@@ -133,17 +149,21 @@ select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
select * from t where a>2 for update; select * from t where a>2 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "update" vs "select for update" # testing range query "update" vs "select for update"
...@@ -158,23 +178,27 @@ update t set b=b where a<=2; ...@@ -158,23 +178,27 @@ update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
update t set b=b where a>2; update t set b=b where a>2;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "update" vs. "select for update" # testing conflict "update" vs. "select for update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
update t set b=b where a=1; update t set b=b where a=1;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -183,22 +207,26 @@ select * from t where a=2 for update; ...@@ -183,22 +207,26 @@ select * from t where a=2 for update;
select * from t where a=3 for update; select * from t where a=3 for update;
select * from t where a=4 for update; select * from t where a=4 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a=1 for update; select * from t where a=1 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "update" vs. "update" # testing conflict "update" vs. "update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
update t set b=b where a=1; update t set b=b where a=1;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -207,22 +235,26 @@ update t set b=b where a=2; ...@@ -207,22 +235,26 @@ update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "update" vs. "insert" # testing conflict "update" vs. "insert"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
update t set b=b where a=1; update t set b=b where a=1;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -231,22 +263,26 @@ insert ignore t values(2, 100); ...@@ -231,22 +263,26 @@ insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "update" vs. "replace" # testing conflict "update" vs. "replace"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
update t set b=b where a=1; update t set b=b where a=1;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -255,16 +291,20 @@ replace t values(2, 100); ...@@ -255,16 +291,20 @@ replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "select for update" vs "update" # testing range query "select for update" vs "update"
...@@ -279,17 +319,21 @@ select * from t where a<=2 for update; ...@@ -279,17 +319,21 @@ select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
select * from t where a>2 for update; select * from t where a>2 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "update" vs "update" # testing range query "update" vs "update"
...@@ -304,23 +348,27 @@ update t set b=b where a<=2; ...@@ -304,23 +348,27 @@ update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
update t set b=b where a>2; update t set b=b where a>2;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "insert" vs. "select for update" # testing conflict "insert" vs. "select for update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
insert ignore t values(1, 100); insert ignore t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -329,22 +377,26 @@ select * from t where a=2 for update; ...@@ -329,22 +377,26 @@ select * from t where a=2 for update;
select * from t where a=3 for update; select * from t where a=3 for update;
select * from t where a=4 for update; select * from t where a=4 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a=1 for update; select * from t where a=1 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "insert" vs. "update" # testing conflict "insert" vs. "update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
insert ignore t values(1, 100); insert ignore t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -353,22 +405,26 @@ update t set b=b where a=2; ...@@ -353,22 +405,26 @@ update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "insert" vs. "insert" # testing conflict "insert" vs. "insert"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
insert ignore t values(1, 100); insert ignore t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -377,22 +433,26 @@ insert ignore t values(2, 100); ...@@ -377,22 +433,26 @@ insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "insert" vs. "replace" # testing conflict "insert" vs. "replace"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
insert ignore t values(1, 100); insert ignore t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -401,16 +461,20 @@ replace t values(2, 100); ...@@ -401,16 +461,20 @@ replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "select for update" vs "insert" # testing range query "select for update" vs "insert"
...@@ -425,17 +489,21 @@ select * from t where a<=2 for update; ...@@ -425,17 +489,21 @@ select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
select * from t where a>2 for update; select * from t where a>2 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "update" vs "insert" # testing range query "update" vs "insert"
...@@ -450,23 +518,27 @@ update t set b=b where a<=2; ...@@ -450,23 +518,27 @@ update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
update t set b=b where a>2; update t set b=b where a>2;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "replace" vs. "select for update" # testing conflict "replace" vs. "select for update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
replace t values(1, 100); replace t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -475,22 +547,26 @@ select * from t where a=2 for update; ...@@ -475,22 +547,26 @@ select * from t where a=2 for update;
select * from t where a=3 for update; select * from t where a=3 for update;
select * from t where a=4 for update; select * from t where a=4 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a=1 for update; select * from t where a=1 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "replace" vs. "update" # testing conflict "replace" vs. "update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
replace t values(1, 100); replace t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -499,22 +575,26 @@ update t set b=b where a=2; ...@@ -499,22 +575,26 @@ update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "replace" vs. "insert" # testing conflict "replace" vs. "insert"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
replace t values(1, 100); replace t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -523,22 +603,26 @@ insert ignore t values(2, 100); ...@@ -523,22 +603,26 @@ insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing conflict "replace" vs. "replace" # testing conflict "replace" vs. "replace"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
replace t values(1, 100); replace t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -547,16 +631,20 @@ replace t values(2, 100); ...@@ -547,16 +631,20 @@ replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "select for update" vs "replace" # testing range query "select for update" vs "replace"
...@@ -571,17 +659,21 @@ select * from t where a<=2 for update; ...@@ -571,17 +659,21 @@ select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
select * from t where a>2 for update; select * from t where a>2 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "update" vs "replace" # testing range query "update" vs "replace"
...@@ -596,17 +688,21 @@ update t set b=b where a<=2; ...@@ -596,17 +688,21 @@ update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
update t set b=b where a>2; update t set b=b where a>2;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "select for update" vs range query "select for update" # testing range query "select for update" vs range query "select for update"
...@@ -623,6 +719,7 @@ select * from t where a>=3 and a<=6 for update; ...@@ -623,6 +719,7 @@ select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=5 for update; select * from t where a>=5 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -630,13 +727,16 @@ select * from t where a=2; ...@@ -630,13 +727,16 @@ select * from t where a=2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=5; select * from t where a>=3 and a<=5;
select * from t where a>=5; select * from t where a>=5;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a>=0 and a<=3 for update; select * from t where a>=0 and a<=3 for update;
select * from t where a>=3 and a<=6 for update; select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update; select * from t where a<=2 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "select for update" vs range query "update" # testing range query "select for update" vs range query "update"
...@@ -653,6 +753,7 @@ update t set b=b where a>=3 and a<=6; ...@@ -653,6 +753,7 @@ update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=5; update t set b=b where a>=5;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -660,13 +761,16 @@ select * from t where a=2; ...@@ -660,13 +761,16 @@ select * from t where a=2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=5; select * from t where a>=3 and a<=5;
select * from t where a>=5; select * from t where a>=5;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a>=0 and a<=3; update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6; update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "update" vs range query "select for update" # testing range query "update" vs range query "select for update"
...@@ -683,6 +787,7 @@ select * from t where a>=3 and a<=6 for update; ...@@ -683,6 +787,7 @@ select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=5 for update; select * from t where a>=5 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -690,13 +795,16 @@ select * from t where a=2; ...@@ -690,13 +795,16 @@ select * from t where a=2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=5; select * from t where a>=3 and a<=5;
select * from t where a>=5; select * from t where a>=5;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a>=0 and a<=3 for update; select * from t where a>=0 and a<=3 for update;
select * from t where a>=3 and a<=6 for update; select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update; select * from t where a<=2 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing range query "update" vs range query "update" # testing range query "update" vs range query "update"
...@@ -713,6 +821,7 @@ update t set b=b where a>=3 and a<=6; ...@@ -713,6 +821,7 @@ update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=5; update t set b=b where a>=5;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -720,13 +829,16 @@ select * from t where a=2; ...@@ -720,13 +829,16 @@ select * from t where a=2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=5; select * from t where a>=3 and a<=5;
select * from t where a>=5; select * from t where a>=5;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a>=0 and a<=3; update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6; update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# testing with timeout 500 # testing with timeout 500
...@@ -736,7 +848,7 @@ set global tokudb_lock_timeout=500; ...@@ -736,7 +848,7 @@ set global tokudb_lock_timeout=500;
# testing conflict "select for update" vs. "select for update" # testing conflict "select for update" vs. "select for update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
select * from t where a=1 for update; select * from t where a=1 for update;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -745,16 +857,20 @@ select * from t where a=2 for update; ...@@ -745,16 +857,20 @@ select * from t where a=2 for update;
select * from t where a=3 for update; select * from t where a=3 for update;
select * from t where a=4 for update; select * from t where a=4 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a=1 for update; select * from t where a=1 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -771,7 +887,7 @@ reap; ...@@ -771,7 +887,7 @@ reap;
# testing conflict "select for update" vs. "update" # testing conflict "select for update" vs. "update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
select * from t where a=1 for update; select * from t where a=1 for update;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -780,16 +896,20 @@ update t set b=b where a=2; ...@@ -780,16 +896,20 @@ update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -806,7 +926,7 @@ reap; ...@@ -806,7 +926,7 @@ reap;
# testing conflict "select for update" vs. "insert" # testing conflict "select for update" vs. "insert"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
select * from t where a=1 for update; select * from t where a=1 for update;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -815,16 +935,20 @@ insert ignore t values(2, 100); ...@@ -815,16 +935,20 @@ insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -841,7 +965,7 @@ reap; ...@@ -841,7 +965,7 @@ reap;
# testing conflict "select for update" vs. "replace" # testing conflict "select for update" vs. "replace"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
select * from t where a=1 for update; select * from t where a=1 for update;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -850,16 +974,20 @@ replace t values(2, 100); ...@@ -850,16 +974,20 @@ replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -885,17 +1013,21 @@ select * from t where a<=2 for update; ...@@ -885,17 +1013,21 @@ select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
select * from t where a>2 for update; select * from t where a>2 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -921,17 +1053,21 @@ update t set b=b where a<=2; ...@@ -921,17 +1053,21 @@ update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
update t set b=b where a>2; update t set b=b where a>2;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -948,7 +1084,7 @@ reap; ...@@ -948,7 +1084,7 @@ reap;
# testing conflict "update" vs. "select for update" # testing conflict "update" vs. "select for update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
update t set b=b where a=1; update t set b=b where a=1;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -957,16 +1093,20 @@ select * from t where a=2 for update; ...@@ -957,16 +1093,20 @@ select * from t where a=2 for update;
select * from t where a=3 for update; select * from t where a=3 for update;
select * from t where a=4 for update; select * from t where a=4 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a=1 for update; select * from t where a=1 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -983,7 +1123,7 @@ reap; ...@@ -983,7 +1123,7 @@ reap;
# testing conflict "update" vs. "update" # testing conflict "update" vs. "update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
update t set b=b where a=1; update t set b=b where a=1;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -992,16 +1132,20 @@ update t set b=b where a=2; ...@@ -992,16 +1132,20 @@ update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1018,7 +1162,7 @@ reap; ...@@ -1018,7 +1162,7 @@ reap;
# testing conflict "update" vs. "insert" # testing conflict "update" vs. "insert"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
update t set b=b where a=1; update t set b=b where a=1;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1027,16 +1171,20 @@ insert ignore t values(2, 100); ...@@ -1027,16 +1171,20 @@ insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1053,7 +1201,7 @@ reap; ...@@ -1053,7 +1201,7 @@ reap;
# testing conflict "update" vs. "replace" # testing conflict "update" vs. "replace"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
update t set b=b where a=1; update t set b=b where a=1;
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1062,16 +1210,20 @@ replace t values(2, 100); ...@@ -1062,16 +1210,20 @@ replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1097,17 +1249,21 @@ select * from t where a<=2 for update; ...@@ -1097,17 +1249,21 @@ select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
select * from t where a>2 for update; select * from t where a>2 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1133,17 +1289,21 @@ update t set b=b where a<=2; ...@@ -1133,17 +1289,21 @@ update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
update t set b=b where a>2; update t set b=b where a>2;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1160,7 +1320,7 @@ reap; ...@@ -1160,7 +1320,7 @@ reap;
# testing conflict "insert" vs. "select for update" # testing conflict "insert" vs. "select for update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
insert ignore t values(1, 100); insert ignore t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1169,16 +1329,20 @@ select * from t where a=2 for update; ...@@ -1169,16 +1329,20 @@ select * from t where a=2 for update;
select * from t where a=3 for update; select * from t where a=3 for update;
select * from t where a=4 for update; select * from t where a=4 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a=1 for update; select * from t where a=1 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1195,7 +1359,7 @@ reap; ...@@ -1195,7 +1359,7 @@ reap;
# testing conflict "insert" vs. "update" # testing conflict "insert" vs. "update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
insert ignore t values(1, 100); insert ignore t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1204,16 +1368,20 @@ update t set b=b where a=2; ...@@ -1204,16 +1368,20 @@ update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1230,7 +1398,7 @@ reap; ...@@ -1230,7 +1398,7 @@ reap;
# testing conflict "insert" vs. "insert" # testing conflict "insert" vs. "insert"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
insert ignore t values(1, 100); insert ignore t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1239,16 +1407,20 @@ insert ignore t values(2, 100); ...@@ -1239,16 +1407,20 @@ insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1265,7 +1437,7 @@ reap; ...@@ -1265,7 +1437,7 @@ reap;
# testing conflict "insert" vs. "replace" # testing conflict "insert" vs. "replace"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
insert ignore t values(1, 100); insert ignore t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1274,16 +1446,20 @@ replace t values(2, 100); ...@@ -1274,16 +1446,20 @@ replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1309,17 +1485,21 @@ select * from t where a<=2 for update; ...@@ -1309,17 +1485,21 @@ select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
select * from t where a>2 for update; select * from t where a>2 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1345,17 +1525,21 @@ update t set b=b where a<=2; ...@@ -1345,17 +1525,21 @@ update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
update t set b=b where a>2; update t set b=b where a>2;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1372,7 +1556,7 @@ reap; ...@@ -1372,7 +1556,7 @@ reap;
# testing conflict "replace" vs. "select for update" # testing conflict "replace" vs. "select for update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
replace t values(1, 100); replace t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1381,16 +1565,20 @@ select * from t where a=2 for update; ...@@ -1381,16 +1565,20 @@ select * from t where a=2 for update;
select * from t where a=3 for update; select * from t where a=3 for update;
select * from t where a=4 for update; select * from t where a=4 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a=1 for update; select * from t where a=1 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1407,7 +1595,7 @@ reap; ...@@ -1407,7 +1595,7 @@ reap;
# testing conflict "replace" vs. "update" # testing conflict "replace" vs. "update"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
replace t values(1, 100); replace t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1416,16 +1604,20 @@ update t set b=b where a=2; ...@@ -1416,16 +1604,20 @@ update t set b=b where a=2;
update t set b=b where a=3; update t set b=b where a=3;
update t set b=b where a=4; update t set b=b where a=4;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a=1; update t set b=b where a=1;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1442,7 +1634,7 @@ reap; ...@@ -1442,7 +1634,7 @@ reap;
# testing conflict "replace" vs. "insert" # testing conflict "replace" vs. "insert"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
replace t values(1, 100); replace t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1451,16 +1643,20 @@ insert ignore t values(2, 100); ...@@ -1451,16 +1643,20 @@ insert ignore t values(2, 100);
insert ignore t values(3, 100); insert ignore t values(3, 100);
insert ignore t values(4, 100); insert ignore t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
insert ignore t values(1, 100); insert ignore t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1477,7 +1673,7 @@ reap; ...@@ -1477,7 +1673,7 @@ reap;
# testing conflict "replace" vs. "replace" # testing conflict "replace" vs. "replace"
connection conn1; connection conn1;
begin; begin;
# about to do qa..
replace t values(1, 100); replace t values(1, 100);
connection conn2; connection conn2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1486,16 +1682,20 @@ replace t values(2, 100); ...@@ -1486,16 +1682,20 @@ replace t values(2, 100);
replace t values(3, 100); replace t values(3, 100);
replace t values(4, 100); replace t values(4, 100);
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
replace t values(1, 100); replace t values(1, 100);
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1521,17 +1721,21 @@ select * from t where a<=2 for update; ...@@ -1521,17 +1721,21 @@ select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
select * from t where a>2 for update; select * from t where a>2 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=0 for update; select * from t where a>=0 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1557,17 +1761,21 @@ update t set b=b where a<=2; ...@@ -1557,17 +1761,21 @@ update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
update t set b=b where a>2; update t set b=b where a>2;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1; select * from t where a=1;
select * from t where a>=2; select * from t where a>=2;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=0; update t set b=b where a>=0;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1595,6 +1803,7 @@ select * from t where a>=3 and a<=6 for update; ...@@ -1595,6 +1803,7 @@ select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=5 for update; select * from t where a>=5 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1602,13 +1811,16 @@ select * from t where a=2; ...@@ -1602,13 +1811,16 @@ select * from t where a=2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=5; select * from t where a>=3 and a<=5;
select * from t where a>=5; select * from t where a>=5;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a>=0 and a<=3 for update; select * from t where a>=0 and a<=3 for update;
select * from t where a>=3 and a<=6 for update; select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update; select * from t where a<=2 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1636,6 +1848,7 @@ update t set b=b where a>=3 and a<=6; ...@@ -1636,6 +1848,7 @@ update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=5; update t set b=b where a>=5;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1643,13 +1856,16 @@ select * from t where a=2; ...@@ -1643,13 +1856,16 @@ select * from t where a=2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=5; select * from t where a>=3 and a<=5;
select * from t where a>=5; select * from t where a>=5;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a>=0 and a<=3; update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6; update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1677,6 +1893,7 @@ select * from t where a>=3 and a<=6 for update; ...@@ -1677,6 +1893,7 @@ select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update; select * from t where a<=2 for update;
select * from t where a>=5 for update; select * from t where a>=5 for update;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1684,13 +1901,16 @@ select * from t where a=2; ...@@ -1684,13 +1901,16 @@ select * from t where a=2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=5; select * from t where a>=3 and a<=5;
select * from t where a>=5; select * from t where a>=5;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
select * from t where a>=0 and a<=3 for update; select * from t where a>=0 and a<=3 for update;
select * from t where a>=3 and a<=6 for update; select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update; select * from t where a<=2 for update;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
...@@ -1718,6 +1938,7 @@ update t set b=b where a>=3 and a<=6; ...@@ -1718,6 +1938,7 @@ update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
update t set b=b where a>=5; update t set b=b where a>=5;
# make sure we can't read that row, but can read others. # make sure we can't read that row, but can read others.
begin;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t; select * from t;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
...@@ -1725,13 +1946,16 @@ select * from t where a=2; ...@@ -1725,13 +1946,16 @@ select * from t where a=2;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=5; select * from t where a>=3 and a<=5;
select * from t where a>=5; select * from t where a>=5;
commit;
connection conn1; connection conn1;
commit; commit;
connection conn2; connection conn2;
update t set b=b where a>=0 and a<=3; update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6; update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2; update t set b=b where a<=2;
begin;
select * from t; select * from t;
commit;
connection conn1; connection conn1;
# check that an early commit allows a blocked # check that an early commit allows a blocked
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment