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.
This commit is contained in:
unknown 2010-05-15 09:14:47 +02:00
parent 73d3805d00
commit c39eb30ac8
2 changed files with 16 additions and 9 deletions

View file

@ -1,4 +1,4 @@
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;
create table t1 (a int auto_increment primary key, b char(20));
insert into t1 values(1,"test");
@ -13,10 +13,12 @@ a b
1 test
2 test2
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
test.t1 analyze status OK
select 1 from t1,t1 as t2,t1 as t3;
test.t2 analyze status OK
select 1 from t2 as t1,t2,t2 as t3;
1
1
1
@ -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 t2 ref b b 21 test.t1.b 1 Using where
SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
drop table t1, t2;
create table t1 (a int);
insert into t1 values (1),(2),(3),(4),(5);
insert into t1 select * from t1;

View file

@ -3,7 +3,7 @@
#
--disable_warnings
drop table if exists t1;
drop table if exists t1,t2;
--enable_warnings
SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9;
@ -15,8 +15,13 @@ delete from t1 where a=1;
insert into t1 values(1,"test"),(2,"test2");
SELECT SQL_BUFFER_RESULT * from t1 order by a; # PBXT required for consistent result
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:
--error 1175
@ -64,7 +69,7 @@ set MAX_SEEKS_FOR_KEY=1;
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
drop table t1, t2;
# BUG#8726
create table t1 (a int);