| 1 |
################################################################## |
| 2 |
# Test to verify that there are no skew in load distribution of |
| 3 |
# SPJ requests among the available SPJ blocks. (See bug#22627519) |
| 4 |
################################################################## |
| 5 |
|
| 6 |
--source include/have_ndb.inc |
| 7 |
|
| 8 |
# Fill in some test data |
| 9 |
create table test.parent(a int primary key, b int) engine=ndb; |
| 10 |
create table test.child(b int primary key, c int) engine=ndb; |
| 11 |
|
| 12 |
insert into test.parent values |
| 13 |
(1,2),(2,3),(3,4),(4,5),(5,5),(6,7),(7,8),(8,9); |
| 14 |
insert into test.child values |
| 15 |
(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); |
| 16 |
|
| 17 |
|
| 18 |
# Save old mysqld counter values. |
| 19 |
create temporary table counters_at_startup |
| 20 |
select * from ndbinfo.counters |
| 21 |
where block_name="DBSPJ"; |
| 22 |
|
| 23 |
disable_result_log; |
| 24 |
disable_query_log; |
| 25 |
|
| 26 |
|
| 27 |
########################################################### |
| 28 |
# Execute a SPJ-scan query multiple times. |
| 29 |
# Expectation is that each SPJ block should report the |
| 30 |
# same number of 'TABLE_SCANS_RECEIVED'. Note that this |
| 31 |
# may not be true for a single SPJ scan as a SPJ request is |
| 32 |
# needed for each fragment to be scanned, and number of fragments |
| 33 |
# is generally not dividable by number of SPJ blocks. |
| 34 |
# However, over a sufficent number of requests, this should |
| 35 |
# be evened out. |
| 36 |
############################################################ |
| 37 |
|
| 38 |
let $1=150; |
| 39 |
while ($1) |
| 40 |
{ |
| 41 |
select * from parent join child using(b); |
| 42 |
dec $1; |
| 43 |
} |
| 44 |
|
| 45 |
enable_result_log; |
| 46 |
|
| 47 |
-- echo |
| 48 |
-- echo Report (and fail) if there are too much skew in 'TABLE_SCANS_RECEIVED': |
| 49 |
select "Skewed SPJ load", cnt.counter_name, min(cnt.val-old.val), max(cnt.val-old.val) from |
| 50 |
ndbinfo.counters cnt join counters_at_startup old |
| 51 |
using (node_id,block_name,block_instance,counter_name) |
| 52 |
where block_name="DBSPJ" and counter_name = "TABLE_SCANS_RECEIVED" |
| 53 |
GROUP BY counter_name |
| 54 |
having max(cnt.val-old.val) - min(cnt.val-old.val) > 1; |
| 55 |
|
| 56 |
drop table counters_at_startup; |
| 57 |
drop table parent,child; |
| 58 |
enable_query_log; |