Commit e893e518 authored by John Esmet's avatar John Esmet

[t:3453] script now tests that early commits from any pair of competing

transactions allow the blocked contender to proceed without timeout error


git-svn-id: file:///svn/mysql/tests/mysql-test@35031 c7de825b-a66e-492c-adef-691d508d4ae1
parent a5b411f6
...@@ -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, 500000]
# Here's where all the magic happens # Here's where all the magic happens
print "# Tokutek" print "# Tokutek"
...@@ -90,6 +90,22 @@ for timeout in timeouts: ...@@ -90,6 +90,22 @@ for timeout in timeouts:
mysqlgen_select_star() mysqlgen_select_star()
print "connection default;" print "connection default;"
print "" print ""
# test early commit
if timeout > 0:
print "# check that an early commit allows a blocked"
print "# transaction to complete"
print "connection default;"
print "begin;"
qa("a", "1", "b", "150")
print "connection conn2;"
# this makes the query asynchronous, so we can jump back
# to the default connection and commit it.
print "send ",
qb("a", "1", "b", "175")
print "connection default;"
print "commit;"
print "connection conn2;"
print "reap;"
# point vs range contention # point vs range contention
for rt, rq in write_range_queries: for rt, rq in write_range_queries:
print "# testing range query \"%s\" vs \"%s\"" % (rt, ta) print "# testing range query \"%s\" vs \"%s\"" % (rt, ta)
...@@ -113,6 +129,22 @@ for timeout in timeouts: ...@@ -113,6 +129,22 @@ for timeout in timeouts:
mysqlgen_select_star() mysqlgen_select_star()
print "connection default;" print "connection default;"
print "" print ""
# test early commit
if timeout > 0:
print "# check that an early commit allows a blocked"
print "# transaction to complete"
print "connection default;"
print "begin;"
qa("a", "1", "b", "150")
print "connection conn2;"
# this makes the query asynchronous, so we can jump back
# to the default connection and commit it.
print "send ",
rq("a", "b", "<=2")
print "connection default;"
print "commit;"
print "connection conn2;"
print "reap;"
for rt, rq in write_range_queries: for rt, rq in write_range_queries:
for rtb, rqb in write_range_queries: for rtb, rqb in write_range_queries:
print "# testing range query \"%s\" vs range query \"%s\"" % (rt, rtb) print "# testing range query \"%s\" vs range query \"%s\"" % (rt, rtb)
...@@ -139,4 +171,20 @@ for timeout in timeouts: ...@@ -139,4 +171,20 @@ for timeout in timeouts:
mysqlgen_select_star() mysqlgen_select_star()
print "connection default;" print "connection default;"
print "" print ""
# test early commit
if timeout > 0:
print "# check that an early commit allows a blocked"
print "# transaction to complete"
print "connection default;"
print "begin;"
rq("a", "b", ">=2 and a<=4")
print "connection conn2;"
# this makes the query asynchronous, so we can jump back
# to the default connection and commit it.
print "send ",
rqb("a", "b", ">=0 and a<=3")
print "connection default;"
print "commit;"
print "connection conn2;"
print "reap;"
mysqlgen_cleanup() mysqlgen_cleanup()
# Tokutek # Tokutek
# Blocking row lock tests; # Blocking row lock tests;
# Generated by blocking-row-locks-testgen.py on 2011-09-24; # Generated by blocking-row-locks-testgen.py on 2011-09-25;
# prepare with some common parameters # prepare with some common parameters
set storage_engine=tokudb; set storage_engine=tokudb;
...@@ -573,6 +573,17 @@ select * from t where a=1 for update; ...@@ -573,6 +573,17 @@ select * from t where a=1 for update;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
send select * from t where a=1 for update;
connection default;
commit;
connection conn2;
reap;
# testing conflict "select for update" vs. "update" # testing conflict "select for update" vs. "update"
connection default; connection default;
begin; begin;
...@@ -591,6 +602,17 @@ update t set b=b where a=1; ...@@ -591,6 +602,17 @@ update t set b=b where a=1;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
send update t set b=b where a=1;
connection default;
commit;
connection conn2;
reap;
# testing conflict "select for update" vs. "insert" # testing conflict "select for update" vs. "insert"
connection default; connection default;
begin; begin;
...@@ -609,6 +631,17 @@ insert ignore t values(1, 100); ...@@ -609,6 +631,17 @@ insert ignore t values(1, 100);
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
send insert ignore t values(1, 175);
connection default;
commit;
connection conn2;
reap;
# testing conflict "select for update" vs. "replace" # testing conflict "select for update" vs. "replace"
connection default; connection default;
begin; begin;
...@@ -627,6 +660,17 @@ replace t values(1, 100); ...@@ -627,6 +660,17 @@ replace t values(1, 100);
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
send replace t values(1, 175);
connection default;
commit;
connection conn2;
reap;
# testing range query "select for update" vs "select for update" # testing range query "select for update" vs "select for update"
connection default; connection default;
begin; begin;
...@@ -646,6 +690,17 @@ select * from t where a>=0 for update; ...@@ -646,6 +690,17 @@ select * from t where a>=0 for update;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
send select * from t where a<=2 for update;
connection default;
commit;
connection conn2;
reap;
# testing range query "update" vs "select for update" # testing range query "update" vs "select for update"
connection default; connection default;
begin; begin;
...@@ -665,6 +720,17 @@ update t set b=b where a>=0; ...@@ -665,6 +720,17 @@ update t set b=b where a>=0;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
send update t set b=b where a<=2;
connection default;
commit;
connection conn2;
reap;
# testing conflict "update" vs. "select for update" # testing conflict "update" vs. "select for update"
connection default; connection default;
begin; begin;
...@@ -683,6 +749,17 @@ select * from t where a=1 for update; ...@@ -683,6 +749,17 @@ select * from t where a=1 for update;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
update t set b=b where a=1;
connection conn2;
send select * from t where a=1 for update;
connection default;
commit;
connection conn2;
reap;
# testing conflict "update" vs. "update" # testing conflict "update" vs. "update"
connection default; connection default;
begin; begin;
...@@ -701,6 +778,17 @@ update t set b=b where a=1; ...@@ -701,6 +778,17 @@ update t set b=b where a=1;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
update t set b=b where a=1;
connection conn2;
send update t set b=b where a=1;
connection default;
commit;
connection conn2;
reap;
# testing conflict "update" vs. "insert" # testing conflict "update" vs. "insert"
connection default; connection default;
begin; begin;
...@@ -719,6 +807,17 @@ insert ignore t values(1, 100); ...@@ -719,6 +807,17 @@ insert ignore t values(1, 100);
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
update t set b=b where a=1;
connection conn2;
send insert ignore t values(1, 175);
connection default;
commit;
connection conn2;
reap;
# testing conflict "update" vs. "replace" # testing conflict "update" vs. "replace"
connection default; connection default;
begin; begin;
...@@ -737,6 +836,17 @@ replace t values(1, 100); ...@@ -737,6 +836,17 @@ replace t values(1, 100);
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
update t set b=b where a=1;
connection conn2;
send replace t values(1, 175);
connection default;
commit;
connection conn2;
reap;
# testing range query "select for update" vs "update" # testing range query "select for update" vs "update"
connection default; connection default;
begin; begin;
...@@ -756,6 +866,17 @@ select * from t where a>=0 for update; ...@@ -756,6 +866,17 @@ select * from t where a>=0 for update;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
update t set b=b where a=1;
connection conn2;
send select * from t where a<=2 for update;
connection default;
commit;
connection conn2;
reap;
# testing range query "update" vs "update" # testing range query "update" vs "update"
connection default; connection default;
begin; begin;
...@@ -775,6 +896,17 @@ update t set b=b where a>=0; ...@@ -775,6 +896,17 @@ update t set b=b where a>=0;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
update t set b=b where a=1;
connection conn2;
send update t set b=b where a<=2;
connection default;
commit;
connection conn2;
reap;
# testing conflict "insert" vs. "select for update" # testing conflict "insert" vs. "select for update"
connection default; connection default;
begin; begin;
...@@ -793,6 +925,17 @@ select * from t where a=1 for update; ...@@ -793,6 +925,17 @@ select * from t where a=1 for update;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
insert ignore t values(1, 150);
connection conn2;
send select * from t where a=1 for update;
connection default;
commit;
connection conn2;
reap;
# testing conflict "insert" vs. "update" # testing conflict "insert" vs. "update"
connection default; connection default;
begin; begin;
...@@ -811,6 +954,17 @@ update t set b=b where a=1; ...@@ -811,6 +954,17 @@ update t set b=b where a=1;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
insert ignore t values(1, 150);
connection conn2;
send update t set b=b where a=1;
connection default;
commit;
connection conn2;
reap;
# testing conflict "insert" vs. "insert" # testing conflict "insert" vs. "insert"
connection default; connection default;
begin; begin;
...@@ -829,6 +983,17 @@ insert ignore t values(1, 100); ...@@ -829,6 +983,17 @@ insert ignore t values(1, 100);
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
insert ignore t values(1, 150);
connection conn2;
send insert ignore t values(1, 175);
connection default;
commit;
connection conn2;
reap;
# testing conflict "insert" vs. "replace" # testing conflict "insert" vs. "replace"
connection default; connection default;
begin; begin;
...@@ -847,6 +1012,17 @@ replace t values(1, 100); ...@@ -847,6 +1012,17 @@ replace t values(1, 100);
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
insert ignore t values(1, 150);
connection conn2;
send replace t values(1, 175);
connection default;
commit;
connection conn2;
reap;
# testing range query "select for update" vs "insert" # testing range query "select for update" vs "insert"
connection default; connection default;
begin; begin;
...@@ -866,6 +1042,17 @@ select * from t where a>=0 for update; ...@@ -866,6 +1042,17 @@ select * from t where a>=0 for update;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
insert ignore t values(1, 150);
connection conn2;
send select * from t where a<=2 for update;
connection default;
commit;
connection conn2;
reap;
# testing range query "update" vs "insert" # testing range query "update" vs "insert"
connection default; connection default;
begin; begin;
...@@ -885,6 +1072,17 @@ update t set b=b where a>=0; ...@@ -885,6 +1072,17 @@ update t set b=b where a>=0;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
insert ignore t values(1, 150);
connection conn2;
send update t set b=b where a<=2;
connection default;
commit;
connection conn2;
reap;
# testing conflict "replace" vs. "select for update" # testing conflict "replace" vs. "select for update"
connection default; connection default;
begin; begin;
...@@ -903,6 +1101,17 @@ select * from t where a=1 for update; ...@@ -903,6 +1101,17 @@ select * from t where a=1 for update;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
replace t values(1, 150);
connection conn2;
send select * from t where a=1 for update;
connection default;
commit;
connection conn2;
reap;
# testing conflict "replace" vs. "update" # testing conflict "replace" vs. "update"
connection default; connection default;
begin; begin;
...@@ -921,6 +1130,17 @@ update t set b=b where a=1; ...@@ -921,6 +1130,17 @@ update t set b=b where a=1;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
replace t values(1, 150);
connection conn2;
send update t set b=b where a=1;
connection default;
commit;
connection conn2;
reap;
# testing conflict "replace" vs. "insert" # testing conflict "replace" vs. "insert"
connection default; connection default;
begin; begin;
...@@ -939,6 +1159,17 @@ insert ignore t values(1, 100); ...@@ -939,6 +1159,17 @@ insert ignore t values(1, 100);
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
replace t values(1, 150);
connection conn2;
send insert ignore t values(1, 175);
connection default;
commit;
connection conn2;
reap;
# testing conflict "replace" vs. "replace" # testing conflict "replace" vs. "replace"
connection default; connection default;
begin; begin;
...@@ -957,6 +1188,17 @@ replace t values(1, 100); ...@@ -957,6 +1188,17 @@ replace t values(1, 100);
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
replace t values(1, 150);
connection conn2;
send replace t values(1, 175);
connection default;
commit;
connection conn2;
reap;
# testing range query "select for update" vs "replace" # testing range query "select for update" vs "replace"
connection default; connection default;
begin; begin;
...@@ -976,6 +1218,17 @@ select * from t where a>=0 for update; ...@@ -976,6 +1218,17 @@ select * from t where a>=0 for update;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
replace t values(1, 150);
connection conn2;
send select * from t where a<=2 for update;
connection default;
commit;
connection conn2;
reap;
# testing range query "update" vs "replace" # testing range query "update" vs "replace"
connection default; connection default;
begin; begin;
...@@ -995,6 +1248,17 @@ update t set b=b where a>=0; ...@@ -995,6 +1248,17 @@ update t set b=b where a>=0;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
replace t values(1, 150);
connection conn2;
send update t set b=b where a<=2;
connection default;
commit;
connection conn2;
reap;
# testing range query "select for update" vs range query "select for update" # testing range query "select for update" vs range query "select for update"
connection default; connection default;
begin; begin;
...@@ -1017,6 +1281,17 @@ select * from t where a<=2 for update; ...@@ -1017,6 +1281,17 @@ select * from t where a<=2 for update;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
select * from t where a>=2 and a<=4 for update;
connection conn2;
send select * from t where a>=0 and a<=3 for update;
connection default;
commit;
connection conn2;
reap;
# testing range query "select for update" vs range query "update" # testing range query "select for update" vs range query "update"
connection default; connection default;
begin; begin;
...@@ -1039,6 +1314,17 @@ update t set b=b where a<=2; ...@@ -1039,6 +1314,17 @@ update t set b=b where a<=2;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
select * from t where a>=2 and a<=4 for update;
connection conn2;
send update t set b=b where a>=0 and a<=3;
connection default;
commit;
connection conn2;
reap;
# testing range query "update" vs range query "select for update" # testing range query "update" vs range query "select for update"
connection default; connection default;
begin; begin;
...@@ -1061,6 +1347,17 @@ select * from t where a<=2 for update; ...@@ -1061,6 +1347,17 @@ select * from t where a<=2 for update;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
update t set b=b where a>=2 and a<=4;
connection conn2;
send select * from t where a>=0 and a<=3 for update;
connection default;
commit;
connection conn2;
reap;
# testing range query "update" vs range query "update" # testing range query "update" vs range query "update"
connection default; connection default;
begin; begin;
...@@ -1083,6 +1380,17 @@ update t set b=b where a<=2; ...@@ -1083,6 +1380,17 @@ update t set b=b where a<=2;
select * from t; select * from t;
connection default; connection default;
# check that an early commit allows a blocked
# transaction to complete
connection default;
begin;
update t set b=b where a>=2 and a<=4;
connection conn2;
send update t set b=b where a>=0 and a<=3;
connection default;
commit;
connection conn2;
reap;
# clean it all up # clean it all up
drop table t; drop table t;
set global tokudb_lock_timeout=30000000; set global tokudb_lock_timeout=30000000;
......
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