Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for parallel queries #236

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mysql-test/collections/disabled-pq-debug-kp.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Tests in this file are disabled for --pq debug test.
auth_sec.server_withssl_client_withssl : BUG#000 origin code failed
11 changes: 11 additions & 0 deletions mysql-test/collections/disabled-pq-kp.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Tests in this file are disabled for --pq test.
innodb.innodb_buffer_pool_resize : BUG#000 origin code failed
innodb.innodb_buffer_pool_resize_with_chunks : BUG#000 origin code failed
main.mysql_load_data_local_dir : BUG#000 origin code failed
main.mtr_unit_tests : BUG#000 origin code failed
main.dd_pfs : BUG#000 origin code failed
main.file_contents : BUG#000 origin code failed
main.read_only_ddl : BUG#000 origin code failed
secondary_engine.cost_threshold : BUG#000 origin code failed
sys_vars.innodb_buffer_pool_size_basic : BUG#000 origin code failed

16 changes: 16 additions & 0 deletions mysql-test/collections/disabled-pq.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Tests in this file are disabled for ASAN runs in pushbuild.
# This is in addition to tests disabled by normal disabled.def files
parallel_query.pq_demon : BUG#194 skip example
innodb.lock_contention : BUG#000 DEBUG_SYNC
perfschema.table_aggregate_hist_2u_2t : BUG#245 PFS
perfschema.table_aggregate_global_4u_3t : BUG#245 PFS
perfschema.misc : BUG#245 PFS
perfschema.table_aggregate_global_2u_2t : BUG#245 PFS
main.events_1 : BUG#255 EVENT DATETIME
main.range_with_memory_limit : BUG#258 ANALYZE_TABLE
main.filesort_debug : BUG#254 DEBUG_SYNC
main.events_bugs : Bug#39863 events_bugs
main.events_1 : BUG#255 EVENT DATETIME
main.kill_debug : BUG#291 issue-291 DEBUG_EXE
main.mysql_client_test : BUG#293 issue-293 PTHREAD_JOIN
perfschema.idx_compare_ees_by_thread_by_error : BUG#294 issue-294 PFS
4 changes: 4 additions & 0 deletions mysql-test/include/not_pq_test.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if ($PQ_TEST)
{
--skip cannot run in '--pq' option
}
4 changes: 4 additions & 0 deletions mysql-test/include/pq_test.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if (!$PQ_TEST)
{
--skip Test needs '--pq' option
}
11 changes: 11 additions & 0 deletions mysql-test/lib/mtr_cases.pm
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,12 @@ sub create_disabled_test_list($$) {
"$::glob_mysql_test_dir/collections/disabled_ndb.def")
if $::ndbcluster_enabled;

if ($::opt_pq) {
# Add 'disabled-pq.def' to the list of disabled files if pq is enabled.
unshift(@disabled_collection,
"$::glob_mysql_test_dir/collections/disabled-pq.def");
}

# Check for the tests to be skipped in a sanitizer which are listed
# in "mysql-test/collections/disabled-<sanitizer>.list" file.
if ($::opt_sanitize) {
Expand Down Expand Up @@ -1174,6 +1180,11 @@ sub collect_one_test_case {
shortname => $tname,);

my $result_file = "$resdir/$tname.result";

if ($::opt_pq and ($::opt_record or -f "$resdir/$tname.result-pq")) {
$result_file = "$resdir/$tname.result-pq";
}

if (-f $result_file) {
$tinfo->{result_file} = $result_file;
} else {
Expand Down
12 changes: 12 additions & 0 deletions mysql-test/mysql-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,15 @@
test_services
x
component_keyring_file
parallel_query
);

our $DEFAULT_SUITES = join ',', @DEFAULT_SUITES;

# End of list of default suites

our $opt_big_test = 0;
our $opt_pq = 0;
our $opt_check_testcases = 1;
our $opt_clean_vardir = $ENV{'MTR_CLEAN_VARDIR'};
our $opt_ctest = env_or_val(MTR_UNIT_TESTS => -1);
Expand Down Expand Up @@ -1560,6 +1562,7 @@ sub command_line_setup {

# Control what test suites or cases to run
'big-test' => \$opt_big_test,
'pq' => \$opt_pq,
'combination=s' => \@opt_combinations,
'do-suite=s' => \$opt_do_suite,
'do-test=s' => \&collect_option,
Expand Down Expand Up @@ -2022,6 +2025,8 @@ sub command_line_setup {

$ENV{'BIG_TEST'} = 1 if ($opt_big_test or $opt_only_big_test);

$ENV{'PQ_TEST'} = 1 if ($opt_pq);

# Gcov flag
if (($opt_gcov or $opt_gprof) and !$source_dist) {
mtr_error("Coverage test needs the source - please use source dist");
Expand Down Expand Up @@ -2119,6 +2124,12 @@ sub command_line_setup {
push(@opt_extra_mysqld_opt, "--optimizer-trace-max-mem-size=1000000");
}

# Check parallel query
if ($opt_pq) {
push(@opt_extra_mysqld_opt, "--force_parallel_execute=1");
push(@opt_extra_mysqld_opt, "--parallel_cost_threshold=0");
}

# Check valgrind arguments
if ($opt_valgrind or $opt_valgrind_path or @valgrind_args) {
mtr_report("Turning on valgrind for all executables");
Expand Down Expand Up @@ -7548,6 +7559,7 @@ ($)
force Continue to run the suite after failure.
include-ndb[cluster] Enable all tests that need cluster.
only-big-test Run only big tests and skip the normal(non-big) tests.
pq run tests using 4 threads parallel query.
print-testcases Don't run the tests but print details about all the
selected tests, in the order they would be run.
skip-ndb[cluster] Skip all tests that need cluster. This setting is
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/suite/parallel_query/include/pq_test.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if (!$PQ_TEST)
{
--skip Test needs '--pq' option
}
116 changes: 116 additions & 0 deletions mysql-test/suite/parallel_query/r/pq_abort.result-pq
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
create table t1(id int, a varchar(10));
insert into t1 values(1, 'aa'), (2, 'bb');
set @saved_force_parallel_execute = @@force_parallel_execute;
set session force_parallel_execute = 1;
explain select * from t1 limit 1;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE <gather2> NULL ALL NULL NULL NULL NULL 2 100.00 Parallel execute (1 workers)
2 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` limit 1
select * from t1 limit 1;
id a
1 aa
show status like "PQ_memory_used";
Variable_name Value
PQ_memory_used 0
set session debug="";
set session debug="+d, dup_thd_abort";
explain select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
show status like "PQ_memory_used";
Variable_name Value
PQ_memory_used 0
set session debug="";
set session debug="+d, dup_join_abort";
explain select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
show status like "PQ_memory_used";
Variable_name Value
PQ_memory_used 0
set session debug="";
set session debug="+d, dup_select_abort1";
explain select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
show status like "PQ_memory_used";
Variable_name Value
PQ_memory_used 0
set session debug="";
set session debug="+d, dup_select_abort2";
explain select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
show status like "PQ_memory_used";
Variable_name Value
PQ_memory_used 0
set session debug="+d, pq_leader_abort1";
explain select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
show status like "PQ_memory_used";
Variable_name Value
PQ_memory_used 0
set session debug="";
set session debug="+d, pq_leader_abort2";
explain select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
select * from t1 limit 1;
ERROR HY000: Failed to parallel execute. this SQL is not supported.
show status like "PQ_memory_used";
Variable_name Value
PQ_memory_used 0
set session debug="";
explain select * from t1 limit 1;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE <gather2> NULL ALL NULL NULL NULL NULL 2 100.00 Parallel execute (1 workers)
2 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` limit 1
select * from t1 limit 1;
id a
1 aa
show status like "PQ_memory_used";
Variable_name Value
PQ_memory_used 0
drop table t1;
CREATE TABLE t1(f1 INT, f2 INT);
INSERT INTO t1 VALUES
(1,1),(2,2),(3,3);
CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, f3 CHAR(200), KEY(f1, f2));
INSERT INTO t2 VALUES
(1,1, 'qwerty'),(1,2, 'qwerty'),(1,3, 'qwerty'),
(2,1, 'qwerty'),(2,2, 'qwerty'),(2,3, 'qwerty'), (2,4, 'qwerty'),(2,5, 'qwerty'),
(3,1, 'qwerty'),(3,4, 'qwerty'),
(4,1, 'qwerty'),(4,2, 'qwerty'),(4,3, 'qwerty'), (4,4, 'qwerty'),
(1,1, 'qwerty'),(1,2, 'qwerty'),(1,3, 'qwerty'),
(2,1, 'qwerty'),(2,2, 'qwerty'),(2,3, 'qwerty'), (2,4, 'qwerty'),(2,5, 'qwerty'),
(3,1, 'qwerty'),(3,4, 'qwerty'),
(4,1, 'qwerty'),(4,2, 'qwerty'),(4,3, 'qwerty'), (4,4, 'qwerty');
CREATE TABLE t3 (f1 INT NOT NULL, f2 INT, f3 VARCHAR(32),
PRIMARY KEY(f1), KEY f2_idx(f1), KEY f3_idx(f3));
INSERT INTO t3 VALUES
(1, 1, 'qwerty'), (2, 1, 'ytrewq'),
(3, 2, 'uiop'), (4, 2, 'poiu'), (5, 2, 'lkjh'),
(6, 2, 'uiop'), (7, 2, 'poiu'), (8, 2, 'lkjh'),
(9, 2, 'uiop'), (10, 2, 'poiu'), (11, 2, 'lkjh'),
(12, 2, 'uiop'), (13, 2, 'poiu'), (14, 2, 'lkjh');
INSERT INTO t3 SELECT f1 + 20, f2, f3 FROM t3;
INSERT INTO t3 SELECT f1 + 40, f2, f3 FROM t3;
SELECT /*+ BKA() */ t2.f1, t2.f2, t2.f3 FROM t1,t2
WHERE t1.f1=t2.f1 AND t2.f2 BETWEEN t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
f1 f2 f3
1 1 qwerty
2 2 qwerty
1 1 qwerty
2 2 qwerty
drop table t1, t2, t3;
set session force_parallel_execute = @saved_force_parallel_execute;
# restart
34 changes: 34 additions & 0 deletions mysql-test/suite/parallel_query/r/pq_aggr_no_record.result-pq
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# check aggregation when innodb return zero line
CREATE TABLE records_in_range_test (
c1 VARCHAR(16),
c2 VARCHAR(512),
PRIMARY KEY (c1)
) ENGINE=INNODB;
INSERT INTO records_in_range_test VALUES
('ccc', REPEAT('v', 512)),
('kkk01', REPEAT('v', 512)),
('kkk02', REPEAT('v', 512)),
('kkk03', REPEAT('v', 512)),
('kkk04', REPEAT('v', 512)),
('kkk05', REPEAT('v', 512)),
('kkk06', REPEAT('v', 512)),
('kkk07', REPEAT('v', 512)),
('kkk08', REPEAT('v', 512)),
('mmm', REPEAT('v', 512)),
('nnn', REPEAT('v', 512)),
('uuu01', REPEAT('v', 512)),
('uuu02', REPEAT('v', 512)),
('uuu03', REPEAT('v', 512)),
('uuu04', REPEAT('v', 512)),
('uuu05', REPEAT('v', 512)),
('uuu06', REPEAT('v', 512)),
('uuu07', REPEAT('v', 512)),
('uuu08', REPEAT('v', 512)),
('xxx', REPEAT('v', 512));
SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'ccc';
COUNT(*)
0
SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'xxx';
COUNT(*)
19
drop table records_in_range_test;
27 changes: 27 additions & 0 deletions mysql-test/suite/parallel_query/r/pq_blob.result-pq
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
create database pq_test;
use pq_test;
DROP TABLE IF EXISTS t1;
CREATE TABLE t2(d varchar(17) PRIMARY KEY) ENGINE=innodb DEFAULT CHARSET=utf8;
Warnings:
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
CREATE TABLE t3(a int PRIMARY KEY) ENGINE=innodb;
INSERT INTO t3 VALUES (22),(44),(33),(55),(66);
INSERT INTO t2 VALUES ('jejdkrun87'),('adfd72nh9k'), ('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik');
CREATE TABLE t1(a int, b blob, c text, d text NOT NULL) ENGINE=innodb DEFAULT CHARSET=utf8 STATS_PERSISTENT=0;
Warnings:
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
INSERT INTO t1 SELECT a,LEFT(REPEAT(d,100*a),65535),REPEAT(d,20*a),d FROM t2,t3 order by a, d;
DROP TABLE t2, t3;
DELETE FROM t1 WHERE d='null';
DELETE FROM t1 WHERE a%2;
CHECK TABLE t1;
Table Op Msg_type Msg_text
pq_test.t1 check status OK
ALTER TABLE t1 ADD PRIMARY KEY (a,b(255),c(255)), ADD KEY (b(767));
set force_parallel_execute=1;
set parallel_cost_threshold=0;
SELECT COUNT(*) FROM t1 WHERE a=44;
COUNT(*)
5
drop table pq_test.t1;
drop database pq_test;
Loading