5.3 merge
This commit is contained in:
commit
edab37cd68
@ -1,4 +1,6 @@
|
||||
[MYSQL]
|
||||
post_commit_to = "MYSQL_COMMITS_SECURITY_WW@ORACLE.COM"
|
||||
post_push_to = "MYSQL_COMMITS_SECURITY_WW@ORACLE.COM"
|
||||
tree_name = "mysql-5.5-security"
|
||||
tree_location = lp:maria/5.3
|
||||
post_commit_to = commits@mariadb.org
|
||||
post_commit_url = lp:maria/5.3
|
||||
tree_name = maria/5.3
|
||||
project_name = "Mariadb 5.3, with Aria 2.0"
|
||||
|
3
README
3
README
@ -45,6 +45,9 @@ https://bugs.launchpad.net/maria
|
||||
|
||||
Bugs in the MySQL code can also be submitted at http://bugs.mysql.com
|
||||
|
||||
The code for MariaDB, including all revision history, can be found at:
|
||||
https://code.launchpad.net/maria
|
||||
|
||||
***************************************************************************
|
||||
|
||||
%%The following software may be included in this product:
|
||||
|
@ -45,11 +45,11 @@
|
||||
* seems to actually advertise this properly, despite Unicode 3.1 having
|
||||
* been around since 2001... */
|
||||
|
||||
/* XXXMYSQL : Added FreeBSD to bypass this check.
|
||||
TODO : Verify if FreeBSD stores ISO 10646 in wchar_t. */
|
||||
/* XXXMYSQL : Added FreeBSD & AIX to bypass this check.
|
||||
TODO : Verify if FreeBSD & AIX stores ISO 10646 in wchar_t. */
|
||||
#if !defined(__NetBSD__) && !defined(__sun) \
|
||||
&& !(defined(__APPLE__) && defined(__MACH__)) \
|
||||
&& !defined(__FreeBSD__)
|
||||
&& !defined(__FreeBSD__) && !defined(_AIX)
|
||||
#ifndef __STDC_ISO_10646__
|
||||
/* In many places it is assumed that the first 127 code points are ASCII
|
||||
* compatible, so ensure wchar_t indeed does ISO 10646 and not some other
|
||||
|
@ -200,7 +200,7 @@ el_set(EditLine *el, int op, ...)
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
// XXX: The two strdup's leak
|
||||
/* XXX: The two strdups leak. */
|
||||
ret = map_addfunc(el, Strdup(wargv[0]), Strdup(wargv[1]),
|
||||
func);
|
||||
ct_free_argv(wargv);
|
||||
|
@ -1978,7 +1978,7 @@ rl_callback_read_char()
|
||||
} else
|
||||
wbuf = NULL;
|
||||
(*(void (*)(const char *))rl_linefunc)(wbuf);
|
||||
//el_set(e, EL_UNBUFFERED, 1);
|
||||
/*el_set(e, EL_UNBUFFERED, 1);*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -852,3 +852,25 @@ SET optimizer_switch=@save_optimizer_switch;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo # check "Handler_pushed" status varuiables
|
||||
CREATE TABLE t1 (
|
||||
c1 CHAR(1),
|
||||
c2 CHAR(1),
|
||||
KEY (c1)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES ('3', '3'),('4','4'),('5','5');
|
||||
|
||||
flush status;
|
||||
show status like "Handler_pushed%";
|
||||
|
||||
SELECT * FROM t1 FORCE INDEX(c1) WHERE (c1='3' or c1='4') and c1 % 2 = 0 ;
|
||||
|
||||
show status like "Handler_pushed%";
|
||||
|
||||
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
|
||||
|
||||
show status like "Handler_pushed%";
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -913,6 +913,13 @@ sub collect_one_test_case {
|
||||
$tinfo->{'long_test'}= 1;
|
||||
}
|
||||
|
||||
if ( ! $tinfo->{'big_test'} and $::opt_big_test > 1 )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
$tinfo->{'comment'}= "Small test";
|
||||
return $tinfo
|
||||
}
|
||||
|
||||
if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
|
@ -1148,7 +1148,7 @@ sub command_line_setup {
|
||||
'skip-test=s' => \&collect_option,
|
||||
'do-test=s' => \&collect_option,
|
||||
'start-from=s' => \&collect_option,
|
||||
'big-test' => \$opt_big_test,
|
||||
'big-test+' => \$opt_big_test,
|
||||
'combination=s' => \@opt_combinations,
|
||||
'skip-combinations' => \&collect_option,
|
||||
'experimental=s' => \@opt_experimentals,
|
||||
@ -1943,8 +1943,11 @@ sub collect_mysqld_features {
|
||||
# Put variables into hash
|
||||
if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
|
||||
{
|
||||
# print "$1=\"$2\"\n";
|
||||
$mysqld_variables{$1}= $2;
|
||||
my $name= $1;
|
||||
my $value=$2;
|
||||
$name =~ s/_/-/g;
|
||||
# print "$name=\"$value\"\n";
|
||||
$mysqld_variables{$name}= $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1998,8 +2001,11 @@ sub collect_mysqld_features_from_running_server ()
|
||||
# Put variables into hash
|
||||
if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
|
||||
{
|
||||
# print "$1=\"$2\"\n";
|
||||
$mysqld_variables{$1}= $2;
|
||||
my $name= $1;
|
||||
my $value=$2;
|
||||
$name =~ s/_/-/g;
|
||||
# print "$name=\"$value\"\n";
|
||||
$mysqld_variables{$name}= $value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4777,9 +4783,9 @@ sub extract_warning_lines ($$) {
|
||||
qr/Failed on request_dump/,
|
||||
qr/Slave: Can't drop database.* database doesn't exist/,
|
||||
qr/Slave: Operation DROP USER failed for 'create_rout_db'/,
|
||||
qr|Checking table: '\./mtr/test_suppressions'|,
|
||||
qr|Checking table: '\..mtr.test_suppressions'|,
|
||||
qr|Table \./test/bug53592 has a primary key in InnoDB data dictionary, but not in MySQL|,
|
||||
qr|mysqld: Table '\./mtr/test_suppressions' is marked as crashed and should be repaired|,
|
||||
qr|mysqld: Table '\..mtr.test_suppressions' is marked as crashed and should be repaired|,
|
||||
qr|Can't open shared library.*ha_archive|,
|
||||
qr|InnoDB: Error: table 'test/bug39438'|,
|
||||
qr| entry '.*' ignored in --skip-name-resolve mode|,
|
||||
@ -6356,7 +6362,8 @@ Options to control what test suites or cases to run
|
||||
list of suite names.
|
||||
The default is: "$DEFAULT_SUITES"
|
||||
skip-rpl Skip the replication test cases.
|
||||
big-test Also run tests marked as "big"
|
||||
big-test Also run tests marked as "big". Repeat this option
|
||||
twice to run only "big" tests.
|
||||
staging-run Run a limited number of tests (no slow tests). Used
|
||||
for running staging trees with valgrind.
|
||||
enable-disabled Run also tests marked as disabled
|
||||
|
@ -549,7 +549,7 @@ primary key (pk1, pk2)
|
||||
);
|
||||
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 9 Using index condition; Using where
|
||||
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 9 Using where
|
||||
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||
pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
|
||||
1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
|
||||
|
@ -167,7 +167,7 @@ WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00'
|
||||
ORDER BY ts DESC
|
||||
LIMIT 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using index condition
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where
|
||||
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -431,7 +431,7 @@ SELECT * FROM t1
|
||||
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using index condition
|
||||
2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using where
|
||||
2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using where; Using index; Using join buffer (flat, BNL join)
|
||||
SELECT * FROM t1
|
||||
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
|
||||
@ -452,7 +452,7 @@ PRIMARY KEY (pk)
|
||||
INSERT INTO t1 VALUES (1,9),(2,7),(3,6),(4,3),(5,1);
|
||||
EXPLAIN SELECT pk, c1 FROM t1 WHERE pk <> 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using index condition
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where
|
||||
SET SESSION optimizer_switch='index_condition_pushdown=off';
|
||||
SELECT pk, c1 FROM t1 WHERE pk <> 3;
|
||||
pk c1
|
||||
@ -507,8 +507,8 @@ SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
|
||||
WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
|
||||
(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Using where
|
||||
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join)
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where
|
||||
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
|
||||
WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
|
||||
(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
|
||||
@ -680,7 +680,7 @@ EXPLAIN
|
||||
SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND t1.b != 0
|
||||
HAVING t1.c != 5 ORDER BY t1.c;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Using filesort
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE t2 ref a a 515 test.t1.a 1 Using where
|
||||
SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND t1.b != 0
|
||||
HAVING t1.c != 5 ORDER BY t1.c;
|
||||
@ -793,7 +793,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t ALL PRIMARY,c NULL NULL NULL 64 Using where
|
||||
1 PRIMARY t2 ref g g 5 test.t.c 9 Using where
|
||||
2 DEPENDENT SUBQUERY t1 index PRIMARY d 3 NULL 64 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index condition; Using where
|
||||
2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where
|
||||
SELECT COUNT(*) FROM t1 AS t, t2
|
||||
WHERE c = g
|
||||
AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b)
|
||||
@ -808,5 +808,32 @@ COUNT(*)
|
||||
1478
|
||||
SET optimizer_switch=@save_optimizer_switch;
|
||||
DROP TABLE t1,t2;
|
||||
# check "Handler_pushed" status varuiables
|
||||
CREATE TABLE t1 (
|
||||
c1 CHAR(1),
|
||||
c2 CHAR(1),
|
||||
KEY (c1)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('3', '3'),('4','4'),('5','5');
|
||||
flush status;
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 0
|
||||
Handler_pushed_index_cond_filtered 0
|
||||
SELECT * FROM t1 FORCE INDEX(c1) WHERE (c1='3' or c1='4') and c1 % 2 = 0 ;
|
||||
c1 c2
|
||||
4 4
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 2
|
||||
Handler_pushed_index_cond_filtered 1
|
||||
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
|
||||
c1 c2
|
||||
4 4
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 2
|
||||
Handler_pushed_index_cond_filtered 1
|
||||
DROP TABLE t1;
|
||||
set optimizer_switch=@innodb_icp_tmp;
|
||||
set storage_engine= @save_storage_engine;
|
||||
|
@ -82,7 +82,7 @@ insert into t2 values ('a-1010=A', 1010), ('a-1030=A', 1030), ('a-1020=A', 1020)
|
||||
explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 30 test.t2.a,test.t2.b 1 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered scan
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 30 test.t2.a,test.t2.b 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
a b filler a b
|
||||
a-1010=A 1010 filler a-1010=A 1010
|
||||
@ -91,7 +91,7 @@ a-1030=A 1030 filler a-1030=A 1030
|
||||
explain select * from t1, t2 where t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 26 test.t2.a 1 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered scan
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 26 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select * from t1, t2 where t1.a=t2.a;
|
||||
a b filler a b
|
||||
a-1010=A 1010 filler a-1010=A 1010
|
||||
@ -133,7 +133,7 @@ set join_cache_level=6;
|
||||
explain select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 4 test.t2.a 1 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered scan
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
a b c filler a b
|
||||
set optimizer_switch='index_condition_pushdown=off';
|
||||
|
@ -3506,6 +3506,7 @@ insert into t2 values (2,1, 'qwerty'),(2,2, 'qwerty'),(2,3, 'qwerty'),
|
||||
insert into t2 values (3,1, 'qwerty'),(3,4, 'qwerty');
|
||||
insert into t2 values (4,1, 'qwerty'),(4,2, 'qwerty'),(4,3, 'qwerty'),
|
||||
(4,4, 'qwerty');
|
||||
flush status;
|
||||
set join_cache_level=5;
|
||||
select 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;
|
||||
@ -3519,6 +3520,10 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 20
|
||||
Handler_pushed_index_cond_filtered 16
|
||||
set join_cache_level=6;
|
||||
select 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;
|
||||
@ -3532,6 +3537,10 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 40
|
||||
Handler_pushed_index_cond_filtered 32
|
||||
set join_cache_level=7;
|
||||
select 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;
|
||||
@ -3545,6 +3554,10 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 60
|
||||
Handler_pushed_index_cond_filtered 48
|
||||
set join_cache_level=8;
|
||||
select 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;
|
||||
@ -3558,6 +3571,10 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 80
|
||||
Handler_pushed_index_cond_filtered 64
|
||||
drop table t1,t2;
|
||||
set join_cache_level=default;
|
||||
#
|
||||
|
@ -385,6 +385,22 @@ Variable_name Value
|
||||
key_cache_block_size 1536
|
||||
SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#12361113: crash when load index into cache
|
||||
#
|
||||
# Note that this creates an empty disabled key cache!
|
||||
SET GLOBAL key_cache_none.key_cache_block_size = 1024;
|
||||
CREATE TABLE t1 (a INT, b INTEGER NOT NULL, KEY (b) ) ENGINE = MYISAM;
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
CACHE INDEX t1 in key_cache_none;
|
||||
ERROR HY000: Unknown key cache 'key_cache_none'
|
||||
# The bug crashed the server at LOAD INDEX below. Now it will succeed
|
||||
# since the default cache is used due to CACHE INDEX failed for
|
||||
# key_cache_none.
|
||||
LOAD INDEX INTO CACHE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 preload_keys status OK
|
||||
DROP TABLE t1;
|
||||
set global key_buffer_size=@save_key_buffer_size;
|
||||
set global key_cache_block_size=@save_key_cache_block_size;
|
||||
select @@key_buffer_size;
|
||||
@ -817,19 +833,3 @@ set global keycache1.key_buffer_size=0;
|
||||
set global keycache2.key_buffer_size=0;
|
||||
set global key_buffer_size=@save_key_buffer_size;
|
||||
set global key_cache_segments=@save_key_cache_segments;
|
||||
#
|
||||
# Bug#12361113: crash when load index into cache
|
||||
#
|
||||
# Note that this creates an empty disabled key cache!
|
||||
SET GLOBAL key_cache_none.key_cache_block_size = 1024;
|
||||
CREATE TABLE t1 (a INT, b INTEGER NOT NULL, KEY (b) ) ENGINE = MYISAM;
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
CACHE INDEX t1 in key_cache_none;
|
||||
ERROR HY000: Unknown key cache 'key_cache_none'
|
||||
# The bug crashed the server at LOAD INDEX below. Now it will succeed
|
||||
# since the default cache is used due to CACHE INDEX failed for
|
||||
# key_cache_none.
|
||||
LOAD INDEX INTO CACHE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 preload_keys status OK
|
||||
DROP TABLE t1;
|
||||
|
@ -814,5 +814,32 @@ COUNT(*)
|
||||
1478
|
||||
SET optimizer_switch=@save_optimizer_switch;
|
||||
DROP TABLE t1,t2;
|
||||
# check "Handler_pushed" status varuiables
|
||||
CREATE TABLE t1 (
|
||||
c1 CHAR(1),
|
||||
c2 CHAR(1),
|
||||
KEY (c1)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('3', '3'),('4','4'),('5','5');
|
||||
flush status;
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 0
|
||||
Handler_pushed_index_cond_filtered 0
|
||||
SELECT * FROM t1 FORCE INDEX(c1) WHERE (c1='3' or c1='4') and c1 % 2 = 0 ;
|
||||
c1 c2
|
||||
4 4
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 2
|
||||
Handler_pushed_index_cond_filtered 1
|
||||
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
|
||||
c1 c2
|
||||
4 4
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 2
|
||||
Handler_pushed_index_cond_filtered 1
|
||||
DROP TABLE t1;
|
||||
set storage_engine= @save_storage_engine;
|
||||
set optimizer_switch=@maria_icp_tmp;
|
||||
|
@ -812,6 +812,33 @@ COUNT(*)
|
||||
1478
|
||||
SET optimizer_switch=@save_optimizer_switch;
|
||||
DROP TABLE t1,t2;
|
||||
# check "Handler_pushed" status varuiables
|
||||
CREATE TABLE t1 (
|
||||
c1 CHAR(1),
|
||||
c2 CHAR(1),
|
||||
KEY (c1)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('3', '3'),('4','4'),('5','5');
|
||||
flush status;
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 0
|
||||
Handler_pushed_index_cond_filtered 0
|
||||
SELECT * FROM t1 FORCE INDEX(c1) WHERE (c1='3' or c1='4') and c1 % 2 = 0 ;
|
||||
c1 c2
|
||||
4 4
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 2
|
||||
Handler_pushed_index_cond_filtered 1
|
||||
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
|
||||
c1 c2
|
||||
4 4
|
||||
show status like "Handler_pushed%";
|
||||
Variable_name Value
|
||||
Handler_pushed_index_cond_checks 2
|
||||
Handler_pushed_index_cond_filtered 1
|
||||
DROP TABLE t1;
|
||||
drop table if exists t0, t1, t1i, t1m;
|
||||
#
|
||||
# BUG#826935 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed
|
||||
@ -887,4 +914,19 @@ Warning 1292 Truncated incorrect DOUBLE value: 'c'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'c'
|
||||
SET optimizer_switch=@save_optimizer_switch;
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
#
|
||||
# BUG#933412: Server crashes in _mi_put_key_in_record on KILL QUERY with ICP, STRAIGHT_JOIN
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
b INT,
|
||||
c VARCHAR(1) NOT NULL,
|
||||
d DATETIME,
|
||||
KEY (c, b)
|
||||
) ENGINE=MyISAM;
|
||||
# INSERT some data
|
||||
CREATE TABLE t2 ( a INT ) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES
|
||||
(7),(3),(7),(3);
|
||||
# Now run a number of ICP queries while trying to kill them
|
||||
DROP TABLE t1,t2;
|
||||
set optimizer_switch=@myisam_icp_tmp;
|
||||
|
@ -1769,6 +1769,21 @@ SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
|
||||
pk i4 pk i4
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
#
|
||||
# LP Bug #533117: Wrong use_count in SEL_ARG trees
|
||||
# (Bug #58731)
|
||||
#
|
||||
create table t1 (a int, b int, c int, key idx (a,b,c));
|
||||
insert into t1 values (0,0,0), (2,2,0), (1,1,1), (2,2,1);
|
||||
explain
|
||||
select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range idx idx 5 NULL 3 Using where; Using index
|
||||
select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1;
|
||||
a b c
|
||||
2 2 0
|
||||
2 2 1
|
||||
drop table t1;
|
||||
create table t1 (f1 datetime, key (f1));
|
||||
insert into t1 values ('2000-03-09 15:56:59'),('2000-05-05 23:24:28'),('2000-06-13 13:12:06');
|
||||
select min(f1) from t1 where f1 >= '2006-05-25 07:00:20' and f1 between '2003-11-23 10:00:09' and '2010-01-01 01:01:01' and f1 > '2001-01-01 01:01:01';
|
||||
|
@ -1771,6 +1771,21 @@ SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
|
||||
pk i4 pk i4
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
#
|
||||
# LP Bug #533117: Wrong use_count in SEL_ARG trees
|
||||
# (Bug #58731)
|
||||
#
|
||||
create table t1 (a int, b int, c int, key idx (a,b,c));
|
||||
insert into t1 values (0,0,0), (2,2,0), (1,1,1), (2,2,1);
|
||||
explain
|
||||
select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range idx idx 5 NULL 3 Using where; Using index
|
||||
select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1;
|
||||
a b c
|
||||
2 2 0
|
||||
2 2 1
|
||||
drop table t1;
|
||||
create table t1 (f1 datetime, key (f1));
|
||||
insert into t1 values ('2000-03-09 15:56:59'),('2000-05-05 23:24:28'),('2000-06-13 13:12:06');
|
||||
select min(f1) from t1 where f1 >= '2006-05-25 07:00:20' and f1 between '2003-11-23 10:00:09' and '2010-01-01 01:01:01' and f1 > '2001-01-01 01:01:01';
|
||||
|
@ -328,15 +328,15 @@ ID Name Country Population
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE (ID < 10) OR (ID BETWEEN 100 AND 110);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 20 Using index condition; Using where
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 20 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE (ID < 200) OR (ID BETWEEN 100 AND 200);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 200 Using index condition; Using where
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 200 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE (ID < 600) OR (ID BETWEEN 900 AND 1500);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 1198 Using index condition; Using where
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 1198 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE Country > 'A' AND Country < 'ARG';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -355,7 +355,7 @@ WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
|
||||
OR ((ID BETWEEN 100 AND 110) AND
|
||||
(Name LIKE 'P%' OR (Population > 103000 AND Population < 104000)));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 20 Using index condition; Using where
|
||||
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 20 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City
|
||||
WHERE ((ID < 800) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
|
||||
@ -369,7 +369,7 @@ WHERE ((ID < 200) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
|
||||
OR ((ID BETWEEN 100 AND 200) AND
|
||||
(Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 200 Using index condition; Using where
|
||||
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 200 Using where
|
||||
SELECT * FROM City USE INDEX ()
|
||||
WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
|
||||
OR ((ID BETWEEN 100 AND 110) AND
|
||||
@ -601,11 +601,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE ID BETWEEN 3400 AND 3800;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 400 Using index condition
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 400 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE Name LIKE 'P%';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -765,27 +765,27 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE ID BETWEEN 4025 AND 4035;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE ID BETWEEN 4028 AND 4032;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 5 Using index condition
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 5 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE ID BETWEEN 3500 AND 3800;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 300 Using index condition
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 300 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE ID BETWEEN 4000 AND 4300;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 80 Using index condition
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 80 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE ID BETWEEN 250 and 260 ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City WHERE (Population > 101000 AND Population < 102000);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -1422,7 +1422,7 @@ SELECT * FROM t1
|
||||
WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
|
||||
(t1.c=0 OR t1.a=500);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY,idx PRIMARY 4 NULL 1 Using index condition; Using where
|
||||
1 SIMPLE t1 range PRIMARY,idx PRIMARY 4 NULL 1 Using where
|
||||
SELECT * FROM t1
|
||||
WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
|
||||
(t1.c=0 OR t1.a=500);
|
||||
|
@ -276,6 +276,8 @@ Handler_commit 0
|
||||
Handler_delete 0
|
||||
Handler_discover 0
|
||||
Handler_prepare 0
|
||||
Handler_pushed_index_cond_checks 0
|
||||
Handler_pushed_index_cond_filtered 0
|
||||
Handler_read_first 0
|
||||
Handler_read_key 4
|
||||
Handler_read_last 0
|
||||
@ -298,7 +300,7 @@ Created_tmp_files 0
|
||||
Created_tmp_tables 2
|
||||
Handler_tmp_update 2
|
||||
Handler_tmp_write 7
|
||||
Rows_tmp_read 36
|
||||
Rows_tmp_read 38
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (i int(11) DEFAULT NULL, KEY i (i) ) ENGINE=MyISAM;
|
||||
insert into t1 values (1),(2),(3),(4),(5);
|
||||
@ -312,6 +314,8 @@ Handler_commit 0
|
||||
Handler_delete 0
|
||||
Handler_discover 0
|
||||
Handler_prepare 0
|
||||
Handler_pushed_index_cond_checks 0
|
||||
Handler_pushed_index_cond_filtered 0
|
||||
Handler_read_first 0
|
||||
Handler_read_key 2
|
||||
Handler_read_last 0
|
||||
|
@ -101,6 +101,8 @@ Handler_commit 19
|
||||
Handler_delete 1
|
||||
Handler_discover 0
|
||||
Handler_prepare 18
|
||||
Handler_pushed_index_cond_checks 0
|
||||
Handler_pushed_index_cond_filtered 0
|
||||
Handler_read_first 0
|
||||
Handler_read_key 3
|
||||
Handler_read_last 0
|
||||
|
@ -1848,6 +1848,19 @@ a b
|
||||
7 5
|
||||
3 3
|
||||
drop table t1,t2;
|
||||
#
|
||||
# BUG#933407: Valgrind warnings in mark_as_null_row with materialization+semijoin, STRAIGHT_JOIN, impossible WHERE
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0),(8);
|
||||
SELECT STRAIGHT_JOIN MIN(a) FROM t1
|
||||
WHERE a IN (
|
||||
SELECT a FROM t1
|
||||
WHERE 'condition'='impossible'
|
||||
);
|
||||
MIN(a)
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
# This must be at the end:
|
||||
set optimizer_switch=@subselect_sj_mat_tmp;
|
||||
set join_cache_level=@save_join_cache_level;
|
||||
|
@ -2763,6 +2763,129 @@ DROP table t1, t2;
|
||||
set @@optimizer_switch= @os_912513;
|
||||
set @@join_cache_level= @jcl_912513;
|
||||
# End
|
||||
#
|
||||
# BUG#934342: outer join + semijoin materialization
|
||||
# + join_cache_level > 2
|
||||
#
|
||||
CREATE TABLE t1 (a varchar(1), b varchar(1), INDEX idx_a(a) );
|
||||
INSERT INTO t1 VALUES ('v','v'), ('w','w'), ('t','t');
|
||||
CREATE TABLE t2 (c varchar(1), INDEX idx_c(c) );
|
||||
INSERT INTO t2 VALUES ('v'), ('v'), ('s'), ('j');
|
||||
CREATE TABLE t3 (c varchar(1), d varchar(1), INDEX idx_c(c) );
|
||||
INSERT INTO t3 VALUES ('v','v'), ('v','v'), ('s','s'), ('j','j');
|
||||
INSERT INTO t3 VALUES ('m','m'), ('d','d'), ('k','k'), ('m','m');
|
||||
set @tmp_otimizer_switch= @@optimizer_switch;
|
||||
set @tmp_join_cache_level=@@join_cache_level;
|
||||
set optimizer_switch = 'materialization=on,semijoin=on,join_cache_hashed=on';
|
||||
set join_cache_level=0;
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL idx_a NULL NULL NULL 3
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 10 func,func 1
|
||||
1 PRIMARY t2 ref idx_c idx_c 4 test.t1.b 2 Using where; Using index
|
||||
2 MATERIALIZED t ALL idx_a NULL NULL NULL 3
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
a b c
|
||||
v v v
|
||||
v v v
|
||||
w w NULL
|
||||
t t NULL
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL idx_a NULL NULL NULL 3
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 10 func,func 1
|
||||
1 PRIMARY t3 ref idx_c idx_c 4 test.t1.b 2 Using where
|
||||
2 MATERIALIZED t ALL idx_a NULL NULL NULL 3
|
||||
SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
a b c d
|
||||
v v v v
|
||||
v v v v
|
||||
w w NULL NULL
|
||||
t t NULL NULL
|
||||
set join_cache_level=6;
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL idx_a NULL NULL NULL 3
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 10 func,func 1
|
||||
1 PRIMARY t2 ref idx_c idx_c 4 test.t1.b 2 Using where; Using index
|
||||
2 MATERIALIZED t ALL idx_a NULL NULL NULL 3
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
a b c
|
||||
v v v
|
||||
v v v
|
||||
w w NULL
|
||||
t t NULL
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL idx_a NULL NULL NULL 3
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 10 func,func 1
|
||||
1 PRIMARY t3 ref idx_c idx_c 4 test.t1.b 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
2 MATERIALIZED t ALL idx_a NULL NULL NULL 3
|
||||
SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
a b c d
|
||||
v v v v
|
||||
v v v v
|
||||
w w NULL NULL
|
||||
t t NULL NULL
|
||||
set optimizer_switch=@tmp_optimizer_switch;
|
||||
set join_cache_level=@tmp_join_cache_level;
|
||||
DROP TABLE t1,t2,t3;
|
||||
# End
|
||||
#
|
||||
# BUG#934348: GROUP BY with HAVING + semijoin materialization
|
||||
# + join_cache_level > 2
|
||||
#
|
||||
CREATE TABLE t1 (a varchar(1), INDEX idx_a(a));
|
||||
INSERT INTO t1 VALUES ('c'), ('v'), ('c');
|
||||
CREATE TABLE t2 (b varchar(1));
|
||||
INSERT INTO t2 VALUES ('v'), ('c');
|
||||
set @tmp_otimizer_switch= @@optimizer_switch;
|
||||
set @tmp_join_cache_level=@@join_cache_level;
|
||||
set optimizer_switch = 'materialization=on,semijoin=on,join_cache_hashed=on';
|
||||
set join_cache_level=0;
|
||||
EXPLAIN
|
||||
SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
|
||||
GROUP BY a HAVING a != 'z';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 Using temporary; Using filesort
|
||||
1 PRIMARY t ref idx_a idx_a 4 test.t2.b 2 Using index
|
||||
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 MATERIALIZED t1 ref idx_a idx_a 4 test.t2.b 2 Using index
|
||||
SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
|
||||
GROUP BY a HAVING a != 'z';
|
||||
a
|
||||
c
|
||||
v
|
||||
set join_cache_level=6;
|
||||
EXPLAIN
|
||||
SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
|
||||
GROUP BY a HAVING a != 'z';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 Using temporary; Using filesort
|
||||
1 PRIMARY t ref idx_a idx_a 4 test.t2.b 2 Using index
|
||||
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 MATERIALIZED t1 ref idx_a idx_a 4 test.t2.b 2 Using index
|
||||
SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
|
||||
GROUP BY a HAVING a != 'z';
|
||||
a
|
||||
c
|
||||
v
|
||||
set optimizer_switch=@tmp_optimizer_switch;
|
||||
set join_cache_level=@tmp_join_cache_level;
|
||||
DROP TABLE t1,t2;
|
||||
# End
|
||||
set join_cache_level=default;
|
||||
show variables like 'join_cache_level';
|
||||
Variable_name Value
|
||||
|
@ -1885,6 +1885,19 @@ a b
|
||||
7 5
|
||||
3 3
|
||||
drop table t1,t2;
|
||||
#
|
||||
# BUG#933407: Valgrind warnings in mark_as_null_row with materialization+semijoin, STRAIGHT_JOIN, impossible WHERE
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0),(8);
|
||||
SELECT STRAIGHT_JOIN MIN(a) FROM t1
|
||||
WHERE a IN (
|
||||
SELECT a FROM t1
|
||||
WHERE 'condition'='impossible'
|
||||
);
|
||||
MIN(a)
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
# This must be at the end:
|
||||
set optimizer_switch=@subselect_sj_mat_tmp;
|
||||
set join_cache_level=@save_join_cache_level;
|
||||
|
@ -2933,26 +2933,6 @@ a
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.3 tests
|
||||
#
|
||||
# Test for bug #39932 "create table fails if column for FK is in different
|
||||
# case than in corr index".
|
||||
#
|
||||
drop tables if exists t1, t2;
|
||||
create table t1 (pk int primary key) engine=InnoDB;
|
||||
# Even although the below statement uses uppercased field names in
|
||||
# foreign key definition it still should be able to find explicitly
|
||||
# created supporting index. So it should succeed and should not
|
||||
# create any additional supporting indexes.
|
||||
create table t2 (fk int, key x (fk),
|
||||
constraint x foreign key (FK) references t1 (PK)) engine=InnoDB;
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`fk` int(11) DEFAULT NULL,
|
||||
KEY `x` (`fk`),
|
||||
CONSTRAINT `x` FOREIGN KEY (`fk`) REFERENCES `t1` (`pk`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t2, t1;
|
||||
#
|
||||
# Test for bug #11762012 - "54553: INNODB ASSERTS IN HA_INNOBASE::
|
||||
# UPDATE_ROW, TEMPORARY TABLE, TABLE LOCK".
|
||||
#
|
||||
|
@ -19,6 +19,7 @@
|
||||
# #
|
||||
#######################################################################
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
let collation=utf8_unicode_ci;
|
||||
--source include/have_collation.inc
|
||||
|
@ -1100,24 +1100,6 @@ DROP TABLE t1,t2;
|
||||
|
||||
--echo End of 5.3 tests
|
||||
|
||||
--echo #
|
||||
--echo # Test for bug #39932 "create table fails if column for FK is in different
|
||||
--echo # case than in corr index".
|
||||
--echo #
|
||||
--disable_warnings
|
||||
drop tables if exists t1, t2;
|
||||
--enable_warnings
|
||||
create table t1 (pk int primary key) engine=InnoDB;
|
||||
--echo # Even although the below statement uses uppercased field names in
|
||||
--echo # foreign key definition it still should be able to find explicitly
|
||||
--echo # created supporting index. So it should succeed and should not
|
||||
--echo # create any additional supporting indexes.
|
||||
create table t2 (fk int, key x (fk),
|
||||
constraint x foreign key (FK) references t1 (PK)) engine=InnoDB;
|
||||
show create table t2;
|
||||
drop table t2, t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Test for bug #11762012 - "54553: INNODB ASSERTS IN HA_INNOBASE::
|
||||
--echo # UPDATE_ROW, TEMPORARY TABLE, TABLE LOCK".
|
||||
|
@ -152,7 +152,7 @@ a b c
|
||||
2 -2 -2
|
||||
explain select * from t3 where a between 1 and 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using index condition
|
||||
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where
|
||||
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr>
|
||||
select * from t3 where b between -2 and -1;
|
||||
a b c
|
||||
@ -176,7 +176,7 @@ a b c
|
||||
1 -1 -1
|
||||
explain select * from t3 where a between 1 and 2 order by b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using filesort
|
||||
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort
|
||||
# SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <indexed vcol>
|
||||
select * from t3 where a between 1 and 2 order by c;
|
||||
a b c
|
||||
@ -184,7 +184,7 @@ a b c
|
||||
1 -1 -1
|
||||
explain select * from t3 where a between 1 and 2 order by c;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using filesort
|
||||
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort
|
||||
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-vcol>
|
||||
select * from t3 where b between -2 and -1 order by a;
|
||||
a b c
|
||||
|
@ -1526,12 +1526,14 @@ insert into t2 values (3,1, 'qwerty'),(3,4, 'qwerty');
|
||||
insert into t2 values (4,1, 'qwerty'),(4,2, 'qwerty'),(4,3, 'qwerty'),
|
||||
(4,4, 'qwerty');
|
||||
|
||||
flush status;
|
||||
set join_cache_level=5;
|
||||
select 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;
|
||||
|
||||
explain select t2.f1, t2.f2, t2.f3 from t1,t2
|
||||
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
|
||||
show status like "Handler_pushed%";
|
||||
|
||||
set join_cache_level=6;
|
||||
select t2.f1, t2.f2, t2.f3 from t1,t2
|
||||
@ -1539,6 +1541,7 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
|
||||
|
||||
explain select t2.f1, t2.f2, t2.f3 from t1,t2
|
||||
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
|
||||
show status like "Handler_pushed%";
|
||||
|
||||
set join_cache_level=7;
|
||||
select t2.f1, t2.f2, t2.f3 from t1,t2
|
||||
@ -1546,6 +1549,7 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
|
||||
|
||||
explain select t2.f1, t2.f2, t2.f3 from t1,t2
|
||||
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
|
||||
show status like "Handler_pushed%";
|
||||
|
||||
set join_cache_level=8;
|
||||
select t2.f1, t2.f2, t2.f3 from t1,t2
|
||||
@ -1553,6 +1557,7 @@ where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
|
||||
|
||||
explain select t2.f1, t2.f2, t2.f3 from t1,t2
|
||||
where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
|
||||
show status like "Handler_pushed%";
|
||||
|
||||
drop table t1,t2;
|
||||
set join_cache_level=default;
|
||||
|
@ -254,6 +254,22 @@ DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # Bug#12361113: crash when load index into cache
|
||||
--echo #
|
||||
|
||||
--echo # Note that this creates an empty disabled key cache!
|
||||
SET GLOBAL key_cache_none.key_cache_block_size = 1024;
|
||||
CREATE TABLE t1 (a INT, b INTEGER NOT NULL, KEY (b) ) ENGINE = MYISAM;
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
--error ER_UNKNOWN_KEY_CACHE
|
||||
CACHE INDEX t1 in key_cache_none;
|
||||
--echo # The bug crashed the server at LOAD INDEX below. Now it will succeed
|
||||
--echo # since the default cache is used due to CACHE INDEX failed for
|
||||
--echo # key_cache_none.
|
||||
LOAD INDEX INTO CACHE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 5.1 tests
|
||||
|
||||
#
|
||||
@ -522,19 +538,3 @@ set global key_buffer_size=@save_key_buffer_size;
|
||||
set global key_cache_segments=@save_key_cache_segments;
|
||||
|
||||
# End of 5.2 tests
|
||||
|
||||
--echo #
|
||||
--echo # Bug#12361113: crash when load index into cache
|
||||
--echo #
|
||||
|
||||
--echo # Note that this creates an empty disabled key cache!
|
||||
SET GLOBAL key_cache_none.key_cache_block_size = 1024;
|
||||
CREATE TABLE t1 (a INT, b INTEGER NOT NULL, KEY (b) ) ENGINE = MYISAM;
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
--error ER_UNKNOWN_KEY_CACHE
|
||||
CACHE INDEX t1 in key_cache_none;
|
||||
--echo # The bug crashed the server at LOAD INDEX below. Now it will succeed
|
||||
--echo # since the default cache is used due to CACHE INDEX failed for
|
||||
--echo # key_cache_none.
|
||||
LOAD INDEX INTO CACHE t1;
|
||||
DROP TABLE t1;
|
||||
|
@ -262,4 +262,133 @@ SET optimizer_switch=@save_optimizer_switch;
|
||||
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#933412: Server crashes in _mi_put_key_in_record on KILL QUERY with ICP, STRAIGHT_JOIN
|
||||
--echo #
|
||||
CREATE TABLE t1 (
|
||||
b INT,
|
||||
c VARCHAR(1) NOT NULL,
|
||||
d DATETIME,
|
||||
KEY (c, b)
|
||||
) ENGINE=MyISAM;
|
||||
--echo # INSERT some data
|
||||
--disable_query_log
|
||||
INSERT INTO t1 ( b, d, c ) VALUES
|
||||
(4,'2005-01-08 00:00:00','f'),
|
||||
(1,'2004-05-20 10:45:51','c'),(2,'2006-08-11 21:33:49','e'),
|
||||
(5,'2003-05-19 00:20:40','a'),(3,'2005-01-03 06:18:39','a'),
|
||||
(7,'2008-11-25 18:18:14','b'),(6,'2008-11-09 15:53:46','b'),
|
||||
(9,'2003-03-01 03:40:36','c'),(8,'2003-09-25 23:14:09','d'),
|
||||
(0,'2007-01-17 09:18:31','f'),(9,'2008-09-08 09:52:24','c'),
|
||||
(2,'2008-03-10 00:00:00','a'),(0,'2003-03-14 09:31:07','c'),
|
||||
(4,'2005-04-25 00:00:00','h'),(6,'2001-08-01 05:55:55','e'),
|
||||
(3,'2005-04-09 01:22:48','f'),(7,'2009-11-12 13:27:22','r'),
|
||||
(0,'2009-03-28 05:05:28','h'),(15,'2005-05-16 04:35:41','f'),
|
||||
(7,'2006-03-26 05:19:58','c'),(9,'2002-10-06 02:17:00','g'),
|
||||
(4,'2007-01-28 03:28:20','b'),(1,'2009-04-22 10:16:40','c'),
|
||||
(2,'2003-01-01 19:39:00','f'),(0,'2008-05-03 19:16:29','t'),
|
||||
(2,'2005-01-28 00:00:00','j'),(8,'2004-01-10 00:00:00','w'),
|
||||
(8,'2000-06-13 21:56:37','a'),(5,'2001-03-21 19:24:49','o'),
|
||||
(99,'2003-12-20 21:29:06','f'),(0,'1900-01-01 00:00:00','w'),
|
||||
(7,'2000-12-19 00:00:00','c'),(0,'2000-03-03 06:10:19','l'),
|
||||
(3,'2000-08-11 00:00:00','q'),(0,'2007-05-25 03:46:41','e'),
|
||||
(241,'2005-05-17 00:00:00','j'),(4,'2005-11-02 00:44:06','r'),
|
||||
(43,'2001-07-11 00:00:00','a'),(1,'2008-12-01 18:30:27','z'),
|
||||
(4,'2004-10-25 00:00:00','i'),(5,'2000-04-08 12:12:01','c'),
|
||||
(0,'1900-01-01 00:00:00','f'),(9,'2002-05-13 22:47:02','p'),
|
||||
(1,'2008-10-09 15:39:40','d'),(3,'2004-06-24 00:00:00','d'),
|
||||
(0,'2008-03-06 00:00:00','r'),(9,'2007-04-16 18:40:03','i'),
|
||||
(3,'2008-03-16 19:49:37','t'),(7,'2003-07-15 08:11:21','d'),
|
||||
(8,'2005-02-11 00:04:53','r'),(0,'2002-09-21 00:00:00','y'),
|
||||
(3,'2004-11-03 00:37:21','z'),(6,'2007-10-18 00:00:00','e'),
|
||||
(6,'2007-01-21 10:42:56','o'),(5,'2000-03-26 21:21:04','b'),
|
||||
(9,'2001-03-15 08:08:21','e'),(1,'2001-10-16 12:56:59','a'),
|
||||
(6,'2004-05-01 23:45:55','o'),(4,'2000-03-04 00:00:00','f'),
|
||||
(9,'2002-12-03 16:48:28','e'),(8,'2003-01-09 00:36:07','m'),
|
||||
(1,'2006-06-22 04:32:41','s'),(8,'2008-09-20 05:01:48','q'),
|
||||
(4,'2006-06-02 22:15:31','g'),(2,'2002-05-14 07:07:42','e'),
|
||||
(7,'2005-06-05 01:30:42','r'),(127,'2004-05-11 01:56:48','a'),
|
||||
(210,'2003-11-05 00:41:34','z'),(5,'1900-01-01 00:00:00','h'),
|
||||
(1,'2006-04-16 00:00:00','f'),(7,'2000-12-17 00:00:00','x'),
|
||||
(8,'2009-05-09 20:43:07','b'),(175,'2008-11-26 16:33:09','p'),
|
||||
(0,'2002-05-09 21:18:44','v'),(8,'2002-06-01 11:32:25','k'),
|
||||
(1,'2008-11-09 23:56:00','a'),(0,'2008-01-08 10:18:46','c'),
|
||||
(2,'2005-04-16 00:00:00','o'),(5,'2002-08-25 00:00:00','b'),
|
||||
(64,'2005-12-05 21:51:52','b'),(4,'2005-08-10 00:00:00','i'),
|
||||
(6,'2006-03-23 00:00:00','d'),(9,'2007-01-27 00:00:00','i'),
|
||||
(8,'2008-08-16 00:00:00','a'),(7,'2003-01-16 12:13:18','k'),
|
||||
(0,'2003-06-22 00:00:00','v'),(5,'2008-06-20 05:43:56','u'),
|
||||
(8,'2004-09-23 18:57:17','e'),(1,'2000-12-26 00:00:00','y'),
|
||||
(4,'2009-06-01 13:00:28','e'),(1,'2009-11-18 06:28:48','m'),
|
||||
(0,'2004-06-12 10:01:10','e'),(2,'2005-10-16 01:48:55','e'),
|
||||
(5,'2001-12-23 09:50:21','l'),(6,'1900-01-01 00:00:00','a'),
|
||||
(1,'2001-10-28 00:00:00','d'),(1,'2008-07-12 23:30:19','s'),
|
||||
(0,'2002-10-11 16:51:16','r'),(4,'2007-09-18 06:27:10','x'),
|
||||
(1,'2007-02-21 12:28:14','e'),(6,'2001-09-16 00:00:00','f'),
|
||||
(0,'2007-09-20 02:25:45','c'),(0,'2006-08-07 03:25:56','j'),
|
||||
(8,'2006-12-04 20:20:32','t'),(7,'2007-09-05 10:13:10','i'),
|
||||
(9,'2006-04-12 17:59:57','t'),(2,'2009-04-28 00:06:09','b'),
|
||||
(8,'2000-01-07 00:00:00','b'),(7,'2000-03-25 10:04:41','k'),
|
||||
(4,'2000-07-10 00:44:55','w'),(9,'2007-09-22 14:26:26','j'),
|
||||
(9,'2003-09-11 22:41:17','a'),(0,'2004-06-07 13:52:32','c'),
|
||||
(8,'2008-10-09 00:00:00','p'),(1,'2007-04-01 00:00:00','c'),
|
||||
(9,'2000-12-05 00:00:00','i'),(3,'1900-01-01 00:00:00','a'),
|
||||
(3,'2005-12-24 21:50:54','e'),(8,'2009-07-21 19:34:55','n'),
|
||||
(9,'2005-11-13 17:57:56','d'),(7,'2004-10-07 06:41:39','l'),
|
||||
(1,'2004-11-20 08:05:08','u'),(3,'2005-05-25 00:00:00','r'),
|
||||
(1,'2006-09-02 14:16:41','u'),(8,'2006-01-07 00:00:00','a'),
|
||||
(9,'2003-04-05 00:54:20','w'),(2,'2003-12-22 00:00:00','a'),
|
||||
(9,'2006-04-16 17:31:40','e'),(6,'2005-02-10 14:22:46','e'),
|
||||
(7,'2004-04-27 05:54:52','p'),(1,'2005-12-07 00:00:00','t'),
|
||||
(5,'2004-04-03 20:56:28','d'),(4,'2000-09-07 05:17:16','h'),
|
||||
(2,'2004-08-04 16:10:42','i'),(1,'2007-03-04 00:00:00','b'),
|
||||
(9,'1900-01-01 00:00:00','d'),(1,'2000-05-12 23:02:50','m'),
|
||||
(2,'1900-01-01 00:00:00','l'),(1,'1900-01-01 00:00:00','k'),
|
||||
(4,'2000-07-14 01:25:18','d'),(5,'2009-08-21 00:00:00','w'),
|
||||
(6,'2009-05-25 13:33:54','f'),(7,'2006-06-13 00:00:00','e'),
|
||||
(8,'1900-01-01 00:00:00','a'),(6,'2004-02-24 00:00:00','j'),
|
||||
(0,'2003-05-21 07:03:46','k'),(9,'1900-01-01 00:00:00','e'),
|
||||
(2,'1900-01-01 00:00:00','y'),(2,'2000-12-22 00:00:00','e'),
|
||||
(3,'2003-09-26 00:00:00','f'),(2,'2001-01-13 08:20:19','h'),
|
||||
(9,'2008-09-23 20:03:28','n'),(5,'2007-03-20 02:41:38','s'),
|
||||
(1,'2009-02-14 10:27:18','a'),(0,'2001-08-10 17:44:05','s'),
|
||||
(3,'2008-01-20 12:49:54','v'),(1,'2001-05-05 09:09:59','r');
|
||||
--enable_query_log
|
||||
CREATE TABLE t2 ( a INT ) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES
|
||||
(7),(3),(7),(3);
|
||||
|
||||
# 'con2' will be the connection that will run all the KILLable statements
|
||||
--connect (con2,127.0.0.1,root,,test)
|
||||
|
||||
--let $run = 300
|
||||
--let $con_id = `SELECT CONNECTION_ID()`
|
||||
|
||||
--echo # Now run a number of ICP queries while trying to kill them
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
while ($run)
|
||||
{
|
||||
--send
|
||||
SELECT * FROM t1 AS alias1 STRAIGHT_JOIN t1 AS alias2
|
||||
ON alias2.c = alias1.c
|
||||
WHERE alias2.b >= 9;
|
||||
|
||||
--connect (con1,127.0.0.1,root,,test)
|
||||
--eval KILL QUERY $con_id
|
||||
--disconnect con1
|
||||
|
||||
--dec $run
|
||||
|
||||
--connection con2
|
||||
--error 0,ER_QUERY_INTERRUPTED
|
||||
--reap
|
||||
}
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--disconnect con2
|
||||
--connection default
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
set optimizer_switch=@myisam_icp_tmp;
|
||||
|
||||
|
@ -1406,6 +1406,20 @@ DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # LP Bug #533117: Wrong use_count in SEL_ARG trees
|
||||
--echo # (Bug #58731)
|
||||
--echo #
|
||||
|
||||
create table t1 (a int, b int, c int, key idx (a,b,c));
|
||||
insert into t1 values (0,0,0), (2,2,0), (1,1,1), (2,2,1);
|
||||
|
||||
explain
|
||||
select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1;
|
||||
select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# lp:750117 Bogus warning with aggregate and datetime column
|
||||
#
|
||||
@ -1459,4 +1473,3 @@ SELECT * FROM t1 ignore index(d) WHERE d = 'q' OR d >= 'q' OR (d IN ( 'j' , 's'
|
||||
SELECT * FROM t1 force index(d) WHERE d = 'q' OR d >= 'q' OR (d IN ( 'j' , 's' , 'i' ) AND ( b = 102 ));
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -116,6 +116,98 @@ set @@join_cache_level= @jcl_912513;
|
||||
|
||||
--echo # End
|
||||
|
||||
--echo #
|
||||
--echo # BUG#934342: outer join + semijoin materialization
|
||||
--echo # + join_cache_level > 2
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a varchar(1), b varchar(1), INDEX idx_a(a) );
|
||||
INSERT INTO t1 VALUES ('v','v'), ('w','w'), ('t','t');
|
||||
|
||||
CREATE TABLE t2 (c varchar(1), INDEX idx_c(c) );
|
||||
INSERT INTO t2 VALUES ('v'), ('v'), ('s'), ('j');
|
||||
|
||||
CREATE TABLE t3 (c varchar(1), d varchar(1), INDEX idx_c(c) );
|
||||
INSERT INTO t3 VALUES ('v','v'), ('v','v'), ('s','s'), ('j','j');
|
||||
INSERT INTO t3 VALUES ('m','m'), ('d','d'), ('k','k'), ('m','m');
|
||||
|
||||
set @tmp_otimizer_switch= @@optimizer_switch;
|
||||
set @tmp_join_cache_level=@@join_cache_level;
|
||||
set optimizer_switch = 'materialization=on,semijoin=on,join_cache_hashed=on';
|
||||
|
||||
set join_cache_level=0;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
|
||||
set join_cache_level=6;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
|
||||
WHERE (a, b) IN (SELECT a, b FROM t1 t);
|
||||
|
||||
set optimizer_switch=@tmp_optimizer_switch;
|
||||
set join_cache_level=@tmp_join_cache_level;
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
--echo # End
|
||||
|
||||
--echo #
|
||||
--echo # BUG#934348: GROUP BY with HAVING + semijoin materialization
|
||||
--echo # + join_cache_level > 2
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a varchar(1), INDEX idx_a(a));
|
||||
INSERT INTO t1 VALUES ('c'), ('v'), ('c');
|
||||
|
||||
CREATE TABLE t2 (b varchar(1));
|
||||
INSERT INTO t2 VALUES ('v'), ('c');
|
||||
|
||||
set @tmp_otimizer_switch= @@optimizer_switch;
|
||||
set @tmp_join_cache_level=@@join_cache_level;
|
||||
set optimizer_switch = 'materialization=on,semijoin=on,join_cache_hashed=on';
|
||||
|
||||
set join_cache_level=0;
|
||||
|
||||
EXPLAIN
|
||||
SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
|
||||
GROUP BY a HAVING a != 'z';
|
||||
SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
|
||||
GROUP BY a HAVING a != 'z';
|
||||
|
||||
set join_cache_level=6;
|
||||
|
||||
EXPLAIN
|
||||
SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
|
||||
GROUP BY a HAVING a != 'z';
|
||||
SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
|
||||
GROUP BY a HAVING a != 'z';
|
||||
|
||||
set optimizer_switch=@tmp_optimizer_switch;
|
||||
set join_cache_level=@tmp_join_cache_level;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo # End
|
||||
|
||||
set join_cache_level=default;
|
||||
show variables like 'join_cache_level';
|
||||
|
||||
|
@ -1545,6 +1545,19 @@ select * from t1 where t1.a in (select a from t2 where t2.a=7 or t2.b<=1);
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#933407: Valgrind warnings in mark_as_null_row with materialization+semijoin, STRAIGHT_JOIN, impossible WHERE
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0),(8);
|
||||
|
||||
SELECT STRAIGHT_JOIN MIN(a) FROM t1
|
||||
WHERE a IN (
|
||||
SELECT a FROM t1
|
||||
WHERE 'condition'='impossible'
|
||||
);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # This must be at the end:
|
||||
set optimizer_switch=@subselect_sj_mat_tmp;
|
||||
|
@ -163,7 +163,7 @@ void my_print_stacktrace(uchar* stack_bottom __attribute__((unused)),
|
||||
my_safe_printf_stderr("%s",
|
||||
"Error when traversing the stack, stack appears corrupt.\n");
|
||||
else
|
||||
my_safe_printf_stderr("%s"
|
||||
my_safe_printf_stderr("%s",
|
||||
"Please read "
|
||||
"http://dev.mysql.com/doc/refman/5.1/en/resolve-stack-dump.html\n"
|
||||
"and follow instructions on how to resolve the stack trace.\n"
|
||||
@ -499,10 +499,11 @@ static void add_to_symbol_path(char *path, size_t path_buffer_size,
|
||||
}
|
||||
|
||||
/*
|
||||
Get symbol path - semicolon-separated list of directories to search for debug
|
||||
symbols. We expect PDB in the same directory as corresponding exe or dll,
|
||||
so the path is build from directories of the loaded modules. If environment
|
||||
variable _NT_SYMBOL_PATH is set, it's value appended to the symbol search path
|
||||
Get symbol path - semicolon-separated list of directories to search
|
||||
for debug symbols. We expect PDB in the same directory as
|
||||
corresponding exe or dll, so the path is build from directories of
|
||||
the loaded modules. If environment variable _NT_SYMBOL_PATH is set,
|
||||
it's value appended to the symbol search path
|
||||
*/
|
||||
static void get_symbol_path(char *path, size_t size)
|
||||
{
|
||||
@ -640,9 +641,9 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
|
||||
if(!have_module)
|
||||
{
|
||||
/*
|
||||
ModuleInfo structure has been "compatibly" extended in releases after XP,
|
||||
and its size was increased. To make XP dbghelp.dll function
|
||||
happy, pretend passing the old structure.
|
||||
ModuleInfo structure has been "compatibly" extended in
|
||||
releases after XP, and its size was increased. To make XP
|
||||
dbghelp.dll function happy, pretend passing the old structure.
|
||||
*/
|
||||
module.SizeOfStruct= MODULE64_SIZE_WINXP;
|
||||
have_module= SymGetModuleInfo64(hProcess, addr, &module);
|
||||
|
@ -138,6 +138,7 @@ static LEX_STRING vars_filter[]= {
|
||||
{C_STRING_WITH_LEN("ft\\_m%")},
|
||||
{C_STRING_WITH_LEN("have\\_%")},
|
||||
{C_STRING_WITH_LEN("%\\_size")},
|
||||
{C_STRING_WITH_LEN("innodb_f%")},
|
||||
{C_STRING_WITH_LEN("%\\_length%")},
|
||||
{C_STRING_WITH_LEN("%\\_timeout")},
|
||||
{C_STRING_WITH_LEN("large\\_%")},
|
||||
|
@ -4617,6 +4617,27 @@ int handler::compare_key2(key_range *range)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
ICP callback - to be called by an engine to check the pushed condition
|
||||
*/
|
||||
extern "C" enum icp_result handler_index_cond_check(void* h_arg)
|
||||
{
|
||||
handler *h= (handler*)h_arg;
|
||||
THD *thd= h->table->in_use;
|
||||
enum icp_result res;
|
||||
|
||||
if (thd_killed(thd))
|
||||
return ICP_ABORTED_BY_USER;
|
||||
|
||||
if (h->end_range && h->compare_key2(h->end_range) > 0)
|
||||
return ICP_OUT_OF_RANGE;
|
||||
h->increment_statistics(&SSV::ha_pushed_index_cond_checks);
|
||||
if ((res= h->pushed_idx_cond->val_int()? ICP_MATCH : ICP_NO_MATCH) ==
|
||||
ICP_NO_MATCH)
|
||||
h->increment_statistics(&SSV::ha_pushed_index_cond_filtered);
|
||||
return res;
|
||||
}
|
||||
|
||||
int handler::index_read_idx_map(uchar * buf, uint index, const uchar * key,
|
||||
key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag)
|
||||
|
@ -1638,6 +1638,8 @@ public:
|
||||
{}
|
||||
};
|
||||
|
||||
extern "C" enum icp_result handler_index_cond_check(void* h_arg);
|
||||
|
||||
uint calculate_key_len(TABLE *, uint, const uchar *, key_part_map);
|
||||
/*
|
||||
bitmap with first N+1 bits set
|
||||
@ -2857,6 +2859,8 @@ public:
|
||||
{ return ht; }
|
||||
inline int ha_write_tmp_row(uchar *buf);
|
||||
inline int ha_update_tmp_row(const uchar * old_data, uchar * new_data);
|
||||
|
||||
friend enum icp_result handler_index_cond_check(void* h_arg);
|
||||
};
|
||||
|
||||
#include "multi_range_read.h"
|
||||
|
@ -2230,7 +2230,6 @@ static int find_uniq_filename(char *name)
|
||||
char *start, *end;
|
||||
int error= 0;
|
||||
DBUG_ENTER("find_uniq_filename");
|
||||
LINT_INIT(number);
|
||||
|
||||
length= dirname_part(buff, name, &buf_length);
|
||||
start= name + length;
|
||||
|
@ -340,7 +340,7 @@ static volatile bool ready_to_exit;
|
||||
static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
|
||||
static my_bool opt_short_log_format= 0;
|
||||
static uint kill_cached_threads, wake_thread;
|
||||
ulong max_used_connections;
|
||||
ulong max_used_connections;
|
||||
static volatile ulong cached_thread_count= 0;
|
||||
static char *mysqld_user, *mysqld_chroot;
|
||||
static char *default_character_set_name;
|
||||
@ -680,6 +680,7 @@ char *opt_logname, *opt_slow_logname, *opt_bin_logname;
|
||||
my_bool opt_stack_trace;
|
||||
static volatile sig_atomic_t kill_in_progress;
|
||||
|
||||
my_bool opt_expect_abort= 0;
|
||||
static my_bool opt_bootstrap, opt_myisam_log;
|
||||
static int cleanup_done;
|
||||
static ulong opt_specialflag;
|
||||
@ -1240,7 +1241,6 @@ static int mysql_init_variables(void);
|
||||
static int get_options(int *argc_ptr, char ***argv_ptr);
|
||||
static bool add_terminator(DYNAMIC_ARRAY *options);
|
||||
extern "C" my_bool mysqld_get_one_option(int, const struct my_option *, char *);
|
||||
static void set_server_version(void);
|
||||
static int init_thread_environment();
|
||||
static char *get_relative_path(const char *path);
|
||||
static int fix_paths(void);
|
||||
@ -6876,6 +6876,8 @@ SHOW_VAR status_vars[]= {
|
||||
{"Handler_mrr_init", (char*) offsetof(STATUS_VAR, ha_multi_range_read_init_count), SHOW_LONG_STATUS},
|
||||
#endif
|
||||
{"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS},
|
||||
{"Handler_pushed_index_cond_checks",(char*) offsetof(STATUS_VAR, ha_pushed_index_cond_checks), SHOW_LONG_STATUS},
|
||||
{"Handler_pushed_index_cond_filtered",(char*) offsetof(STATUS_VAR, ha_pushed_index_cond_filtered), SHOW_LONG_STATUS},
|
||||
{"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONG_STATUS},
|
||||
{"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONG_STATUS},
|
||||
{"Handler_read_last", (char*) offsetof(STATUS_VAR, ha_read_last_count), SHOW_LONG_STATUS},
|
||||
@ -7905,7 +7907,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
|
||||
(MYSQL_SERVER_SUFFIX is set by the compilation environment)
|
||||
*/
|
||||
|
||||
static void set_server_version(void)
|
||||
void set_server_version(void)
|
||||
{
|
||||
char *end= strxmov(server_version, MYSQL_SERVER_VERSION,
|
||||
MYSQL_SERVER_SUFFIX_STR, NullS);
|
||||
|
@ -501,6 +501,8 @@ get_thread_running()
|
||||
return num_thread_running;
|
||||
}
|
||||
|
||||
void set_server_version(void);
|
||||
|
||||
#if defined(MYSQL_DYNAMIC_PLUGIN) && defined(_WIN32)
|
||||
extern "C" THD *_current_thd_noinline();
|
||||
#define _current_thd() _current_thd_noinline()
|
||||
@ -534,6 +536,7 @@ extern scheduler_functions *thread_scheduler, *extra_thread_scheduler;
|
||||
extern char *opt_log_basename;
|
||||
extern my_bool opt_master_verify_checksum;
|
||||
extern my_bool opt_stack_trace;
|
||||
extern my_bool opt_expect_abort;
|
||||
extern my_bool opt_slave_sql_verify_checksum;
|
||||
extern ulong binlog_checksum_options;
|
||||
extern bool max_user_connections_checking;
|
||||
|
@ -345,13 +345,23 @@ void push_index_cond(JOIN_TAB *tab, uint keyno)
|
||||
{
|
||||
DBUG_ENTER("push_index_cond");
|
||||
Item *idx_cond;
|
||||
|
||||
|
||||
/*
|
||||
Backported the following from MySQL 5.6:
|
||||
6. The index is not a clustered index. The performance improvement
|
||||
of pushing an index condition on a clustered key is much lower
|
||||
than on a non-clustered key. This restriction should be
|
||||
re-evaluated when WL#6061 is implemented.
|
||||
*/
|
||||
if ((tab->table->file->index_flags(keyno, 0, 1) &
|
||||
HA_DO_INDEX_COND_PUSHDOWN) &&
|
||||
optimizer_flag(tab->join->thd, OPTIMIZER_SWITCH_INDEX_COND_PUSHDOWN) &&
|
||||
tab->join->thd->lex->sql_command != SQLCOM_UPDATE_MULTI &&
|
||||
tab->join->thd->lex->sql_command != SQLCOM_DELETE_MULTI &&
|
||||
tab->type != JT_CONST && tab->type != JT_SYSTEM)
|
||||
tab->type != JT_CONST && tab->type != JT_SYSTEM &&
|
||||
!(keyno == tab->table->s->primary_key && // (6)
|
||||
tab->table->file->primary_key_is_clustered())) // (6)
|
||||
|
||||
{
|
||||
DBUG_EXECUTE("where",
|
||||
print_where(tab->select_cond, "full cond", QT_ORDINARY););
|
||||
|
@ -578,6 +578,14 @@ public:
|
||||
increment_use_count(1);
|
||||
use_count++;
|
||||
}
|
||||
void incr_refs_all()
|
||||
{
|
||||
for (SEL_ARG *pos=first(); pos ; pos=pos->next)
|
||||
{
|
||||
pos->increment_use_count(1);
|
||||
}
|
||||
use_count++;
|
||||
}
|
||||
void free_tree()
|
||||
{
|
||||
for (SEL_ARG *pos=first(); pos ; pos=pos->next)
|
||||
@ -1117,9 +1125,11 @@ int SEL_IMERGE::and_sel_tree(RANGE_OPT_PARAM *param, SEL_TREE *tree,
|
||||
for (SEL_TREE** or_tree= trees; or_tree != trees_next; or_tree++)
|
||||
{
|
||||
SEL_TREE *res_or_tree= 0;
|
||||
if (!(res_or_tree= new SEL_TREE()))
|
||||
SEL_TREE *and_tree= 0;
|
||||
if (!(res_or_tree= new SEL_TREE()) ||
|
||||
!(and_tree= new SEL_TREE(tree, TRUE, param)))
|
||||
return (-1);
|
||||
if (!and_range_trees(param, *or_tree, tree, res_or_tree))
|
||||
if (!and_range_trees(param, *or_tree, and_tree, res_or_tree))
|
||||
{
|
||||
if (new_imerge->or_sel_tree(param, res_or_tree))
|
||||
return (-1);
|
||||
@ -1332,7 +1342,7 @@ SEL_TREE::SEL_TREE(SEL_TREE *arg, bool without_merges,
|
||||
for (uint idx= 0; idx < param->keys; idx++)
|
||||
{
|
||||
if ((keys[idx]= arg->keys[idx]))
|
||||
keys[idx]->incr_refs();
|
||||
keys[idx]->incr_refs_all();
|
||||
}
|
||||
|
||||
if (without_merges)
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2011, Monty Program Ab.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -30,7 +31,7 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
We are handling signals in this file.
|
||||
We are handling signals/exceptions in this file.
|
||||
Any global variables we read should be 'volatile sig_atomic_t'
|
||||
to guarantee that we read some consistent value.
|
||||
*/
|
||||
@ -44,23 +45,27 @@ extern volatile sig_atomic_t ld_assume_kernel_is_set;
|
||||
extern const char *optimizer_switch_names[];
|
||||
|
||||
/**
|
||||
* Handler for fatal signals
|
||||
* Handler for fatal signals on POSIX, exception handler on Windows.
|
||||
*
|
||||
* Fatal events (seg.fault, bus error etc.) will trigger
|
||||
* this signal handler. The handler will try to dump relevant
|
||||
* debugging information to stderr and dump a core image.
|
||||
*
|
||||
* Signal handlers can only use a set of 'safe' system calls
|
||||
* and library functions. A list of safe calls in POSIX systems
|
||||
* POSIX : Signal handlers should, if possible, only use a set of 'safe' system
|
||||
* calls and library functions. A list of safe calls in POSIX systems
|
||||
* are available at:
|
||||
* http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html
|
||||
* For MS Windows, guidelines are available at:
|
||||
* http://msdn.microsoft.com/en-us/library/xdkz3x12(v=vs.71).aspx
|
||||
*
|
||||
* @param sig Signal number
|
||||
* @param sig Signal number /Exception code
|
||||
*/
|
||||
extern "C" sig_handler handle_fatal_signal(int sig)
|
||||
{
|
||||
time_t curr_time;
|
||||
struct tm tm;
|
||||
#ifdef HAVE_STACKTRACE
|
||||
THD *thd;
|
||||
#endif
|
||||
|
||||
if (segfaulted)
|
||||
{
|
||||
my_safe_printf_stderr("Fatal " SIGNAL_FMT " while backtracing\n", sig);
|
||||
@ -69,43 +74,40 @@ extern "C" sig_handler handle_fatal_signal(int sig)
|
||||
|
||||
segfaulted = 1;
|
||||
|
||||
#ifdef __WIN__
|
||||
SYSTEMTIME utc_time;
|
||||
GetSystemTime(&utc_time);
|
||||
const long hrs= utc_time.wHour;
|
||||
const long mins= utc_time.wMinute;
|
||||
const long secs= utc_time.wSecond;
|
||||
curr_time= my_time(0);
|
||||
localtime_r(&curr_time, &tm);
|
||||
|
||||
my_safe_printf_stderr("%02d%02d%02d %2d:%02d:%02d ",
|
||||
tm.tm_year % 100, tm.tm_mon+1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
if (opt_expect_abort
|
||||
#ifdef _WIN32
|
||||
&& sig == EXCEPTION_BREAKPOINT /* __debugbreak in my_sigabrt_hander() */
|
||||
#else
|
||||
/* Using time() instead of my_time() to avoid looping */
|
||||
const time_t curr_time= time(NULL);
|
||||
/* Calculate time of day */
|
||||
const long tmins = curr_time / 60;
|
||||
const long thrs = tmins / 60;
|
||||
const long hrs = thrs % 24;
|
||||
const long mins = tmins % 60;
|
||||
const long secs = curr_time % 60;
|
||||
&& sig == SIGABRT
|
||||
#endif
|
||||
)
|
||||
{
|
||||
fprintf(stderr,"[Note] mysqld did an expected abort\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
char hrs_buf[3]= "00";
|
||||
char mins_buf[3]= "00";
|
||||
char secs_buf[3]= "00";
|
||||
my_safe_itoa(10, hrs, &hrs_buf[2]);
|
||||
my_safe_itoa(10, mins, &mins_buf[2]);
|
||||
my_safe_itoa(10, secs, &secs_buf[2]);
|
||||
|
||||
my_safe_printf_stderr("%s:%s:%s UTC - mysqld got " SIGNAL_FMT " ;\n",
|
||||
hrs_buf, mins_buf, secs_buf, sig);
|
||||
my_safe_printf_stderr("[ERROR] mysqld got " SIGNAL_FMT " ;\n",sig);
|
||||
|
||||
my_safe_printf_stderr("%s",
|
||||
"This could be because you hit a bug. It is also possible that this binary\n"
|
||||
"or one of the libraries it was linked against is corrupt, improperly built,\n"
|
||||
"or misconfigured. This error can also be caused by malfunctioning hardware.\n");
|
||||
"or misconfigured. This error can also be caused by malfunctioning hardware.\n\n");
|
||||
|
||||
my_safe_printf_stderr("%s",
|
||||
"To report this bug, see http://kb.askmonty.org/en/reporting-bugs\n\n");
|
||||
|
||||
my_safe_printf_stderr("%s",
|
||||
"We will try our best to scrape up some info that will hopefully help\n"
|
||||
"diagnose the problem, but since we have already crashed, \n"
|
||||
"something is definitely wrong and this may fail.\n\n");
|
||||
|
||||
set_server_version();
|
||||
my_safe_printf_stderr("Server version: %s\n", server_version);
|
||||
|
||||
my_safe_printf_stderr("key_buffer_size=%lu\n",
|
||||
@ -153,7 +155,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
|
||||
#endif /* HAVE_LINUXTHREADS */
|
||||
|
||||
#ifdef HAVE_STACKTRACE
|
||||
THD *thd=current_thd;
|
||||
thd= current_thd;
|
||||
|
||||
if (opt_stack_trace)
|
||||
{
|
||||
@ -268,15 +270,19 @@ extern "C" sig_handler handle_fatal_signal(int sig)
|
||||
if (test_flags & TEST_CORE_ON_SIGNAL)
|
||||
{
|
||||
my_safe_printf_stderr("%s", "Writing a core file\n");
|
||||
fflush(stderr);
|
||||
my_write_core(sig);
|
||||
}
|
||||
#endif
|
||||
|
||||
end:
|
||||
#ifndef __WIN__
|
||||
/*
|
||||
Quit, without running destructors (etc.)
|
||||
On Windows, do not terminate, but pass control to exception filter.
|
||||
*/
|
||||
_exit(1); // Using _exit(), since exit() is not async signal safe
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
@ -602,6 +602,8 @@ typedef struct system_status_var
|
||||
ulong ha_tmp_update_count;
|
||||
ulong ha_tmp_write_count;
|
||||
ulong ha_prepare_count;
|
||||
ulong ha_pushed_index_cond_checks;
|
||||
ulong ha_pushed_index_cond_filtered;
|
||||
ulong ha_discover_count;
|
||||
ulong ha_savepoint_count;
|
||||
ulong ha_savepoint_rollback_count;
|
||||
|
@ -2577,6 +2577,15 @@ void JOIN_CACHE::print_explain_comment(String *str)
|
||||
str->append(STRING_WITH_LEN(")"));
|
||||
}
|
||||
|
||||
/**
|
||||
get thread handle.
|
||||
*/
|
||||
|
||||
THD *JOIN_CACHE::thd()
|
||||
{
|
||||
return join->thd;
|
||||
}
|
||||
|
||||
|
||||
static void add_mrr_explain_info(String *str, uint mrr_mode, handler *file)
|
||||
{
|
||||
@ -4016,7 +4025,11 @@ bool bka_skip_index_tuple(range_seq_t rseq, range_id_t range_info)
|
||||
{
|
||||
DBUG_ENTER("bka_skip_index_tuple");
|
||||
JOIN_CACHE_BKA *cache= (JOIN_CACHE_BKA *) rseq;
|
||||
bool res= cache->skip_index_tuple(range_info);
|
||||
THD *thd= cache->thd();
|
||||
bool res;
|
||||
status_var_increment(thd->status_var.ha_pushed_index_cond_checks);
|
||||
if ((res= cache->skip_index_tuple(range_info)))
|
||||
status_var_increment(thd->status_var.ha_pushed_index_cond_filtered);
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
@ -4491,7 +4504,12 @@ bool bkah_skip_index_tuple(range_seq_t rseq, range_id_t range_info)
|
||||
{
|
||||
DBUG_ENTER("bka_unique_skip_index_tuple");
|
||||
JOIN_CACHE_BKAH *cache= (JOIN_CACHE_BKAH *) rseq;
|
||||
DBUG_RETURN(cache->skip_index_tuple(range_info));
|
||||
THD *thd= cache->thd();
|
||||
bool res;
|
||||
status_var_increment(thd->status_var.ha_pushed_index_cond_checks);
|
||||
if ((res= cache->skip_index_tuple(range_info)))
|
||||
status_var_increment(thd->status_var.ha_pushed_index_cond_filtered);
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
|
||||
|
@ -659,6 +659,8 @@ public:
|
||||
/* Add a comment on the join algorithm employed by the join cache */
|
||||
virtual void print_explain_comment(String *str);
|
||||
|
||||
THD *thd();
|
||||
|
||||
virtual ~JOIN_CACHE() {}
|
||||
void reset_join(JOIN *j) { join= j; }
|
||||
void free()
|
||||
|
@ -260,7 +260,12 @@ public:
|
||||
last= &first;
|
||||
return tmp->info;
|
||||
}
|
||||
inline void disjoin(base_list *list)
|
||||
/*
|
||||
Remove from this list elements that are contained in the passed list.
|
||||
We assume that the passed list is a tail of this list (that is, the whole
|
||||
list_node* elements are shared).
|
||||
*/
|
||||
inline void disjoin(const base_list *list)
|
||||
{
|
||||
list_node **prev= &first;
|
||||
list_node *node= first;
|
||||
|
@ -1295,9 +1295,20 @@ JOIN::optimize()
|
||||
Item *ref_item= *ref_item_ptr;
|
||||
if (!ref_item->used_tables() && !(select_options & SELECT_DESCRIBE))
|
||||
continue;
|
||||
COND_EQUAL *equals= tab->first_inner ? tab->first_inner->cond_equal :
|
||||
cond_equal;
|
||||
ref_item= substitute_for_best_equal_field(tab, ref_item, equals, map2table);
|
||||
COND_EQUAL *equals= cond_equal;
|
||||
JOIN_TAB *first_inner= tab->first_inner;
|
||||
while (equals)
|
||||
{
|
||||
ref_item= substitute_for_best_equal_field(tab, ref_item,
|
||||
equals, map2table);
|
||||
if (first_inner)
|
||||
{
|
||||
equals= first_inner->cond_equal;
|
||||
first_inner= first_inner->first_upper;
|
||||
}
|
||||
else
|
||||
equals= 0;
|
||||
}
|
||||
ref_item->update_used_tables();
|
||||
if (*ref_item_ptr != ref_item)
|
||||
{
|
||||
@ -9311,7 +9322,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
|
||||
Check whether table tab and the previous one belong to the same nest of
|
||||
inner tables and if so do not use join buffer when joining table tab.
|
||||
*/
|
||||
if (tab->first_inner)
|
||||
if (tab->first_inner && tab != tab->first_inner)
|
||||
{
|
||||
for (JOIN_TAB *first_inner= tab[-1].first_inner;
|
||||
first_inner;
|
||||
@ -9321,7 +9332,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
|
||||
goto no_join_cache;
|
||||
}
|
||||
}
|
||||
else if (tab->first_sj_inner_tab &&
|
||||
else if (tab->first_sj_inner_tab && tab != tab->first_sj_inner_tab &&
|
||||
tab->first_sj_inner_tab == tab[-1].first_sj_inner_tab)
|
||||
goto no_join_cache;
|
||||
}
|
||||
@ -10569,10 +10580,22 @@ return_zero_rows(JOIN *join, select_result *result, List<TABLE_LIST> &tables,
|
||||
|
||||
if (send_row)
|
||||
{
|
||||
/*
|
||||
Set all tables to have NULL row. This is needed as we will be evaluating
|
||||
HAVING condition.
|
||||
*/
|
||||
List_iterator<TABLE_LIST> ti(tables);
|
||||
TABLE_LIST *table;
|
||||
while ((table= ti++))
|
||||
mark_as_null_row(table->table); // All fields are NULL
|
||||
{
|
||||
/*
|
||||
Don't touch semi-join materialization tables, as the above join_free()
|
||||
call has freed them (and HAVING clause can't have references to them
|
||||
anyway).
|
||||
*/
|
||||
if (!table->is_jtbm())
|
||||
mark_as_null_row(table->table); // All fields are NULL
|
||||
}
|
||||
if (having &&
|
||||
!having->walk(&Item::clear_sum_processor, FALSE, NULL) &&
|
||||
having->val_int() == 0)
|
||||
@ -12819,9 +12842,8 @@ optimize_cond(JOIN *join, COND *conds, List<TABLE_LIST> *join_list,
|
||||
multiple equality contains a constant.
|
||||
*/
|
||||
DBUG_EXECUTE("where", print_where(conds, "original", QT_ORDINARY););
|
||||
conds= build_equal_items(join->thd, conds, NULL, join_list,
|
||||
&join->cond_equal);
|
||||
DBUG_EXECUTE("where",print_where(conds,"after equal_items", QT_ORDINARY););
|
||||
conds= build_equal_items(join->thd, conds, NULL, join_list, cond_equal);
|
||||
DBUG_EXECUTE("where",print_where(conds,"after equal_items", QT_ORDINARY););
|
||||
|
||||
/* change field = field to field = const for each found field = const */
|
||||
propagate_cond_constants(thd, (I_List<COND_CMP> *) 0, conds, conds);
|
||||
|
@ -1187,17 +1187,6 @@ int ha_archive::unpack_row(azio_stream *file_to_read, uchar *record)
|
||||
|
||||
/* Copy null bits */
|
||||
const uchar *ptr= record_buffer->buffer;
|
||||
/*
|
||||
Field::unpack() is not called when field is NULL. For VARCHAR
|
||||
Field::unpack() only unpacks as much bytes as occupied by field
|
||||
value. In these cases respective memory area on record buffer is
|
||||
not initialized.
|
||||
|
||||
These uninitialized areas may be accessed by CHECKSUM TABLE or
|
||||
by optimizer using temporary table (BUG#12997905). We may remove
|
||||
this memset() when they're fixed.
|
||||
*/
|
||||
memset(record, 0, table->s->reclength);
|
||||
memcpy(record, ptr, table->s->null_bytes);
|
||||
ptr+= table->s->null_bytes;
|
||||
for (Field **field=table->field ; *field ; field++)
|
||||
|
@ -2208,21 +2208,6 @@ int ha_maria::delete_row(const uchar * buf)
|
||||
return maria_delete(file, buf);
|
||||
}
|
||||
|
||||
C_MODE_START
|
||||
|
||||
ICP_RESULT index_cond_func_maria(void *arg)
|
||||
{
|
||||
ha_maria *h= (ha_maria*)arg;
|
||||
if (h->end_range)
|
||||
{
|
||||
if (h->compare_key2(h->end_range) > 0)
|
||||
return ICP_OUT_OF_RANGE; /* caller should return HA_ERR_END_OF_FILE already */
|
||||
}
|
||||
return h->pushed_idx_cond->val_int() ? ICP_MATCH : ICP_NO_MATCH;
|
||||
}
|
||||
|
||||
C_MODE_END
|
||||
|
||||
int ha_maria::index_read_map(uchar * buf, const uchar * key,
|
||||
key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag)
|
||||
@ -2242,7 +2227,7 @@ int ha_maria::index_read_idx_map(uchar * buf, uint index, const uchar * key,
|
||||
/* Use the pushed index condition if it matches the index we're scanning */
|
||||
end_range= NULL;
|
||||
if (index == pushed_idx_cond_keyno)
|
||||
ma_set_index_cond_func(file, index_cond_func_maria, this);
|
||||
ma_set_index_cond_func(file, handler_index_cond_check, this);
|
||||
|
||||
error= maria_rkey(file, buf, index, key, keypart_map, find_flag);
|
||||
|
||||
@ -2323,7 +2308,7 @@ int ha_maria::index_init(uint idx, bool sorted)
|
||||
{
|
||||
active_index=idx;
|
||||
if (pushed_idx_cond_keyno == idx)
|
||||
ma_set_index_cond_func(file, index_cond_func_maria, this);
|
||||
ma_set_index_cond_func(file, handler_index_cond_check, this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3754,7 +3739,7 @@ Item *ha_maria::idx_cond_push(uint keyno_arg, Item* idx_cond_arg)
|
||||
pushed_idx_cond= idx_cond_arg;
|
||||
in_range_check_pushed_down= TRUE;
|
||||
if (active_index == pushed_idx_cond_keyno)
|
||||
ma_set_index_cond_func(file, index_cond_func_maria, this);
|
||||
ma_set_index_cond_func(file, handler_index_cond_check, this);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -913,6 +913,9 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon)
|
||||
*/
|
||||
}
|
||||
translog_unlock();
|
||||
if (state_copy == state_copies)
|
||||
break; /* Nothing to do */
|
||||
|
||||
/**
|
||||
We are going to flush these states.
|
||||
Before, all records describing how to undo such state must be
|
||||
@ -937,13 +940,13 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon)
|
||||
if (translog_flush(state_copies_horizon))
|
||||
goto err;
|
||||
/* now we have cached states and they are WAL-safe*/
|
||||
state_copies_end= state_copy;
|
||||
state_copies_end= state_copy-1;
|
||||
state_copy= state_copies;
|
||||
}
|
||||
|
||||
/* locate our state among these cached ones */
|
||||
for ( ; state_copy->index != i; state_copy++)
|
||||
DBUG_ASSERT(state_copy < state_copies_end);
|
||||
DBUG_ASSERT(state_copy <= state_copies_end);
|
||||
|
||||
/* OS file descriptors are ints which we stored in 4 bytes */
|
||||
compile_time_assert(sizeof(int) <= 4);
|
||||
|
@ -1645,27 +1645,11 @@ int ha_myisam::delete_row(const uchar *buf)
|
||||
}
|
||||
|
||||
|
||||
C_MODE_START
|
||||
|
||||
ICP_RESULT index_cond_func_myisam(void *arg)
|
||||
{
|
||||
ha_myisam *h= (ha_myisam*)arg;
|
||||
if (h->end_range)
|
||||
{
|
||||
if (h->compare_key2(h->end_range) > 0)
|
||||
return ICP_OUT_OF_RANGE; /* caller should return HA_ERR_END_OF_FILE already */
|
||||
}
|
||||
return (ICP_RESULT) test(h->pushed_idx_cond->val_int());
|
||||
}
|
||||
|
||||
C_MODE_END
|
||||
|
||||
|
||||
int ha_myisam::index_init(uint idx, bool sorted)
|
||||
{
|
||||
active_index=idx;
|
||||
if (pushed_idx_cond_keyno == idx)
|
||||
mi_set_index_cond_func(file, index_cond_func_myisam, this);
|
||||
mi_set_index_cond_func(file, handler_index_cond_check, this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1711,7 +1695,7 @@ int ha_myisam::index_read_idx_map(uchar *buf, uint index, const uchar *key,
|
||||
/* Use the pushed index condition if it matches the index we're scanning */
|
||||
end_range= NULL;
|
||||
if (index == pushed_idx_cond_keyno)
|
||||
mi_set_index_cond_func(file, index_cond_func_myisam, this);
|
||||
mi_set_index_cond_func(file, handler_index_cond_check, this);
|
||||
res= mi_rkey(file, buf, index, key, keypart_map, find_flag);
|
||||
mi_set_index_cond_func(file, NULL, 0);
|
||||
return res;
|
||||
@ -2267,7 +2251,7 @@ Item *ha_myisam::idx_cond_push(uint keyno_arg, Item* idx_cond_arg)
|
||||
pushed_idx_cond= idx_cond_arg;
|
||||
in_range_check_pushed_down= TRUE;
|
||||
if (active_index == pushed_idx_cond_keyno)
|
||||
mi_set_index_cond_func(file, index_cond_func_myisam, this);
|
||||
mi_set_index_cond_func(file, handler_index_cond_check, this);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,11 @@ int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key,
|
||||
mi_yield_and_check_if_killed(info, inx))
|
||||
{
|
||||
/* Aborted by user */
|
||||
DBUG_ASSERT(info->lastpos == HA_OFFSET_ERROR &&
|
||||
my_errno == HA_ERR_ABORTED_BY_USER);
|
||||
res= ICP_ERROR;
|
||||
buf= 0; /* Fast abort */
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (res == ICP_OUT_OF_RANGE)
|
||||
@ -180,7 +184,7 @@ int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key,
|
||||
}
|
||||
else
|
||||
{
|
||||
DBUG_ASSERT(info->lastpos= HA_OFFSET_ERROR);
|
||||
DBUG_ASSERT(info->lastpos == HA_OFFSET_ERROR);
|
||||
}
|
||||
}
|
||||
if (share->concurrent_insert)
|
||||
|
@ -13066,28 +13066,6 @@ bool ha_innobase::is_thd_killed()
|
||||
* Index Condition Pushdown interface implementation
|
||||
*/
|
||||
|
||||
/*************************************************************//**
|
||||
InnoDB index push-down condition check
|
||||
@return ICP_NO_MATCH, ICP_MATCH, or ICP_OUT_OF_RANGE */
|
||||
extern "C" UNIV_INTERN
|
||||
enum icp_result
|
||||
innobase_index_cond(
|
||||
/*================*/
|
||||
void* file) /*!< in/out: pointer to ha_innobase */
|
||||
{
|
||||
ha_innobase *h= (ha_innobase*) file;
|
||||
|
||||
if (h->is_thd_killed())
|
||||
return ICP_ABORTED_BY_USER;
|
||||
|
||||
if (h->end_range)
|
||||
{
|
||||
if (h->compare_key2(h->end_range) > 0)
|
||||
return ICP_OUT_OF_RANGE; /* caller should return HA_ERR_END_OF_FILE already */
|
||||
}
|
||||
return h->pushed_idx_cond->val_int()? ICP_MATCH : ICP_NO_MATCH;
|
||||
}
|
||||
|
||||
/** Attempt to push down an index condition.
|
||||
* @param[in] keyno MySQL key number
|
||||
* @param[in] idx_cond Index condition to be checked
|
||||
|
@ -227,6 +227,7 @@ class ha_innobase: public handler
|
||||
bool check_if_incompatible_data(HA_CREATE_INFO *info,
|
||||
uint table_changes);
|
||||
bool check_if_supported_virtual_columns(void) { return TRUE; }
|
||||
|
||||
private:
|
||||
/** Builds a 'template' to the prebuilt struct.
|
||||
|
||||
|
@ -259,9 +259,8 @@ innobase_get_at_most_n_mbchars(
|
||||
/*************************************************************//**
|
||||
InnoDB index push-down condition check
|
||||
@return ICP_NO_MATCH, ICP_MATCH, or ICP_OUT_OF_RANGE */
|
||||
UNIV_INTERN
|
||||
enum icp_result
|
||||
innobase_index_cond(
|
||||
handler_index_cond_check(
|
||||
/*================*/
|
||||
void* file) /*!< in/out: pointer to ha_innobase */
|
||||
__attribute__((nonnull, warn_unused_result));
|
||||
|
@ -3447,7 +3447,7 @@ row_search_idx_cond_check(
|
||||
index, if the case of the column has been updated in
|
||||
the past, or a record has been deleted and a record
|
||||
inserted in a different case. */
|
||||
result = innobase_index_cond(prebuilt->idx_cond);
|
||||
result = handler_index_cond_check(prebuilt->idx_cond);
|
||||
switch (result) {
|
||||
case ICP_MATCH:
|
||||
/* Convert the remaining fields to MySQL format.
|
||||
|
Loading…
x
Reference in New Issue
Block a user