You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a fix for deviations in statistics counter values that occur when running ndb_join_pushdown.test on
big-endian (Sparc) and with Valgrind.
This fix does two things:
* Some ndb$info counters are removed from the test, because their values depend on endian-dependent key hashing.
This includes READS_NOT_FOUND, LOCAL_READS_SENT, REMOTE_READS_SENT and SCAN_ROWS_RETURNED.
* Ndb_scan_count was sometimes off by one when testing with Valgrind, possibly because table statistics was refreshed
at unpredictable intervals. Instead of testing the exact value of Ndb_scan_count, the test will fail if
Ndb_scan_count deviates from the expected values by more than 10%.
Copy file name to clipboardExpand all lines: mysql-test/suite/ndb/r/ndb_join_pushdown.result
+5-23Lines changed: 5 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,6 @@ select counter_name, sum(val) as val
4
4
from ndbinfo.counters
5
5
where block_name='DBSPJ'
6
6
group by counter_name;
7
-
create temporary table spj_save_counts like spj_counts_at_startup;
8
-
insert into spj_save_counts values ('SCAN_ROWS_RETURNED', 0);
9
7
set @save_ndb_join_pushdown = @@session.ndb_join_pushdown;
10
8
set ndb_join_pushdown = true;
11
9
create table t1 (
@@ -2060,7 +2058,6 @@ count(*)
2060
2058
304
2061
2059
drop table tx;
2062
2060
alter table t1 partition by key(a);
2063
-
update spj_save_counts set val = (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
2064
2061
explain select count(*) from t1
2065
2062
join t1 as t2 on t2.a = t1.c
2066
2063
join t1 as t3 on t3.a = t1.c;
@@ -2092,7 +2089,6 @@ join t1 as x2 on x2.a = x1.c and x1.b < 2
2092
2089
join t1 as x3 on x3.a = x1.c;
2093
2090
count(*)
2094
2091
20000
2095
-
update spj_counts_at_startup set val = val + (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') - (select val from spj_save_counts where counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
2096
2092
drop table t1;
2097
2093
drop table tx;
2098
2094
create table t1 (a int, b int, primary key(a) using hash) engine = ndb;
@@ -4331,7 +4327,6 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4331
4327
Warnings:
4332
4328
Note 9999 Can't push table 'x3' as child of 'x1', outer join of scan-child not implemented
4333
4329
Note 1003 select straight_join `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`u` AS `u`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`u` AS `u`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b`,`test`.`x3`.`pk` AS `pk`,`test`.`x3`.`u` AS `u`,`test`.`x3`.`a` AS `a`,`test`.`x3`.`b` AS `b` from `test`.`t1` `x1` left join (`test`.`t1` `x2` join `test`.`t1` `x3`) on(((`test`.`x2`.`pk` = `test`.`x1`.`a`) and (`test`.`x3`.`b` = `test`.`x2`.`a`))) where 1
4334
-
update spj_save_counts set val = (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
4335
4330
explain extended select straight_join count(*) from t1 as x1
4336
4331
join t1 as x2 on x2.b = x1.a
4337
4332
join t1 as x3 on x3.b = x1.b;
@@ -4381,7 +4376,6 @@ join t1 as x7 on x7.b = x1.a
4381
4376
where x3.a < x2.pk and x4.a < x3.pk;
4382
4377
count(*)
4383
4378
632736
4384
-
update spj_counts_at_startup set val = val + (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') - (select val from spj_save_counts where counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
4385
4379
explain extended select straight_join count(*) from t1 as x1
4386
4380
left join t1 as x2 on x2.b = x1.a
4387
4381
join t1 as x3 on x3.b = x1.b;
@@ -4426,7 +4420,6 @@ join t1 as x2 on x2.b = x1.a
4426
4420
left join t1 as x3 on x3.b = x1.b;
4427
4421
count(*)
4428
4422
2028
4429
-
update spj_save_counts set val = (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
4430
4423
explain extended
4431
4424
select straight_join count(*) from t1 as x1
4432
4425
join t1 as x2 on x2.b = x1.a
@@ -4450,7 +4443,6 @@ join t1 as x2 on x2.b = x1.a
4450
4443
join t1 as x3 on x3.pk = x1.a join t1 as x4 on x4.b = x3.a;
4451
4444
count(*)
4452
4445
2028
4453
-
update spj_counts_at_startup set val = val + (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') - (select val from spj_save_counts where counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
4454
4446
explain extended select straight_join count(*) from t1 as x1
4455
4447
left join t1 as x3 on x3.b = x1.a
4456
4448
join t1 as x2 on x2.pk = x1.a;
@@ -4556,15 +4548,13 @@ id select_type table type possible_keys key key_len ref rows Extra
4556
4548
1 SIMPLE x2 ref PRIMARY PRIMARY 4 test.x0.c 1 Child of 'x0' in pushed join@1
4557
4549
1 SIMPLE x3 ref PRIMARY PRIMARY 4 test.x2.c 1 Child of 'x2' in pushed join@1
4558
4550
1 SIMPLE x4 eq_ref PRIMARY PRIMARY 8 test.x0.d,test.x3.b 1 Child of 'x3' in pushed join@1
4559
-
update spj_save_counts set val = (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
4560
4551
select straight_join count(*) from t1 as x0
4561
4552
join t3 as x1 on x0.c=x1.a
4562
4553
join t1 as x2 on x0.c=x2.a
4563
4554
join t3 as x3 on x2.c=x3.a
4564
4555
join t1 as x4 on x0.d=x4.a and x3.b=x4.b;
4565
4556
count(*)
4566
4557
4800
4567
-
update spj_counts_at_startup set val = val + (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') - (select val from spj_save_counts where counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
Copy file name to clipboardExpand all lines: mysql-test/suite/ndb/t/ndb_join_pushdown.test
+6-47Lines changed: 6 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -37,30 +37,6 @@ let $pushed_queries_dropped_at_startup = query_get_value(show status like 'Ndb_p
37
37
let $pushed_queries_executed_at_startup = query_get_value(show status like 'Ndb_pushed_queries_executed', Value, 1);
38
38
let $pushed_reads_at_startup = query_get_value(show status like 'Ndb_pushed_reads', Value, 1);
39
39
40
-
# Use this table and the two queries below to turn of meassuring
41
-
# SCAN_ROWS_RETURNED for certain bushy scan queries. The reason for this is
42
-
# that growth of this counter is platform dependent for these queries. There
43
-
# are two reasons for this:
44
-
# 1. Distribution hashing (partitioning) of tables is endian dependent. This
45
-
# may cause data to be more skewed on some platforms. This again requires more
46
-
# batches to scan the table and thus more repeats of repeatable scans (i.e.
47
-
# those that will be repeated for each batch of the other branch of a bushy
48
-
# scan). This increases the overall scan row count.
49
-
# 2. If a timer expires in LQH after receiving SCAN_FRAGREQ, LQH may decide to
50
-
# send SCAN_FRAGCONF immediately, even if more tuples could fit in the batch.
51
-
# As above this causes more repeats of repeatable scans.
52
-
53
-
create temporary table spj_save_counts like spj_counts_at_startup;
54
-
55
-
insert into spj_save_counts values ('SCAN_ROWS_RETURNED', 0);
56
-
57
-
# Record current counter value.
58
-
let $save_scan_rows_returned = update spj_save_counts set val = (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
59
-
60
-
# Update spj_counts_at_startup to compensate for counter increments since
61
-
# running save_scan_rows_returned.
62
-
let $compensate_scan_rows_returned = update spj_counts_at_startup set val = val + (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') - (select val from spj_save_counts where counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
63
-
64
40
##############
65
41
# Test start
66
42
@@ -1046,7 +1022,6 @@ connection ddl;
1046
1022
alter table t1 partition by key(a);
1047
1023
1048
1024
connection spj;
1049
-
eval $save_scan_rows_returned;
1050
1025
1051
1026
explain select count(*) from t1
1052
1027
join t1 as t2 on t2.a = t1.c
@@ -1077,8 +1052,6 @@ select count(*) from t1 as x1
1077
1052
join t1 as x2 on x2.a = x1.c and x1.b < 2
1078
1053
join t1 as x3 on x3.a = x1.c;
1079
1054
1080
-
eval $compensate_scan_rows_returned;
1081
-
1082
1055
connection ddl;
1083
1056
drop table t1;
1084
1057
drop table tx;
@@ -2987,7 +2960,6 @@ explain extended select straight_join * from
2987
2960
# These should be allowed to be executed in 'parallel', depending on
2988
2961
# only the root operation
2989
2962
#
2990
-
eval $save_scan_rows_returned;
2991
2963
2992
2964
explain extended select straight_join count(*) from t1 as x1
2993
2965
join t1 as x2 on x2.b = x1.a
@@ -3023,8 +2995,6 @@ select straight_join count(*) from t1 as x1
3023
2995
join t1 as x7 on x7.b = x1.a
3024
2996
where x3.a < x2.pk and x4.a < x3.pk;
3025
2997
3026
-
eval $compensate_scan_rows_returned;
3027
-
3028
2998
#############
3029
2999
# If we have an outer join, we can't create an artificial dep. 'through' the outer join.
3030
3000
# In this case the child scan can't be part of the pushed query.
@@ -3064,8 +3034,6 @@ select straight_join count(*) from t1 as x1
3064
3034
#
3065
3035
# Bushy execution is expected for these scans (x2 & x4) wrt. root (x1)
3066
3036
#
3067
-
eval $save_scan_rows_returned;
3068
-
3069
3037
explain extended
3070
3038
select straight_join count(*) from t1 as x1
3071
3039
join t1 as x2 on x2.b = x1.a
@@ -3080,8 +3048,6 @@ select straight_join count(*) from t1 as x1
3080
3048
join t1 as x2 on x2.b = x1.a
3081
3049
join t1 as x3 on x3.pk = x1.a join t1 as x4 on x4.b = x3.a;
3082
3050
3083
-
eval $compensate_scan_rows_returned;
3084
-
3085
3051
#############
3086
3052
# Test bushy lookups + 1scan,
3087
3053
# (Regression test for previous commit: http://lists.mysql.com/commits/117571)
@@ -3195,16 +3161,12 @@ explain select straight_join count(*) from t1 as x0
0 commit comments