File: spj_skew.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (58 lines) | stat: -rw-r--r-- 1,954 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
##################################################################
# Test to verify that there are no skew in load distribution of
# SPJ requests among the available SPJ blocks. (See bug#22627519)
##################################################################

--source include/have_ndb.inc

# Fill in some test data
create table test.parent(a int primary key, b int) engine=ndb;
create table test.child(b int primary key, c int) engine=ndb;

insert into test.parent values
  (1,2),(2,3),(3,4),(4,5),(5,5),(6,7),(7,8),(8,9);
insert into test.child values
  (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);


# Save old mysqld counter values.
create temporary table counters_at_startup
  select * from ndbinfo.counters
  where block_name="DBSPJ";

disable_result_log;
disable_query_log;


###########################################################
# Execute a SPJ-scan query multiple times.
# Expectation is that each SPJ block should report the
# same number of 'TABLE_SCANS_RECEIVED'. Note that this
# may not be true for a single SPJ scan as a SPJ request is
# needed for each fragment to be scanned, and number of fragments
# is generally not dividable by number of SPJ blocks.
# However, over a sufficent number of requests, this should
# be evened out.
############################################################

let $1=150;
while ($1)
{
  select * from parent join child using(b);
  dec $1;
}

enable_result_log;

-- echo
-- echo Report (and fail) if there are too much skew in 'TABLE_SCANS_RECEIVED':
select "Skewed SPJ load", cnt.counter_name, min(cnt.val-old.val), max(cnt.val-old.val) from 
  ndbinfo.counters cnt join counters_at_startup old
    using (node_id,block_name,block_instance,counter_name)
  where block_name="DBSPJ" and counter_name = "TABLE_SCANS_RECEIVED"
  GROUP BY counter_name
  having max(cnt.val-old.val) - min(cnt.val-old.val) > 1;
  
drop table counters_at_startup;
drop table parent,child;
enable_query_log;