Commit c39eb30a authored by unknown's avatar unknown

Fix a race condition in the PBXT test for MAX_JOIN_SIZE in select_safe.test

The statistics after a sequence of inserts/deletes are updated asynchronously
in PBXT, causing unpredictable test results. Fix by running the test on a
fresh copy of the table with no deletes performed, to get stable results.
parent 73d3805d
drop table if exists t1; drop table if exists t1,t2;
SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9; SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9;
create table t1 (a int auto_increment primary key, b char(20)); create table t1 (a int auto_increment primary key, b char(20));
insert into t1 values(1,"test"); insert into t1 values(1,"test");
...@@ -13,10 +13,12 @@ a b ...@@ -13,10 +13,12 @@ a b
1 test 1 test
2 test2 2 test2
update t1 set b="a" where a=1; update t1 set b="a" where a=1;
analyze table t1; create table t2 like t1;
insert into t2 select * from t1;
analyze table t2;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t2 analyze status OK
select 1 from t1,t1 as t2,t1 as t3; select 1 from t2 as t1,t2,t2 as t3;
1 1
1 1
1 1
...@@ -77,7 +79,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -77,7 +79,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21 1 SIMPLE t1 ALL b NULL NULL NULL 21
1 SIMPLE t2 ref b b 21 test.t1.b 1 Using where 1 SIMPLE t2 ref b b 21 test.t1.b 1 Using where
SET MAX_SEEKS_FOR_KEY=DEFAULT; SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1; drop table t1, t2;
create table t1 (a int); create table t1 (a int);
insert into t1 values (1),(2),(3),(4),(5); insert into t1 values (1),(2),(3),(4),(5);
insert into t1 select * from t1; insert into t1 select * from t1;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1,t2;
--enable_warnings --enable_warnings
SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9; SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9;
...@@ -15,8 +15,13 @@ delete from t1 where a=1; ...@@ -15,8 +15,13 @@ delete from t1 where a=1;
insert into t1 values(1,"test"),(2,"test2"); insert into t1 values(1,"test"),(2,"test2");
SELECT SQL_BUFFER_RESULT * from t1 order by a; # PBXT required for consistent result SELECT SQL_BUFFER_RESULT * from t1 order by a; # PBXT required for consistent result
update t1 set b="a" where a=1; update t1 set b="a" where a=1;
analyze table t1; # PBXT: required to get the correct COUNT(*)
select 1 from t1,t1 as t2,t1 as t3; # Test MAX_JOIN_SIZE in a fresh table, as insert/delete combination
# makes PBXT statistics non-deterministic
create table t2 like t1;
insert into t2 select * from t1;
analyze table t2; # PBXT: required to get the correct COUNT(*)
select 1 from t2 as t1,t2,t2 as t3;
# The following should give errors: # The following should give errors:
--error 1175 --error 1175
...@@ -64,7 +69,7 @@ set MAX_SEEKS_FOR_KEY=1; ...@@ -64,7 +69,7 @@ set MAX_SEEKS_FOR_KEY=1;
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
SET MAX_SEEKS_FOR_KEY=DEFAULT; SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1; drop table t1, t2;
# BUG#8726 # BUG#8726
create table t1 (a int); create table t1 (a int);
......
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