Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä 2020-01-20 16:48:56 +02:00
commit ded128aa9b
295 changed files with 4823 additions and 1062 deletions

View File

@ -94,6 +94,9 @@ EOF
chmod 2750 $mysql_logdir
set -e
# Set the correct filesystem ownership for the PAM v2 plugin
chown mysql /usr/lib/mysql/plugin/auth_pam_tool_dir
# This is important to avoid dataloss when there is a removed
# mysql-server version from Woody lying around which used the same
# data directory and then somewhen gets purged by the admin.

4
debian/rules vendored
View File

@ -146,6 +146,10 @@ endif
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.19
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.20
override_dh_fixperms:
dh_fixperms
chmod 04755 debian/mariadb-server-10.4/usr/lib/mysql/plugin/auth_pam_tool_dir/auth_pam_tool
chmod 0700 debian/mariadb-server-10.4/usr/lib/mysql/plugin/auth_pam_tool_dir
override_dh_installlogrotate-arch:
dh_installlogrotate --name mysql-server

View File

@ -13,10 +13,10 @@
# let query= 'CREATE TABLE t1 (a INT)';
# source include/binlog_inject_error.inc;
#
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
--echo $query;
--replace_regex /(errno: .*)/(errno: #)/
--error ER_ERROR_ON_WRITE
--eval $query
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;

View File

@ -1,13 +1,12 @@
create table t1 (a date);
insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04');
set debug_dbug='d,str_to_datetime_warn';
SET STATEMENT debug_dbug='d,str_to_datetime_warn' for
select * from t1 where a > date_add('2000-01-01', interval 5 day);
a
2001-02-03
2002-03-04
Warnings:
Note 1003 2000-01-01
set debug_dbug='';
drop table t1;
create table t1 (id int not null, ut timestamp(6) not null);
insert into t1 values(1, '2001-01-01 00:00:00.2');

View File

@ -5,9 +5,9 @@
create table t1 (a date);
insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04');
set debug_dbug='d,str_to_datetime_warn';
select * from t1 where a > date_add('2000-01-01', interval 5 day);
set debug_dbug='';
SET STATEMENT debug_dbug='d,str_to_datetime_warn' for
select * from t1 where a > date_add('2000-01-01', interval 5 day);
drop table t1;
#

View File

@ -4,9 +4,9 @@ drop table if exists t1;
SET @old_debug= @@session.debug;
CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB;
CREATE OR REPLACE TEMPORARY TABLE tmp (a int, b int, key(a)) engine=myisam;
set debug_dbug='+d,send_kill_after_delete';
SET debug_dbug='+d,send_kill_after_delete';
CREATE OR REPLACE TABLE t1 LIKE tmp;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
SHOW TABLES;
Tables_in_test
t1

View File

@ -19,9 +19,9 @@ SET @old_debug= @@session.debug;
CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB;
CREATE OR REPLACE TEMPORARY TABLE tmp (a int, b int, key(a)) engine=myisam;
set debug_dbug='+d,send_kill_after_delete';
SET debug_dbug='+d,send_kill_after_delete';
CREATE OR REPLACE TABLE t1 LIKE tmp;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
SHOW TABLES;
show create table t1;
--sync_slave_with_master

View File

@ -8937,13 +8937,13 @@ EXPLAIN
"materialized": {
"query_block": {
"select_id": 2,
"having_condition": "t1.b = 1 and max_c > 37 and max_c > 30",
"having_condition": "max_c > 37 and max_c > 30",
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "t1.a = 1"
"attached_condition": "t1.a = 1 and t1.b = 1"
}
}
}
@ -9012,13 +9012,13 @@ EXPLAIN
"materialized": {
"query_block": {
"select_id": 2,
"having_condition": "t1.b = 1 and max_c > 37 and max_c > 30",
"having_condition": "max_c > 37 and max_c > 30",
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "t1.a = 1 and t1.d = 1"
"attached_condition": "t1.a = 1 and t1.b = 1 and t1.d = 1"
}
}
}

View File

@ -1,5 +1,5 @@
SET @save_dbug = @@debug_dbug;
set debug_dbug='+d,unstable_db_type';
SET @saved_dbug = @@debug_dbug;
SET debug_dbug='+d,unstable_db_type';
install soname 'ha_archive';
create table t1 (a int) engine=archive;
insert t1 values (1),(2),(3);
@ -33,4 +33,4 @@ t1.frm
drop table t1;
db.opt
uninstall soname 'ha_archive';
set debug_dbug=@save_dbug;
SET debug_dbug=@saved_dbug;

View File

@ -7,8 +7,8 @@ if (!$HA_ARCHIVE_SO) {
let $mysqld_datadir= `select @@datadir`;
SET @save_dbug = @@debug_dbug;
set debug_dbug='+d,unstable_db_type';
SET @saved_dbug = @@debug_dbug;
SET debug_dbug='+d,unstable_db_type';
install soname 'ha_archive';
create table t1 (a int) engine=archive;
@ -28,4 +28,4 @@ drop table t1;
--list_files $mysqld_datadir/test
uninstall soname 'ha_archive';
set debug_dbug=@save_dbug;
SET debug_dbug=@saved_dbug;

View File

@ -1,6 +1,7 @@
create table t1 (a int, b int);
set debug_dbug='+d,external_lock_failure';
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,external_lock_failure';
alter table t1 add column c int;
ERROR HY000: Got error 168 'KABOOM!' from MyISAM
set debug_dbug='';
SET debug_dbug= @saved_dbug;
drop table t1;

View File

@ -4,8 +4,9 @@
--source include/have_debug.inc
create table t1 (a int, b int);
set debug_dbug='+d,external_lock_failure';
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,external_lock_failure';
--error ER_GET_ERRMSG
alter table t1 add column c int;
set debug_dbug='';
SET debug_dbug= @saved_dbug;
drop table t1;

View File

@ -10,6 +10,7 @@ INSERT INTO t1 VALUES
('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'),
('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK');
set tmp_table_size=1024;
SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,raise_error";
SELECT MAX(a) FROM t1 GROUP BY a,b;
ERROR 23000: Can't write; duplicate key in table '(temporary)'
@ -22,7 +23,7 @@ CREATE TABLE t1 (a INT(100) NOT NULL);
INSERT INTO t1 VALUES (1), (0), (2);
SET SESSION debug_dbug='+d,alter_table_only_index_change';
ALTER TABLE t1 ADD INDEX a(a);
SET SESSION debug_dbug=DEFAULT;
SET debug_dbug= @saved_dbug;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -42,7 +43,7 @@ CREATE TABLE t1(a BLOB);
SET SESSION debug_dbug="+d,bug42064_simulate_oom";
INSERT INTO t1 VALUES("");
Got one of the listed errors
SET SESSION debug_dbug=DEFAULT;
SET debug_dbug= @saved_dbug;
DROP TABLE t1;
#
# Bug#41660: Sort-index_merge for non-first join table may require
@ -79,7 +80,7 @@ a a b filler
7 1 1 data
8 1 1 data
9 1 1 data
SET SESSION debug_dbug= DEFAULT;
SET debug_dbug= @saved_dbug;
SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1, t2;
#
@ -92,7 +93,7 @@ INSERT INTO t2 VALUES (1),(2);
SET SESSION debug_dbug="+d,bug11747970_raise_error";
INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
ERROR 70100: Query execution was interrupted
SET SESSION debug_dbug = DEFAULT;
SET debug_dbug= @saved_dbug;
DROP TABLE t1,t2;
#
# End of 5.1 tests
@ -126,4 +127,4 @@ SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory";
SELECT f1(1);
Got one of the listed errors
DROP FUNCTION f1;
SET SESSION debug_dbug=DEFAULT;
SET debug_dbug= @saved_dbug;

View File

@ -21,6 +21,7 @@ set tmp_table_size=1024;
# Set debug flag so an error is returned when
# tmp table in query is converted from heap to myisam
SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,raise_error";
--error ER_DUP_KEY
@ -36,7 +37,7 @@ CREATE TABLE t1 (a INT(100) NOT NULL);
INSERT INTO t1 VALUES (1), (0), (2);
SET SESSION debug_dbug='+d,alter_table_only_index_change';
ALTER TABLE t1 ADD INDEX a(a);
SET SESSION debug_dbug=DEFAULT;
SET debug_dbug= @saved_dbug;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
@ -51,7 +52,7 @@ SET SESSION debug_dbug="+d,bug42064_simulate_oom";
# May fail with either ER_OUT_OF_RESOURCES or EE_OUTOFMEMORY
--error ER_OUT_OF_RESOURCES, 5
INSERT INTO t1 VALUES("");
SET SESSION debug_dbug=DEFAULT;
SET debug_dbug= @saved_dbug;
DROP TABLE t1;
@ -84,7 +85,7 @@ EXPLAIN
SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
SET SESSION debug_dbug= DEFAULT;
SET debug_dbug= @saved_dbug;
SET optimizer_switch=@save_optimizer_switch;
@ -101,7 +102,7 @@ INSERT INTO t2 VALUES (1),(2);
SET SESSION debug_dbug="+d,bug11747970_raise_error";
--error ER_QUERY_INTERRUPTED
INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
SET SESSION debug_dbug = DEFAULT;
SET debug_dbug= @saved_dbug;
DROP TABLE t1,t2;
@ -156,4 +157,4 @@ SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory";
--error ER_OUT_OF_RESOURCES, 5
SELECT f1(1);
DROP FUNCTION f1;
SET SESSION debug_dbug=DEFAULT;
SET debug_dbug= @saved_dbug;

View File

@ -2723,6 +2723,22 @@ t2 CREATE TABLE `t2` (
`c1` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (f float);
INSERT INTO t1 VALUES (3e38), (-3e38), (0), (12.34), (-12.34);
CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(f,0) FROM t1;
SELECT * FROM t2;
FORMAT(f,0)
300,000,000,549,775,580,000,000,000,000,000,000,000
-300,000,000,549,775,580,000,000,000,000,000,000,000
0
12
-12
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`FORMAT(f,0)` varchar(53) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
#
# End of 10.4 tests
#

View File

@ -1733,6 +1733,13 @@ SELECT HEX(c1) FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (f float);
INSERT INTO t1 VALUES (3e38), (-3e38), (0), (12.34), (-12.34);
CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(f,0) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1,t2;
--echo #
--echo # End of 10.4 tests
--echo #

View File

@ -1,10 +1,9 @@
SET debug_dbug='+d,pcre_exec_error_123';
SET STATEMENT debug_dbug='+d,pcre_exec_error_123' for
SELECT 'a' RLIKE 'a';
'a' RLIKE 'a'
0
Warnings:
Warning 1139 Regex error 'pcre_exec: Internal error (-123)'
SET debug_dbug='';
SELECT 'a' RLIKE 'a';
'a' RLIKE 'a'
1

View File

@ -1,6 +1,5 @@
--source include/have_debug.inc
SET debug_dbug='+d,pcre_exec_error_123';
SET STATEMENT debug_dbug='+d,pcre_exec_error_123' for
SELECT 'a' RLIKE 'a';
SET debug_dbug='';
SELECT 'a' RLIKE 'a';

View File

@ -2708,7 +2708,7 @@ create table t1(a float);
insert into t1 values (1.33);
select format(a, 2) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def format(a, 2) 253 4 4 Y 0 39 8
def format(a, 2) 253 56 4 Y 0 39 8
format(a, 2)
1.33
drop table t1;

View File

@ -4776,3 +4776,151 @@ WHERE t1.a = 3 AND (t1.a < 2 AND t1.b > 3) GROUP BY t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
DROP TABLE t1;
#
# MDEV-21184: Constant subquery in condition movable to WHERE
#
CREATE TABLE t1(a int, b int);
INSERT INTO t1 VALUES
(1,10), (2,20), (1,11), (1,15), (2,20), (1,10), (2,21);
CREATE TABLE t2 (c INT);
INSERT INTO t2 VALUES (2),(3);
EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a HAVING a = 8 OR a = ( SELECT MIN(c) FROM t2 );
EXPLAIN
{
"query_block": {
"select_id": 1,
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 7,
"filtered": 100,
"attached_condition": "t1.a = 8 or t1.a = (subquery#2)"
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
}
}
]
}
}
}
}
SELECT a FROM t1 GROUP BY a HAVING a = 8 OR a = ( SELECT MIN(c) FROM t2 );
a
2
EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a,b
HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and b < 20;
EXPLAIN
{
"query_block": {
"select_id": 1,
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 7,
"filtered": 100,
"attached_condition": "(t1.a = 8 or t1.a = (subquery#2)) and t1.b < 20"
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
}
}
]
}
}
}
}
SELECT a FROM t1 GROUP BY a,b
HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and b < 20;
a
EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a
HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and SUM(b) > 20;
EXPLAIN
{
"query_block": {
"select_id": 1,
"having_condition": "sum(t1.b) > 20",
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 7,
"filtered": 100,
"attached_condition": "t1.a = 8 or t1.a = (subquery#2)"
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
}
}
]
}
}
}
}
SELECT a FROM t1 GROUP BY a
HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and SUM(b) > 20;
a
2
EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a HAVING a = ( SELECT MIN(c) FROM t2 );
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 7,
"filtered": 100,
"attached_condition": "t1.a = (subquery#2)"
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
}
}
]
}
}
SELECT a FROM t1 GROUP BY a HAVING a = ( SELECT MIN(c) FROM t2 );
a
2
DROP TABLE t1,t2;

View File

@ -1401,3 +1401,42 @@ EXPLAIN SELECT t1.a,MAX(t1.b),t1.c FROM t1
WHERE t1.a = 3 AND (t1.a < 2 AND t1.b > 3) GROUP BY t1.a;
DROP TABLE t1;
--echo #
--echo # MDEV-21184: Constant subquery in condition movable to WHERE
--echo #
CREATE TABLE t1(a int, b int);
INSERT INTO t1 VALUES
(1,10), (2,20), (1,11), (1,15), (2,20), (1,10), (2,21);
CREATE TABLE t2 (c INT);
INSERT INTO t2 VALUES (2),(3);
let $q=
SELECT a FROM t1 GROUP BY a HAVING a = 8 OR a = ( SELECT MIN(c) FROM t2 );
eval EXPLAIN FORMAT=JSON $q;
eval $q;
let $q=
SELECT a FROM t1 GROUP BY a,b
HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and b < 20;
eval EXPLAIN FORMAT=JSON $q;
eval $q;
let $q=
SELECT a FROM t1 GROUP BY a
HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and SUM(b) > 20;
eval EXPLAIN FORMAT=JSON $q;
eval $q;
let $q=
SELECT a FROM t1 GROUP BY a HAVING a = ( SELECT MIN(c) FROM t2 );
eval EXPLAIN FORMAT=JSON $q;
eval $q;
DROP TABLE t1,t2;

View File

@ -6067,6 +6067,79 @@ select f2 from t2,t1 where f2 = 0;
f2
drop table t1, t2;
set join_buffer_size=@save_join_buffer_size;
#
# MDEV-21243: Join buffer: condition is checked in wrong place for range access
#
create table t1(a int primary key);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int);
insert into t2 select A.a + 10*B.a from t1 A, t1 B;
create table t3 (
kp1 int,
kp2 int,
col1 int,
col2 int,
key (kp1, kp2)
);
insert into t3
select
A.a,
B.a,
A.a + 100*B.a,
A.a + 100*B.a
from
t2 A, t2 B;
analyze table t3;
Table Op Msg_type Msg_text
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
# The following must have "B.col1 + 1 < 33333" attached to table B
# and not to the block-nl-join node:
explain format=json
select *
from t1 a, t3 b
where
b.kp1=a.a and
b.kp1 <= 10 and
b.kp2 <= 10 and
b.col1 +1 < 33333;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "a",
"access_type": "index",
"possible_keys": ["PRIMARY"],
"key": "PRIMARY",
"key_length": "4",
"used_key_parts": ["a"],
"rows": 10,
"filtered": 100,
"attached_condition": "a.a <= 10",
"using_index": true
},
"block-nl-join": {
"table": {
"table_name": "b",
"access_type": "range",
"possible_keys": ["kp1"],
"key": "kp1",
"key_length": "10",
"used_key_parts": ["kp1", "kp2"],
"rows": 836,
"filtered": 76.434,
"index_condition": "b.kp2 <= 10",
"attached_condition": "b.kp2 <= 10 and b.col1 + 1 < 33333"
},
"buffer_type": "flat",
"buffer_size": "54",
"join_type": "BNL",
"attached_condition": "b.kp1 = a.a"
}
}
}
drop table t1,t2,t3;
set @@optimizer_switch=@save_optimizer_switch;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=

View File

@ -4068,6 +4068,46 @@ select f2 from t2,t1 where f2 = 0;
drop table t1, t2;
set join_buffer_size=@save_join_buffer_size;
--echo #
--echo # MDEV-21243: Join buffer: condition is checked in wrong place for range access
--echo #
create table t1(a int primary key);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int);
insert into t2 select A.a + 10*B.a from t1 A, t1 B;
create table t3 (
kp1 int,
kp2 int,
col1 int,
col2 int,
key (kp1, kp2)
);
insert into t3
select
A.a,
B.a,
A.a + 100*B.a,
A.a + 100*B.a
from
t2 A, t2 B;
analyze table t3;
--echo # The following must have "B.col1 + 1 < 33333" attached to table B
--echo # and not to the block-nl-join node:
explain format=json
select *
from t1 a, t3 b
where
b.kp1=a.a and
b.kp1 <= 10 and
b.kp2 <= 10 and
b.col1 +1 < 33333;
drop table t1,t2,t3;
# The following command must be the last one in the file
set @@optimizer_switch=@save_optimizer_switch;

View File

@ -6,7 +6,7 @@ SET @@GLOBAL.log_output='TABLE';
FLUSH SLOW LOGS;
SET @@GLOBAL.slow_query_log=ON;
SET @@GLOBAL.log_slow_admin_statements=ON;
SET @save_dbug = @@debug_dbug;
SET @saved_dbug = @@debug_dbug;
SET SESSION debug_dbug="+d,simulate_slow_query";
CREATE PROCEDURE show_slow_log()
BEGIN
@ -218,7 +218,7 @@ sql_text
#
# Clean up
#
SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug=@saved_dbug;
TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;

View File

@ -9,7 +9,7 @@ SET @@GLOBAL.log_output='TABLE';
FLUSH SLOW LOGS;
SET @@GLOBAL.slow_query_log=ON;
SET @@GLOBAL.log_slow_admin_statements=ON;
SET @save_dbug = @@debug_dbug;
SET @saved_dbug = @@debug_dbug;
SET SESSION debug_dbug="+d,simulate_slow_query";
DELIMITER $$;
@ -87,7 +87,7 @@ CALL show_slow_log();
--echo # Clean up
--echo #
SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug=@saved_dbug;
TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;

View File

@ -1,3 +1,4 @@
SET @saved_dbug = @@SESSION.debug_dbug;
set @@debug_dbug= 'd,opt';
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t2 (
@ -46,3 +47,4 @@ SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5;
pk f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f1 f2
drop table t1,t2,t3,t4;
drop view v2,v3;
SET debug_dbug= @saved_dbug;

View File

@ -2,7 +2,7 @@
# MDEV-6830 Server crashes in best_access_path after a sequence of SELECTs invollving a temptable view
#
--source include/have_debug.inc
SET @saved_dbug = @@SESSION.debug_dbug;
set @@debug_dbug= 'd,opt';
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM;
@ -60,4 +60,4 @@ SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5;
drop table t1,t2,t3,t4;
drop view v2,v3;
SET debug_dbug= @saved_dbug;

View File

@ -7,7 +7,7 @@ drop table if exists t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
LOCK TABLE t1 WRITE;
connect con1,localhost,root,,;
SET @orig_debug=@@debug;
SET @orig_debug=@@global.debug_dbug;
SET GLOBAL debug_dbug="+d,sleep_open_and_lock_after_open";
INSERT INTO t1 VALUES (1);
connection default;

View File

@ -42,7 +42,7 @@ LOCK TABLE t1 WRITE;
#SELECT NOW();
connect (con1,localhost,root,,);
let $con1_id= `SELECT CONNECTION_ID()`;
SET @orig_debug=@@debug;
SET @orig_debug=@@global.debug_dbug;
SET GLOBAL debug_dbug="+d,sleep_open_and_lock_after_open";
send INSERT INTO t1 VALUES (1);
connection default;

View File

@ -3,7 +3,7 @@ set global storage_engine=myisam;
set session storage_engine=myisam;
call mtr.add_suppression("Index for table .*crashed' is corrupt; try to repair it");
drop table if exists crashed,t2,t3,t4;
SET @orig_debug=@@debug;
SET @orig_debug=@@global.debug_dbug;
CREATE TABLE crashed (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TABLE t3 (c1 INT);

View File

@ -14,7 +14,7 @@ call mtr.add_suppression("Index for table .*crashed' is corrupt; try to repair i
drop table if exists crashed,t2,t3,t4;
--enable_warnings
SET @orig_debug=@@debug;
SET @orig_debug=@@global.debug_dbug;
#
# Check that MariaDB handles reopen that fails without crashing

View File

@ -36,10 +36,10 @@ create table t1 (a int, index(a));
lock tables t1 write;
insert t1 values (1),(2),(1);
set @old_dbug=@@debug_dbug;
set debug_dbug='+d,mi_lock_database_failure';
SET debug_dbug='+d,mi_lock_database_failure';
unlock tables;
Warnings:
Error 126 Index for table './test/t1.MYI' is corrupt; try to repair it
Error 1030 Got error 22 "Invalid argument" from storage engine MyISAM
set debug_dbug=@old_dbug;
SET debug_dbug=@old_dbug;
drop table t1;

View File

@ -66,7 +66,7 @@ create table t1 (a int, index(a));
lock tables t1 write;
insert t1 values (1),(2),(1);
set @old_dbug=@@debug_dbug;
set debug_dbug='+d,mi_lock_database_failure';
SET debug_dbug='+d,mi_lock_database_failure';
unlock tables;
set debug_dbug=@old_dbug;
SET debug_dbug=@old_dbug;
drop table t1;

View File

@ -71,6 +71,7 @@ key(a),key(b),key(c)
insert into t1
select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a
from t0 A, t0 B, t0 C, t0 D where D.a<5;
SET @saved_dbug = @@GLOBAL.debug_dbug;
set @@global.debug_dbug="+d,ha_index_init_fail";
explain select * from t1 where a=10 and b=10;
id select_type table type possible_keys key key_len ref rows Extra
@ -78,7 +79,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select * from t1 where a=10 and b=10;
ERROR HY000: Table definition has changed, please retry transaction
DROP TABLE t0,t1;
set @@global.debug_dbug="-d";
SET @@GLOBAL.debug_dbug = @saved_dbug;
set @@optimizer_switch= @optimizer_switch_save;
#
# MDEV-19634: Assertion `0' failed in row_sel_convert_mysql_key_to_innobase,

View File

@ -80,12 +80,13 @@ create table t1 (
insert into t1
select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a
from t0 A, t0 B, t0 C, t0 D where D.a<5;
SET @saved_dbug = @@GLOBAL.debug_dbug;
set @@global.debug_dbug="+d,ha_index_init_fail";
explain select * from t1 where a=10 and b=10;
--error ER_TABLE_DEF_CHANGED
select * from t1 where a=10 and b=10;
DROP TABLE t0,t1;
set @@global.debug_dbug="-d";
SET @@GLOBAL.debug_dbug = @saved_dbug;
set @@optimizer_switch= @optimizer_switch_save;
--echo #

View File

@ -7,10 +7,10 @@ INSERT INTO t1 (c) SELECT c FROM t1;
INSERT INTO t1 (c) SELECT c FROM t1;
INSERT INTO t1 (c) SELECT c FROM t1;
set @old_dbug=@@session.debug_dbug;
set debug_dbug="+d,kill_join_init_read_record";
SET debug_dbug="+d,kill_join_init_read_record";
SELECT 1 FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
WHERE alias1.c = alias2.c OR alias1.i <= 1
;
ERROR 70100: Query execution was interrupted
set debug_dbug=@old_dbug;
SET debug_dbug=@old_dbug;
DROP TABLE t1;

View File

@ -14,14 +14,14 @@ INSERT INTO t1 (c) SELECT c FROM t1;
INSERT INTO t1 (c) SELECT c FROM t1;
set @old_dbug=@@session.debug_dbug;
set debug_dbug="+d,kill_join_init_read_record";
SET debug_dbug="+d,kill_join_init_read_record";
--error ER_QUERY_INTERRUPTED
SELECT 1 FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
WHERE alias1.c = alias2.c OR alias1.i <= 1
;
set debug_dbug=@old_dbug;
SET debug_dbug=@old_dbug;
DROP TABLE t1;

View File

@ -2381,3 +2381,170 @@ count(0)
0
drop table t1;
set global innodb_stats_persistent= @stats.save;
#
# MDEV-21356: usage of range filter with range access employing
# optimizer_switch='mrr=on,mrr_sort_keys=on';
#
CREATE TABLE t1 (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
domain varchar(255) NOT NULL,
registrant_name varchar(255) DEFAULT NULL,
registrant_organization varchar(255) DEFAULT NULL,
registrant_street1 varchar(255) DEFAULT NULL,
registrant_street2 varchar(255) DEFAULT NULL,
registrant_street3 varchar(255) DEFAULT NULL,
registrant_street4 varchar(255) DEFAULT NULL,
registrant_street5 varchar(255) DEFAULT NULL,
registrant_city varchar(255) DEFAULT NULL,
registrant_postal_code varchar(255) DEFAULT NULL,
registrant_country varchar(255) DEFAULT NULL,
registrant_email varchar(255) DEFAULT NULL,
registrant_telephone varchar(255) DEFAULT NULL,
administrative_name varchar(255) DEFAULT NULL,
administrative_organization varchar(255) DEFAULT NULL,
administrative_street1 varchar(255) DEFAULT NULL,
administrative_street2 varchar(255) DEFAULT NULL,
administrative_street3 varchar(255) DEFAULT NULL,
administrative_street4 varchar(255) DEFAULT NULL,
administrative_street5 varchar(255) DEFAULT NULL,
administrative_city varchar(255) DEFAULT NULL,
administrative_postal_code varchar(255) DEFAULT NULL,
administrative_country varchar(255) DEFAULT NULL,
administrative_email varchar(255) DEFAULT NULL,
administrative_telephone varchar(255) DEFAULT NULL,
technical_name varchar(255) DEFAULT NULL,
technical_organization varchar(255) DEFAULT NULL,
technical_street1 varchar(255) DEFAULT NULL,
technical_street2 varchar(255) DEFAULT NULL,
technical_street3 varchar(255) DEFAULT NULL,
technical_street4 varchar(255) DEFAULT NULL,
technical_street5 varchar(255) DEFAULT NULL,
technical_city varchar(255) DEFAULT NULL,
technical_postal_code varchar(255) DEFAULT NULL,
technical_country varchar(255) DEFAULT NULL,
technical_email varchar(255) DEFAULT NULL,
technical_telephone varchar(255) DEFAULT NULL,
json longblob NOT NULL,
timestamp timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (id),
KEY ixEventWhoisDomainDomain (domain),
KEY ixEventWhoisDomainTimestamp (timestamp)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO t1 (
id, domain, registrant_name, registrant_organization, registrant_street1,
registrant_street2, registrant_street3, registrant_street4, registrant_street5,
registrant_city, registrant_postal_code, registrant_country, registrant_email,
registrant_telephone, administrative_name, administrative_organization,
administrative_street1, administrative_street2, administrative_street3,
administrative_street4, administrative_street5, administrative_city,
administrative_postal_code, administrative_country, administrative_email,
administrative_telephone, technical_name, technical_organization,
technical_street1, technical_street2, technical_street3, technical_street4,
technical_street5, technical_city, technical_postal_code, technical_country,
technical_email, technical_telephone, json, timestamp) VALUES
(60380, 'www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, '', '2016-12-22 09:18:28'),
(60383, 'www.bestwestern.fr', null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, '', '2016-12-22 09:27:06'),
(80392, 'www.dfinitions.fr', null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, '', '2017-01-30 08:02:01'),
(80407, 'www.firma.o2.pl', null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, 'AZ.pl Sp. z o.o.', 'Al. Papieza Jana Pawla II 19/2',
null, null, null, null, '70-453 Szczecin', null, 'POLAND', null,
'48914243780', '', '2017-01-30 08:24:51'),
(80551, 'www.mailhost.i-dev.fr', null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, '', '2017-01-30 10:00:56'),
(80560, 'www.blackmer-mouvex.com', 'MARIE-PIERRE PRODEAU', 'MOUVEX',
'2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE',
'PRODEAU@MOUVEX.COM', null, 'MARIE-PIERRE PRODEAU', 'MOUVEX',
'2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE',
'PRODEAU@MOUVEX.COM', '33 386498630', 'LAURENT SOUCHELEAU', 'MOUVEX',
'2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE',
'SOUCHELEAU@MOUVEX.COM', '33 386498643', '', '2017-01-30 10:04:38'),
(80566, 'www.inup.com', 'MAXIMILIAN V. KETELHODT', null,
'SUELZBURGSTRASSE 158A', null, null, null, null, 'KOELN', '50937', 'GERMANY',
'ICANN@EXPIRES-2009.WEBCARE24.COM', '492214307580', 'MAXIMILIAN V. KETELHODT',
null, 'SUELZBURGSTRASSE 158A', null, null, null, null, 'KOELN', '50937',
'GERMANY', 'ICANN@EXPIRES-2009.WEBCARE24.COM', '492214307580',
'MAXIMILIAN V. KETELHODT', null, 'SUELZBURGSTRASSE 158A', null, null, null,
null, 'KOELN', '50937', 'GERMANY', 'ICANN@EXPIRES-2009.WEBCARE24.COM',
'492214307580', '', '2017-01-30 10:08:29');
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='mrr=on,mrr_sort_keys=on';
SELECT * FROM t1
WHERE 1 = 1 AND domain = 'www.mailhost.i-dev.fr' AND
timestamp >= DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -1 MONTH)
ORDER BY timestamp DESC;
id domain registrant_name registrant_organization registrant_street1 registrant_street2 registrant_street3 registrant_street4 registrant_street5 registrant_city registrant_postal_code registrant_country registrant_email registrant_telephone administrative_name administrative_organization administrative_street1 administrative_street2 administrative_street3 administrative_street4 administrative_street5 administrative_city administrative_postal_code administrative_country administrative_email administrative_telephone technical_name technical_organization technical_street1 technical_street2 technical_street3 technical_street4 technical_street5 technical_city technical_postal_code technical_country technical_email technical_telephone json timestamp
EXPLAIN EXTENDED SELECT * FROM t1
WHERE 1 = 1 AND domain = 'www.mailhost.i-dev.fr' AND
timestamp >= DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -1 MONTH)
ORDER BY timestamp DESC;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref|filter ixEventWhoisDomainDomain,ixEventWhoisDomainTimestamp ixEventWhoisDomainDomain|ixEventWhoisDomainTimestamp 767|4 const 2 (14%) 14.29 Using index condition; Using where; Using filesort; Using rowid filter
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`domain` AS `domain`,`test`.`t1`.`registrant_name` AS `registrant_name`,`test`.`t1`.`registrant_organization` AS `registrant_organization`,`test`.`t1`.`registrant_street1` AS `registrant_street1`,`test`.`t1`.`registrant_street2` AS `registrant_street2`,`test`.`t1`.`registrant_street3` AS `registrant_street3`,`test`.`t1`.`registrant_street4` AS `registrant_street4`,`test`.`t1`.`registrant_street5` AS `registrant_street5`,`test`.`t1`.`registrant_city` AS `registrant_city`,`test`.`t1`.`registrant_postal_code` AS `registrant_postal_code`,`test`.`t1`.`registrant_country` AS `registrant_country`,`test`.`t1`.`registrant_email` AS `registrant_email`,`test`.`t1`.`registrant_telephone` AS `registrant_telephone`,`test`.`t1`.`administrative_name` AS `administrative_name`,`test`.`t1`.`administrative_organization` AS `administrative_organization`,`test`.`t1`.`administrative_street1` AS `administrative_street1`,`test`.`t1`.`administrative_street2` AS `administrative_street2`,`test`.`t1`.`administrative_street3` AS `administrative_street3`,`test`.`t1`.`administrative_street4` AS `administrative_street4`,`test`.`t1`.`administrative_street5` AS `administrative_street5`,`test`.`t1`.`administrative_city` AS `administrative_city`,`test`.`t1`.`administrative_postal_code` AS `administrative_postal_code`,`test`.`t1`.`administrative_country` AS `administrative_country`,`test`.`t1`.`administrative_email` AS `administrative_email`,`test`.`t1`.`administrative_telephone` AS `administrative_telephone`,`test`.`t1`.`technical_name` AS `technical_name`,`test`.`t1`.`technical_organization` AS `technical_organization`,`test`.`t1`.`technical_street1` AS `technical_street1`,`test`.`t1`.`technical_street2` AS `technical_street2`,`test`.`t1`.`technical_street3` AS `technical_street3`,`test`.`t1`.`technical_street4` AS `technical_street4`,`test`.`t1`.`technical_street5` AS `technical_street5`,`test`.`t1`.`technical_city` AS `technical_city`,`test`.`t1`.`technical_postal_code` AS `technical_postal_code`,`test`.`t1`.`technical_country` AS `technical_country`,`test`.`t1`.`technical_email` AS `technical_email`,`test`.`t1`.`technical_telephone` AS `technical_telephone`,`test`.`t1`.`json` AS `json`,`test`.`t1`.`timestamp` AS `timestamp` from `test`.`t1` where `test`.`t1`.`domain` = 'www.mailhost.i-dev.fr' and `test`.`t1`.`timestamp` >= <cache>(current_timestamp() + interval -1 month) order by `test`.`t1`.`timestamp` desc
SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1;
#
# MDEV-21446: index to access the table is changed for primary key
#
SET @stats.save= @@innodb_stats_persistent;
SET global innodb_stats_persistent=on;
CREATE TABLE t1 (
pk int auto_increment,
a int,
b int,
primary key (pk),
key (a),
key (b)
) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES
(0,0), (0,9), (0,NULL), (1,2), (4,0), (2,9), (1,0), (NULL,0), (5,NULL), (5,1),
(0,7), (NULL,5), (NULL,0), (2,1), (2,5), (6,NULL), (0,NULL), (NULL,8), (8,5),
(2,NULL), (2,3), (NULL,8), (NULL,6), (1,1), (5,1), (NULL,5), (4,4), (2,4),
(2,5), (1,9), (NULL,0), (3,7), (0,4), (2,8), (1,2), (1,4), (2,1),
(NULL,7), (6,6), (3,0), (4,5), (5,2), (8,2), (NULL,NULL), (8,NULL),
(0,1),(0,7);
INSERT INTO t1(a,b) SELECT a, b FROM t1;
INSERT INTO t1(a,b) SELECT a, b FROM t1;
INSERT INTO t1(a,b) SELECT a, b FROM t1;
INSERT INTO t1(a,b) SELECT a, b FROM t1;
INSERT INTO t1(a,b) SELECT a, b FROM t1;
INSERT INTO t1(a,b) SELECT a, b FROM t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN EXTENDED
SELECT * FROM t1
WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range|filter a,b b|a 5|5 NULL 192 (21%) 21.31 Using index condition; Using where; Using rowid filter
Warnings:
Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` between 9 and 10 or `test`.`t1`.`a` is null) and (`test`.`t1`.`b` between 9 and 10 or `test`.`t1`.`b` = 9)
EXPLAIN EXTENDED
SELECT * FROM t1
WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9)
ORDER BY pk LIMIT 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index a,b PRIMARY 4 NULL 75 54.55 Using where
Warnings:
Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` between 9 and 10 or `test`.`t1`.`a` is null) and (`test`.`t1`.`b` between 9 and 10 or `test`.`t1`.`b` = 9) order by `test`.`t1`.`pk` limit 1
ANALYZE
SELECT * FROM t1
WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9)
ORDER BY pk LIMIT 1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 index a,b PRIMARY 4 NULL 3008 3008.00 1.36 0.00 Using where
DROP TABLE t1;
SET global innodb_stats_persistent= @stats.save;

View File

@ -215,3 +215,169 @@ eval $q;
drop table t1;
set global innodb_stats_persistent= @stats.save;
--echo #
--echo # MDEV-21356: usage of range filter with range access employing
--echo # optimizer_switch='mrr=on,mrr_sort_keys=on';
--echo #
CREATE TABLE t1 (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
domain varchar(255) NOT NULL,
registrant_name varchar(255) DEFAULT NULL,
registrant_organization varchar(255) DEFAULT NULL,
registrant_street1 varchar(255) DEFAULT NULL,
registrant_street2 varchar(255) DEFAULT NULL,
registrant_street3 varchar(255) DEFAULT NULL,
registrant_street4 varchar(255) DEFAULT NULL,
registrant_street5 varchar(255) DEFAULT NULL,
registrant_city varchar(255) DEFAULT NULL,
registrant_postal_code varchar(255) DEFAULT NULL,
registrant_country varchar(255) DEFAULT NULL,
registrant_email varchar(255) DEFAULT NULL,
registrant_telephone varchar(255) DEFAULT NULL,
administrative_name varchar(255) DEFAULT NULL,
administrative_organization varchar(255) DEFAULT NULL,
administrative_street1 varchar(255) DEFAULT NULL,
administrative_street2 varchar(255) DEFAULT NULL,
administrative_street3 varchar(255) DEFAULT NULL,
administrative_street4 varchar(255) DEFAULT NULL,
administrative_street5 varchar(255) DEFAULT NULL,
administrative_city varchar(255) DEFAULT NULL,
administrative_postal_code varchar(255) DEFAULT NULL,
administrative_country varchar(255) DEFAULT NULL,
administrative_email varchar(255) DEFAULT NULL,
administrative_telephone varchar(255) DEFAULT NULL,
technical_name varchar(255) DEFAULT NULL,
technical_organization varchar(255) DEFAULT NULL,
technical_street1 varchar(255) DEFAULT NULL,
technical_street2 varchar(255) DEFAULT NULL,
technical_street3 varchar(255) DEFAULT NULL,
technical_street4 varchar(255) DEFAULT NULL,
technical_street5 varchar(255) DEFAULT NULL,
technical_city varchar(255) DEFAULT NULL,
technical_postal_code varchar(255) DEFAULT NULL,
technical_country varchar(255) DEFAULT NULL,
technical_email varchar(255) DEFAULT NULL,
technical_telephone varchar(255) DEFAULT NULL,
json longblob NOT NULL,
timestamp timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (id),
KEY ixEventWhoisDomainDomain (domain),
KEY ixEventWhoisDomainTimestamp (timestamp)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO t1 (
id, domain, registrant_name, registrant_organization, registrant_street1,
registrant_street2, registrant_street3, registrant_street4, registrant_street5,
registrant_city, registrant_postal_code, registrant_country, registrant_email,
registrant_telephone, administrative_name, administrative_organization,
administrative_street1, administrative_street2, administrative_street3,
administrative_street4, administrative_street5, administrative_city,
administrative_postal_code, administrative_country, administrative_email,
administrative_telephone, technical_name, technical_organization,
technical_street1, technical_street2, technical_street3, technical_street4,
technical_street5, technical_city, technical_postal_code, technical_country,
technical_email, technical_telephone, json, timestamp) VALUES
(60380, 'www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, '', '2016-12-22 09:18:28'),
(60383, 'www.bestwestern.fr', null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, '', '2016-12-22 09:27:06'),
(80392, 'www.dfinitions.fr', null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, '', '2017-01-30 08:02:01'),
(80407, 'www.firma.o2.pl', null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, 'AZ.pl Sp. z o.o.', 'Al. Papieza Jana Pawla II 19/2',
null, null, null, null, '70-453 Szczecin', null, 'POLAND', null,
'48914243780', '', '2017-01-30 08:24:51'),
(80551, 'www.mailhost.i-dev.fr', null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, '', '2017-01-30 10:00:56'),
(80560, 'www.blackmer-mouvex.com', 'MARIE-PIERRE PRODEAU', 'MOUVEX',
'2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE',
'PRODEAU@MOUVEX.COM', null, 'MARIE-PIERRE PRODEAU', 'MOUVEX',
'2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE',
'PRODEAU@MOUVEX.COM', '33 386498630', 'LAURENT SOUCHELEAU', 'MOUVEX',
'2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE',
'SOUCHELEAU@MOUVEX.COM', '33 386498643', '', '2017-01-30 10:04:38'),
(80566, 'www.inup.com', 'MAXIMILIAN V. KETELHODT', null,
'SUELZBURGSTRASSE 158A', null, null, null, null, 'KOELN', '50937', 'GERMANY',
'ICANN@EXPIRES-2009.WEBCARE24.COM', '492214307580', 'MAXIMILIAN V. KETELHODT',
null, 'SUELZBURGSTRASSE 158A', null, null, null, null, 'KOELN', '50937',
'GERMANY', 'ICANN@EXPIRES-2009.WEBCARE24.COM', '492214307580',
'MAXIMILIAN V. KETELHODT', null, 'SUELZBURGSTRASSE 158A', null, null, null,
null, 'KOELN', '50937', 'GERMANY', 'ICANN@EXPIRES-2009.WEBCARE24.COM',
'492214307580', '', '2017-01-30 10:08:29');
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='mrr=on,mrr_sort_keys=on';
let $q=
SELECT * FROM t1
WHERE 1 = 1 AND domain = 'www.mailhost.i-dev.fr' AND
timestamp >= DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -1 MONTH)
ORDER BY timestamp DESC;
eval $q;
eval EXPLAIN EXTENDED $q;
SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1;
--echo #
--echo # MDEV-21446: index to access the table is changed for primary key
--echo #
SET @stats.save= @@innodb_stats_persistent;
SET global innodb_stats_persistent=on;
CREATE TABLE t1 (
pk int auto_increment,
a int,
b int,
primary key (pk),
key (a),
key (b)
) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES
(0,0), (0,9), (0,NULL), (1,2), (4,0), (2,9), (1,0), (NULL,0), (5,NULL), (5,1),
(0,7), (NULL,5), (NULL,0), (2,1), (2,5), (6,NULL), (0,NULL), (NULL,8), (8,5),
(2,NULL), (2,3), (NULL,8), (NULL,6), (1,1), (5,1), (NULL,5), (4,4), (2,4),
(2,5), (1,9), (NULL,0), (3,7), (0,4), (2,8), (1,2), (1,4), (2,1),
(NULL,7), (6,6), (3,0), (4,5), (5,2), (8,2), (NULL,NULL), (8,NULL),
(0,1),(0,7);
INSERT INTO t1(a,b) SELECT a, b FROM t1;
INSERT INTO t1(a,b) SELECT a, b FROM t1;
INSERT INTO t1(a,b) SELECT a, b FROM t1;
INSERT INTO t1(a,b) SELECT a, b FROM t1;
INSERT INTO t1(a,b) SELECT a, b FROM t1;
INSERT INTO t1(a,b) SELECT a, b FROM t1;
ANALYZE TABLE t1;
EXPLAIN EXTENDED
SELECT * FROM t1
WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9);
EXPLAIN EXTENDED
SELECT * FROM t1
WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9)
ORDER BY pk LIMIT 1;
ANALYZE
SELECT * FROM t1
WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9)
ORDER BY pk LIMIT 1;
DROP TABLE t1;
SET global innodb_stats_persistent= @stats.save;

View File

@ -6,6 +6,7 @@ insert into t1 values (2,2), (1,1);
create table t2 (a int);
insert into t2 values (2), (3);
set session join_cache_level=3;
SET @saved_dbug = @@SESSION.debug_dbug;
set @@debug_dbug= 'd,opt';
explain select t1.b from t1,t2 where t1.b=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
@ -16,3 +17,4 @@ b
2
set session join_cache_level=default;
drop table t1,t2;
SET debug_dbug= @saved_dbug;

View File

@ -10,6 +10,7 @@ create table t2 (a int);
insert into t2 values (2), (3);
set session join_cache_level=3;
SET @saved_dbug = @@SESSION.debug_dbug;
set @@debug_dbug= 'd,opt';
explain select t1.b from t1,t2 where t1.b=t2.a;
@ -17,3 +18,4 @@ select t1.b from t1,t2 where t1.b=t2.a;
set session join_cache_level=default;
drop table t1,t2;
SET debug_dbug= @saved_dbug;

View File

@ -23,7 +23,7 @@ show explain for $thr1;
ERROR HY000: Target is not running an EXPLAINable command
connection con1;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select count(*) from t1 where a < 100000;
connection default;
show explain for $thr2;
@ -58,10 +58,10 @@ connection con1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
set optimizer_switch= @show_expl_tmp;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
# UNION, first branch
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a from t0 A union select a+1 from t0 B;
connection default;
show explain for $thr2;
@ -76,10 +76,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10
2 UNION B ALL NULL NULL NULL NULL 10
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
# UNION, second branch
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a from t0 A union select a+1 from t0 B;
connection default;
show explain for $thr2;
@ -94,10 +94,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10
2 UNION B ALL NULL NULL NULL NULL 10
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
# Uncorrelated subquery, select
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 B) from t0 A where a<1;
connection default;
show explain for $thr2;
@ -109,10 +109,10 @@ Note 1003 select a, (select max(a) from t0 B) from t0 A where a<1
connection con1;
a (select max(a) from t0 B)
0 9
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
# Uncorrelated subquery, explain
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a, (select max(a) from t0 B) from t0 A where a<1;
connection default;
show explain for $thr2;
@ -125,10 +125,10 @@ connection con1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
2 SUBQUERY B ALL NULL NULL NULL NULL 10
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
# correlated subquery, select
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
show explain for $thr2;
@ -140,10 +140,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a
connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
# correlated subquery, explain
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
show explain for $thr2;
@ -155,10 +155,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a
connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
# correlated subquery, select, while inside the subquery
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
show explain for $thr2;
@ -170,10 +170,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a
connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
# correlated subquery, explain, while inside the subquery
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
show explain for $thr2;
@ -185,10 +185,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a
connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
# correlated subquery, explain, while inside the subquery
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
show explain for $thr2;
@ -200,12 +200,12 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a
connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
# Try to do SHOW EXPLAIN for a query that runs a SET command:
# I've found experimentally that select_id==2 here...
#
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @foo= (select max(a) from t0 where sin(a) >0);
connection default;
show explain for $thr2;
@ -213,13 +213,13 @@ ERROR HY000: Target is not running an EXPLAINable command
kill query $thr2;
connection con1;
ERROR 70100: Query execution was interrupted
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
#
# Attempt SHOW EXPLAIN for an UPDATE
#
create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
show explain for $thr2;
@ -236,13 +236,13 @@ Warnings:
Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
connection con1;
drop table t2;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
#
# Attempt SHOW EXPLAIN for a DELETE (UPD: now works)
#
create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
show explain for $thr2;
@ -259,13 +259,13 @@ Warnings:
Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
connection con1;
drop table t2;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
#
# Multiple SHOW EXPLAIN calls for one select
#
create table t2 as select a as a, a as dummy from t0 limit 3;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
connection default;
show explain for $thr2;
@ -292,14 +292,14 @@ a SUBQ
1 0
2 0
drop table t2;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
#
# SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
#
explain select * from t0 order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select * from t0 order by a;
connection default;
@ -320,7 +320,7 @@ a
7
8
9
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
#
# SHOW EXPLAIN for SELECT ... with "Using temporary"
#
@ -329,7 +329,7 @@ explain select distinct a from t0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
connection con1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select distinct a from t0;
connection default;
@ -350,7 +350,7 @@ a
7
8
9
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
#
# SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort"
#
@ -359,7 +359,7 @@ explain select distinct a from t0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
connection con1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select distinct a from t0;
connection default;
@ -380,7 +380,7 @@ a
7
8
9
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
#
# MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY
#
@ -390,7 +390,7 @@ explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
set debug_dbug='+d,show_explain_in_find_all_keys';
SET debug_dbug='+d,show_explain_in_find_all_keys';
SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
connection default;
# FIXED by "conservative assumptions about when QEP is available" fix:
@ -406,7 +406,7 @@ a
1
2
4
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t2;
#
# MDEV-239: Assertion `field_types == 0 ... ' failed in Protocol_text::store(double, uint32, String*) with
@ -421,7 +421,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a`
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
connection default;
show explain for $thr2;
@ -436,7 +436,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a`
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t2;
#
# MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failed in
@ -453,7 +453,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 6
2 DERIVED t3 system NULL NULL NULL NULL 1
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
SELECT * FROM v1, t2;
connection default;
show explain for $thr2;
@ -461,14 +461,14 @@ ERROR HY000: Target is not running an EXPLAINable command
kill query $thr2;
connection con1;
ERROR 70100: Query execution was interrupted
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP VIEW v1;
DROP TABLE t2, t3;
#
# MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries
#
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
select sleep(1);
connection default;
show explain for $thr2;
@ -479,12 +479,12 @@ Note 1003 select sleep(1)
connection con1;
sleep(1)
0
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
#
# Same as above, but try another reason for JOIN to be degenerate
#
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
select * from t0 where 1>10;
connection default;
show explain for $thr2;
@ -494,14 +494,14 @@ Warnings:
Note 1003 select * from t0 where 1>10
connection con1;
a
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
#
# Same as above, but try another reason for JOIN to be degenerate (2)
#
create table t3(a int primary key);
insert into t3 select a from t0;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
select * from t0,t3 where t3.a=112233;
connection default;
show explain for $thr2;
@ -511,7 +511,7 @@ Warnings:
Note 1003 select * from t0,t3 where t3.a=112233
connection con1;
a a
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t3;
#
# MDEV-270: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with
@ -530,7 +530,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SET debug_dbug='+d,show_explain_probe_do_select';
SELECT * FROM t2 WHERE a =
(SELECT MAX(a) FROM t2
WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
@ -552,7 +552,7 @@ pk a
6 7
7 7
9 7
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t2;
#
# MDEV-273: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with impossible WHERE
@ -584,7 +584,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 87 Using join buffer (flat, BNL join)
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SET debug_dbug='+d,show_explain_probe_do_select';
SELECT count(*) FROM t2, t3
WHERE a1 < ALL (
SELECT a1 FROM t2
@ -605,7 +605,7 @@ WHERE a1 IN ( SELECT a1 FROM t2, t4 )
connection con1;
count(*)
1740
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t2, t3, t4;
#
# MDEV-275: SHOW EXPLAIN: server crashes in JOIN::print_explain with IN subquery and aggregate function
@ -615,7 +615,7 @@ INSERT INTO t2 VALUES
(1,5),(2,4),(3,6),(4,9),(5,2),(6,8),(7,4),(8,8),(9,0),(10,43),
(11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2);
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`);
connection default;
show explain for $thr2;
@ -627,7 +627,7 @@ Warnings:
Note 1003 SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`)
connection con1;
pk a1
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t2;
DROP TABLE t1;
#
@ -636,7 +636,7 @@ DROP TABLE t1;
CREATE TABLE t1(a INT, KEY(a));
INSERT INTO t1 VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT 'test' FROM t1 WHERE a=1;
connection default;
show explain for $thr2;
@ -648,7 +648,7 @@ connection con1;
test
test
test
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1;
#
# MDEV-299: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN changes back and forth during query execution
@ -666,7 +666,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where
1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1)
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_test_if_quick_select';
SET debug_dbug='+d,show_explain_probe_test_if_quick_select';
select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
connection default;
show explain for $thr2;
@ -696,7 +696,7 @@ Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND
connection con1;
count(*)
212
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t1;
#
# MDEV-297: SHOW EXPLAIN: Server gets stuck until timeout occurs while
@ -705,7 +705,7 @@ drop table t1;
CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c));
INSERT INTO t1 (a) VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
SHOW INDEX FROM t1;
connection default;
show explain for $thr2;
@ -718,7 +718,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
t1 1 a 1 a A NULL NULL NULL YES BTREE
t1 1 b 1 b A NULL NULL NULL YES BTREE
t1 1 c 1 c A NULL NULL NULL YES BTREE
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1;
#
# MDEV-324: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN for a query with TEMPTABLE view
@ -731,7 +731,7 @@ EXPLAIN SELECT a + 1 FROM v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ALL NULL NULL NULL NULL 2
set debug_dbug='+d,show_explain_probe_join_tab_preread';
SET debug_dbug='+d,show_explain_probe_join_tab_preread';
set @show_explain_probe_select_id=1;
SELECT a + 1 FROM v1;
connection default;
@ -745,7 +745,7 @@ connection con1;
a + 1
2
3
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP VIEW v1;
DROP TABLE t1;
#
@ -761,7 +761,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
set debug_dbug='+d,show_explain_probe_union_read';
SET debug_dbug='+d,show_explain_probe_union_read';
SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
connection default;
show explain for $thr2;
@ -782,7 +782,7 @@ Warnings:
Note 1003 SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 )
connection con1;
a
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1;
#
# MDEV-327: SHOW EXPLAIN: Different select_type in plans produced by SHOW EXPLAIN
@ -805,7 +805,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 SUBQUERY t1 ALL NULL NULL NULL NULL 20
3 SUBQUERY t2 ALL NULL NULL NULL NULL 20 Using where
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
connection default;
@ -820,7 +820,7 @@ Note 1003 SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b )
connection con1;
a b
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1, t2;
#
# Test that SHOW EXPLAIN will print 'Distinct'.
@ -842,7 +842,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select distinct t1.a from t1,t3 where t1.a=t3.a;
connection default;
show explain for $thr2;
@ -855,7 +855,7 @@ connection con1;
a
1
2
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t1,t3,t4;
#
# ---------- SHOW EXPLAIN and permissions -----------------
@ -869,7 +869,7 @@ connection con1;
# First, make sure that user 'test2' cannot do SHOW EXPLAIN on us
#
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where a < 3;
connection default;
connection con2;
@ -886,14 +886,14 @@ a
0
1
2
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
#
# Check that user test2 can do SHOW EXPLAIN on its own queries
#
connect con3, localhost, test2,,;
connection con2;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where a < 3;
connection con1;
connection con3;
@ -916,9 +916,9 @@ disconnect con2;
grant process on *.* to test2@localhost;
connect con2, localhost, test2,,;
connection con1;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where a < 3;
connection default;
connection con2;
@ -932,7 +932,7 @@ a
0
1
2
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
revoke all privileges on test.* from test2@localhost;
drop user test2@localhost;
disconnect con2;
@ -1009,7 +1009,7 @@ ORDER BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b;
@ -1030,9 +1030,9 @@ a+SLEEP(0.01)
0
0
0
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SET debug_dbug='+d,show_explain_probe_do_select';
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b;
@ -1053,7 +1053,7 @@ a+SLEEP(0.01)
0
0
0
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t1;
#
# MDEV-298: SHOW EXPLAIN: Plan returned by SHOW EXPLAIN only contains
@ -1067,7 +1067,7 @@ EXPLAIN SELECT a FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT a FROM t1 GROUP BY a;
connection default;
show explain for $thr2;
@ -1093,7 +1093,7 @@ a
14
15
16
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t1;
#
# MDEV-408: SHOW EXPLAIN: Some values are chopped off in SHOW EXPLAIN output
@ -1107,7 +1107,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 index_subquery PRIMARY,c c 5 func 1 Using index; Using where
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
connection default;
show explain for $thr2;
@ -1119,7 +1119,7 @@ Note 1003 SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE
connection con1;
SUM(a + SLEEP(0.1))
7862
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t1, t2;
#
# MDEV-412: SHOW EXPLAIN: Server crashes in JOIN::print_explain on a query with inner join and ORDER BY the same column twice
@ -1157,7 +1157,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 6 NULL 107 Using where; Using index
1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SET debug_dbug='+d,show_explain_probe_do_select';
SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
connection default;
show explain for $thr2;
@ -1169,7 +1169,7 @@ Warnings:
Note 1003 SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2
connection con1;
field1 field2
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1,t2,t3;
#
# MDEV-423: SHOW EXPLAIN: 'Using where' for a subquery is shown in EXPLAIN, but not in SHOW EXPLAIN output
@ -1190,7 +1190,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 20
3 SUBQUERY t3 ALL NULL NULL NULL NULL 20 Using where
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
connection default;
@ -1205,7 +1205,7 @@ WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10
connection con1;
max(a+b+c)
279
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1,t2,t3;
#
# MDEV-416: Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree)
@ -1231,7 +1231,7 @@ select hex('
hex('ãû')
E3FB
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where length('ãû') = a;
connection default;
set names utf8;
@ -1244,7 +1244,7 @@ set names default;
connection con1;
a
2
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
set names default;
#
# MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref if FOR contains a non-numeric value
@ -1270,7 +1270,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT SUBQUERY t1 ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1)
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2
WHERE b <= ANY (
SELECT a FROM t1
@ -1290,7 +1290,7 @@ WHERE a = b + SLEEP(0.2) OR a >= ( SELECT SUM(b) FROM t2 ))
connection con1;
SUM(b)
0
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1,t2;
drop table t0;
#
@ -1302,7 +1302,7 @@ create table t1 (a int, b int);
insert into t1 select a,a from t0;
create table t2 as select * from t1;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_best_ext_lim_search';
SET debug_dbug='+d,show_explain_probe_best_ext_lim_search';
explain
select * from t0
where not exists ( select 1 from t1, t2 where t1.b=t2.b and t2.a=t0.a) and a is null;

View File

@ -16,7 +16,7 @@ SET @old_debug= @@session.debug;
# is that we use the following commands for synchronization:
#
# set @show_explain_probe_select_id=1;
# set debug_dbug='d,show_explain_probe_join_exec_start';
# SET debug_dbug='d,show_explain_probe_join_exec_start';
# send select count(*) from t1 where a < 100000;
#
# When ran with mysqltest_embedded, this translates into:
@ -76,7 +76,7 @@ let $wait_condition= select State='show_explain_trap' from information_schema.pr
#
connection con1;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select count(*) from t1 where a < 100000;
connection default;
@ -104,109 +104,109 @@ evalp show explain for $thr2;
connection con1;
reap;
set optimizer_switch= @show_expl_tmp;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo # UNION, first branch
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send explain select a from t0 A union select a+1 from t0 B;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo # UNION, second branch
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send explain select a from t0 A union select a+1 from t0 B;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo # Uncorrelated subquery, select
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 B) from t0 A where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo # Uncorrelated subquery, explain
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send explain select a, (select max(a) from t0 B) from t0 A where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo # correlated subquery, select
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo # correlated subquery, explain
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo # correlated subquery, select, while inside the subquery
set @show_explain_probe_select_id=2; # <---
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo # correlated subquery, explain, while inside the subquery
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo # correlated subquery, explain, while inside the subquery
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
# TODO: explain in the parent subuqery when the un-correlated child has been
# run (and have done irreversible cleanups)
@ -219,7 +219,7 @@ set debug_dbug=@old_debug;
--echo # I've found experimentally that select_id==2 here...
--echo #
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send set @foo= (select max(a) from t0 where sin(a) >0);
connection default;
--source include/wait_condition.inc
@ -229,14 +229,14 @@ evalp kill query $thr2;
connection con1;
--error ER_QUERY_INTERRUPTED
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo #
--echo # Attempt SHOW EXPLAIN for an UPDATE
--echo #
create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
--source include/wait_condition.inc
@ -248,14 +248,14 @@ evalp show explain for $thr2;
connection con1;
reap;
drop table t2;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo #
--echo # Attempt SHOW EXPLAIN for a DELETE (UPD: now works)
--echo #
create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
--source include/wait_condition.inc
@ -267,14 +267,14 @@ evalp show explain for $thr2;
connection con1;
reap;
drop table t2;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo #
--echo # Multiple SHOW EXPLAIN calls for one select
--echo #
create table t2 as select a as a, a as dummy from t0 limit 3;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
connection default;
--source include/wait_condition.inc
@ -286,14 +286,14 @@ evalp show explain for $thr2;
connection con1;
reap;
drop table t2;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo #
--echo # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
--echo #
explain select * from t0 order by a;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
send select * from t0 order by a;
connection default;
@ -301,7 +301,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo #
--echo # SHOW EXPLAIN for SELECT ... with "Using temporary"
@ -310,7 +310,7 @@ connection default;
explain select distinct a from t0;
connection con1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
send select distinct a from t0;
connection default;
@ -318,7 +318,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo #
--echo # SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort"
@ -327,7 +327,7 @@ connection default;
explain select distinct a from t0;
connection con1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
send select distinct a from t0;
@ -336,7 +336,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo #
--echo # MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY
@ -345,7 +345,7 @@ CREATE TABLE t2 ( a INT );
INSERT INTO t2 VALUES (1),(2),(1),(4),(2);
explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
set debug_dbug='+d,show_explain_in_find_all_keys';
SET debug_dbug='+d,show_explain_in_find_all_keys';
send SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
connection default;
@ -356,7 +356,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t2;
@ -372,7 +372,7 @@ INSERT INTO t2 VALUES (1),(2),(1),(4),(2);
EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
send EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
connection default;
@ -380,7 +380,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t2;
@ -396,7 +396,7 @@ INSERT INTO t2 VALUES (4),(5),(6),(7),(8),(9);
explain SELECT * FROM v1, t2;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
send SELECT * FROM v1, t2;
connection default;
@ -407,7 +407,7 @@ evalp kill query $thr2;
connection con1;
--error ER_QUERY_INTERRUPTED
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP VIEW v1;
DROP TABLE t2, t3;
@ -415,21 +415,21 @@ DROP TABLE t2, t3;
--echo # MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries
--echo #
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
send select sleep(1);
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo #
--echo # Same as above, but try another reason for JOIN to be degenerate
--echo #
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
send select * from t0 where 1>10;
connection default;
--source include/wait_condition.inc
@ -437,7 +437,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo #
--echo # Same as above, but try another reason for JOIN to be degenerate (2)
@ -445,7 +445,7 @@ set debug_dbug=@old_debug;
create table t3(a int primary key);
insert into t3 select a from t0;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
send select * from t0,t3 where t3.a=112233;
connection default;
--source include/wait_condition.inc
@ -453,7 +453,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t3;
--echo #
@ -472,7 +472,7 @@ explain SELECT * FROM t2 WHERE a =
);
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SET debug_dbug='+d,show_explain_probe_do_select';
send SELECT * FROM t2 WHERE a =
(SELECT MAX(a) FROM t2
WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
@ -482,7 +482,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t2;
@ -515,7 +515,7 @@ WHERE a1 < ALL (
);
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SET debug_dbug='+d,show_explain_probe_do_select';
send
SELECT count(*) FROM t2, t3
WHERE a1 < ALL (
@ -528,7 +528,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t2, t3, t4;
--echo #
@ -540,7 +540,7 @@ INSERT INTO t2 VALUES
(11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2);
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SET debug_dbug='+d,show_explain_probe_join_exec_end';
send
SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`);
connection default;
@ -549,7 +549,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t2;
DROP TABLE t1;
@ -561,7 +561,7 @@ CREATE TABLE t1(a INT, KEY(a));
INSERT INTO t1 VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send SELECT 'test' FROM t1 WHERE a=1;
connection default;
@ -569,7 +569,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1;
@ -593,7 +593,7 @@ set join_cache_level=0;
explain select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_test_if_quick_select';
SET debug_dbug='+d,show_explain_probe_test_if_quick_select';
send
select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
@ -610,7 +610,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t1;
--echo #
@ -621,7 +621,7 @@ CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c));
INSERT INTO t1 (a) VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send SHOW INDEX FROM t1;
connection default;
@ -629,7 +629,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1;
@ -643,7 +643,7 @@ CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
EXPLAIN SELECT a + 1 FROM v1;
set debug_dbug='+d,show_explain_probe_join_tab_preread';
SET debug_dbug='+d,show_explain_probe_join_tab_preread';
set @show_explain_probe_select_id=1;
send
@ -653,7 +653,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP VIEW v1;
DROP TABLE t1;
@ -669,7 +669,7 @@ INSERT INTO t1 VALUES (4),(6);
EXPLAIN
SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
set debug_dbug='+d,show_explain_probe_union_read';
SET debug_dbug='+d,show_explain_probe_union_read';
send
SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
@ -683,7 +683,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1;
--echo #
@ -705,7 +705,7 @@ SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
--send
SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
@ -716,7 +716,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1, t2;
--echo #
@ -739,7 +739,7 @@ insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
--send
select distinct t1.a from t1,t3 where t1.a=t3.a;
connection default;
@ -748,7 +748,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t1,t3,t4;
@ -758,7 +758,7 @@ drop table t1,t3,t4;
create user test2@localhost;
grant ALL on test.* to test2@localhost;
# Give the user SUPER privilege so it can set debug_dbug variable.
# Give the user SUPER privilege so it can SET debug_dbug variable.
grant super on *.* to test2@localhost;
connect (con2, localhost, test2,,);
connection con1;
@ -767,7 +767,7 @@ connection con1;
--echo # First, make sure that user 'test2' cannot do SHOW EXPLAIN on us
--echo #
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
select * from t0 where a < 3;
@ -783,7 +783,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
--echo #
--echo # Check that user test2 can do SHOW EXPLAIN on its own queries
@ -793,7 +793,7 @@ connect (con3, localhost, test2,,);
connection con2;
let $thr_con2=`select connection_id()`;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
select * from t0 where a < 3;
@ -819,10 +819,10 @@ disconnect con2;
grant process on *.* to test2@localhost;
connect (con2, localhost, test2,,);
connection con1;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
select * from t0 where a < 3;
@ -834,7 +834,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
revoke all privileges on test.* from test2@localhost;
drop user test2@localhost;
@ -914,7 +914,7 @@ WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
--send
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
@ -926,10 +926,10 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SET debug_dbug='+d,show_explain_probe_do_select';
--send
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
@ -942,7 +942,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t1;
@ -958,7 +958,7 @@ INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12, t1 t13;
EXPLAIN SELECT a FROM t1 GROUP BY a;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
--send
SELECT a FROM t1 GROUP BY a;
@ -969,7 +969,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t1;
@ -985,7 +985,7 @@ INSERT INTO t2 VALUES (86,'English'),(87,'Russian');
explain SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
--send
SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
@ -996,7 +996,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
drop table t1, t2;
--echo #
@ -1035,7 +1035,7 @@ explain
SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SET debug_dbug='+d,show_explain_probe_do_select';
send
SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
@ -1047,7 +1047,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1,t2,t3;
@ -1071,7 +1071,7 @@ SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
@ -1084,7 +1084,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1,t2,t3;
--echo #
@ -1111,7 +1111,7 @@ select charset('
select hex('ãû');
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
select * from t0 where length('ãû') = a;
@ -1126,7 +1126,7 @@ connection con1;
# The constant should be two letters, the last looking like 'bl'
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
set names default;
--echo #
@ -1153,7 +1153,7 @@ WHERE b <= ANY (
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2
@ -1168,7 +1168,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
DROP TABLE t1,t2;
drop table t0;
@ -1184,7 +1184,7 @@ insert into t1 select a,a from t0;
create table t2 as select * from t1;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_best_ext_lim_search';
SET debug_dbug='+d,show_explain_probe_best_ext_lim_search';
send
explain
select * from t0

View File

@ -14,7 +14,7 @@ from t0 A, t0 B, t0 C;
# Test SHOW EXPLAIN for single-table DELETE
#
connection con2;
set debug_dbug='+d,show_explain_probe_delete_exec_start';
SET debug_dbug='+d,show_explain_probe_delete_exec_start';
delete from t1 where a<10 and b+1>1000;
connection default;
show explain for $thr2;
@ -27,7 +27,7 @@ connection con2;
# Test SHOW EXPLAIN for multi-table DELETE
#
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SET debug_dbug='+d,show_explain_probe_do_select';
delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000;
connection default;
show explain for $thr2;
@ -41,7 +41,7 @@ connection con2;
# Test SHOW EXPLAIN for single-table UPDATE
#
connection con2;
set debug_dbug='+d,show_explain_probe_update_exec_start';
SET debug_dbug='+d,show_explain_probe_update_exec_start';
update t1 set filler='filler-data-2' where a<10 and b+1>1000;
connection default;
show explain for $thr2;
@ -51,5 +51,5 @@ Warnings:
Note 1003 update t1 set filler='filler-data-2' where a<10 and b+1>1000
connection con2;
drop table t0,t1;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
set debug_sync='RESET';

View File

@ -38,7 +38,7 @@ let $wait_condition= select State='show_explain_trap' from information_schema.pr
--echo # Test SHOW EXPLAIN for single-table DELETE
--echo #
connection con2;
set debug_dbug='+d,show_explain_probe_delete_exec_start';
SET debug_dbug='+d,show_explain_probe_delete_exec_start';
send delete from t1 where a<10 and b+1>1000;
connection default;
@ -51,7 +51,7 @@ reap;
--echo # Test SHOW EXPLAIN for multi-table DELETE
--echo #
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SET debug_dbug='+d,show_explain_probe_do_select';
send delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000;
connection default;
--source include/wait_condition.inc
@ -63,7 +63,7 @@ reap;
--echo # Test SHOW EXPLAIN for single-table UPDATE
--echo #
connection con2;
set debug_dbug='+d,show_explain_probe_update_exec_start';
SET debug_dbug='+d,show_explain_probe_update_exec_start';
send update t1 set filler='filler-data-2' where a<10 and b+1>1000;
connection default;
@ -74,5 +74,5 @@ reap;
drop table t0,t1;
set debug_dbug=@old_debug;
SET debug_dbug=@old_debug;
set debug_sync='RESET';

View File

@ -17,7 +17,8 @@ connection con1;
connection default;
connection con1;
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='d,show_explain_probe_join_exec_start';
select count(*) from t0 where a < 100000;
connection default;
show explain for $thr2;
@ -28,7 +29,7 @@ Note 1003 select count(*) from t0 where a < 100000
connection con1;
count(*)
10
set debug_dbug='';
SET debug_dbug= @saved_dbug;
select event_name
from
performance_schema.events_stages_history_long join

View File

@ -38,7 +38,8 @@ let $wait_condition= select State='show_explain_trap' from information_schema.pr
#
connection con1;
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='d,show_explain_probe_join_exec_start';
send select count(*) from t0 where a < 100000;
connection default;
@ -47,7 +48,7 @@ evalp show explain for $thr2;
connection con1;
reap;
set debug_dbug='';
SET debug_dbug= @saved_dbug;
evalp select event_name
from

View File

@ -3,7 +3,8 @@ create table t1 (a int, b int) engine=memory;
insert t1 select seq, seq+1 from seq_1_to_1000;
set global general_log=0;
set global log_queries_not_using_indexes=1;
set debug_dbug='+d,simulate_file_write_error';
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,simulate_file_write_error';
select * from t1 where a>10;
select * from t1 where a>10;
select * from t1 where a>10;
@ -54,7 +55,7 @@ select * from t1 where a>10;
select * from t1 where a>10;
select * from t1 where a>10;
select * from t1 where a>10;
set debug_dbug='';
SET debug_dbug= @saved_dbug;
set global general_log=1;
set global log_queries_not_using_indexes=default;
drop table t1;

View File

@ -9,7 +9,8 @@ create table t1 (a int, b int) engine=memory;
insert t1 select seq, seq+1 from seq_1_to_1000;
set global general_log=0;
set global log_queries_not_using_indexes=1;
set debug_dbug='+d,simulate_file_write_error';
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,simulate_file_write_error';
--disable_result_log
--let $run= 50
while ($run)
@ -18,7 +19,7 @@ while ($run)
dec $run;
}
--enable_result_log
set debug_dbug='';
SET debug_dbug= @saved_dbug;
set global general_log=1;
set global log_queries_not_using_indexes=default;
drop table t1;

View File

@ -1,11 +1,12 @@
call mtr.add_suppression("No space left on device");
create table t1 (a varchar(255), b varchar(255), c varchar(255));
set use_stat_tables=PREFERABLY, optimizer_use_condition_selectivity=3;
set debug_dbug='+d,simulate_file_write_error';
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,simulate_file_write_error';
set @@max_heap_table_size=128*1024;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze Error Error writing file 'tmp-file' (Errcode: 28 "No space left on device")
test.t1 analyze status Operation failed
set debug_dbug='';
SET debug_dbug= @saved_dbug;
drop table t1;

View File

@ -16,9 +16,10 @@ while ($i) {
}
--enable_query_log
set use_stat_tables=PREFERABLY, optimizer_use_condition_selectivity=3;
set debug_dbug='+d,simulate_file_write_error';
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,simulate_file_write_error';
set @@max_heap_table_size=128*1024;
--replace_regex /'.*'/'tmp-file'/
analyze table t1;
set debug_dbug='';
SET debug_dbug= @saved_dbug;
drop table t1;

View File

@ -1,5 +1,7 @@
create table t1 (i tinyint);
set debug_dbug='+d,bug11747970_raise_error';
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,bug11747970_raise_error';
insert into t1 (i) select i from t1 union select i from t1;
ERROR 70100: Query execution was interrupted
drop table t1;
SET debug_dbug= @saved_dbug;

View File

@ -3,7 +3,9 @@
#
--source include/have_debug.inc
create table t1 (i tinyint);
set debug_dbug='+d,bug11747970_raise_error';
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,bug11747970_raise_error';
--error ER_QUERY_INTERRUPTED
insert into t1 (i) select i from t1 union select i from t1;
drop table t1;
SET debug_dbug= @saved_dbug;

View File

@ -1,5 +1,6 @@
drop table if exists t1;
create table t1 (a int primary key) engine=innodb;
SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,warn_during_ha_commit_trans";
INSERT INTO t1 VALUES (1);
Warnings:
@ -8,3 +9,4 @@ SHOW WARNINGS;
Level Code Message
Warning 1196 Some non-transactional changed tables couldn't be rolled back
drop table t1;
SET debug_dbug= @saved_dbug;

View File

@ -9,6 +9,7 @@ create table t1 (a int primary key) engine=innodb;
# Test that warnings produced during autocommit (after calling
# set_ok_status()) are still reported to the client.
SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,warn_during_ha_commit_trans";
INSERT INTO t1 VALUES (1);
# The warning will be shown automatically by mysqltest; there was a bug where
@ -17,3 +18,4 @@ INSERT INTO t1 VALUES (1);
SHOW WARNINGS;
drop table t1;
SET debug_dbug= @saved_dbug;

View File

@ -15,12 +15,13 @@ RESET MASTER;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
INSERT INTO t1 VALUES(0);
SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug='+d,fail_binlog_write_1';
--error ER_ERROR_ON_WRITE
INSERT INTO t1 VALUES(1);
--error ER_ERROR_ON_WRITE
INSERT INTO t1 VALUES(2);
SET SESSION debug_dbug='';
SET SESSION debug_dbug=@saved_dbug;
INSERT INTO t1 VALUES(3);
SELECT * FROM t1;

View File

@ -2,12 +2,13 @@ CALL mtr.add_suppression("Error writing file 'master-bin'");
RESET MASTER;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
INSERT INTO t1 VALUES(0);
SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug='+d,fail_binlog_write_1';
INSERT INTO t1 VALUES(1);
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
INSERT INTO t1 VALUES(2);
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
SET SESSION debug_dbug='';
SET SESSION debug_dbug=@saved_dbug;
INSERT INTO t1 VALUES(3);
SELECT * FROM t1;
a

View File

@ -12,92 +12,109 @@ DROP VIEW IF EXISTS v1, v2;
#
# Test injecting binlog write error when executing queries
#
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE TABLE t1 (a INT);
CREATE TABLE t1 (a INT);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
INSERT INTO t1 VALUES (1),(2),(3);
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
INSERT INTO t1 VALUES (4),(5),(6);
INSERT INTO t1 VALUES (4),(5),(6);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
UPDATE t1 set a=a+1;
UPDATE t1 set a=a+1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DELETE FROM t1;
DELETE FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100);
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP TRIGGER tr1;
DROP TRIGGER tr1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
ALTER TABLE t1 ADD (b INT);
ALTER TABLE t1 ADD (b INT);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE VIEW v1 AS SELECT a FROM t1;
CREATE VIEW v1 AS SELECT a FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP VIEW v1;
DROP VIEW v1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1;
CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP PROCEDURE p1;
DROP PROCEDURE p1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP TABLE t1;
DROP TABLE t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE FUNCTION f1() RETURNS INT return 1;
CREATE FUNCTION f1() RETURNS INT return 1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP FUNCTION f1;
DROP FUNCTION f1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE USER user1;
CREATE USER user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP USER user1;
DROP USER user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
#
# Cleanup
#

View File

@ -2,12 +2,13 @@ CALL mtr.add_suppression("Error writing file 'master-bin'");
RESET MASTER;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
INSERT INTO t1 VALUES(0);
SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug='+d,fail_binlog_write_1';
INSERT INTO t1 VALUES(1);
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
INSERT INTO t1 VALUES(2);
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
SET SESSION debug_dbug='';
SET SESSION debug_dbug=@saved_dbug;
INSERT INTO t1 VALUES(3);
SELECT * FROM t1;
a

View File

@ -12,92 +12,109 @@ DROP VIEW IF EXISTS v1, v2;
#
# Test injecting binlog write error when executing queries
#
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE TABLE t1 (a INT);
CREATE TABLE t1 (a INT);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
INSERT INTO t1 VALUES (1),(2),(3);
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
INSERT INTO t1 VALUES (4),(5),(6);
INSERT INTO t1 VALUES (4),(5),(6);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
UPDATE t1 set a=a+1;
UPDATE t1 set a=a+1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DELETE FROM t1;
DELETE FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100);
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP TRIGGER tr1;
DROP TRIGGER tr1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
ALTER TABLE t1 ADD (b INT);
ALTER TABLE t1 ADD (b INT);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE VIEW v1 AS SELECT a FROM t1;
CREATE VIEW v1 AS SELECT a FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP VIEW v1;
DROP VIEW v1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1;
CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP PROCEDURE p1;
DROP PROCEDURE p1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP TABLE t1;
DROP TABLE t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE FUNCTION f1() RETURNS INT return 1;
CREATE FUNCTION f1() RETURNS INT return 1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP FUNCTION f1;
DROP FUNCTION f1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE USER user1;
CREATE USER user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP USER user1;
DROP USER user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
#
# Cleanup
#

View File

@ -76,6 +76,7 @@ connection master;
set @@global.binlog_checksum = CRC32;
insert into t1 values (1) /* will not be applied on slave due to simulation */;
connection slave;
set @saved_dbug = @@global.debug_dbug;
set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
@ -83,15 +84,16 @@ Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary
select count(*) as zero from t1;
zero
0
set @@global.debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
connection slave;
include/start_slave.inc
connection master;
set @@global.master_verify_checksum = 1;
set @save_dbug = @@session.debug_dbug;
set @@session.debug_dbug='d,simulate_checksum_test_failure';
show binlog events;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
set @@session.debug_dbug='';
SET debug_dbug= @save_dbug;
set @@global.master_verify_checksum = default;
connection slave;
connection slave;
@ -99,10 +101,11 @@ include/stop_slave.inc
connection master;
create table t2 (a int);
connection slave;
set @saved_dbug = @@global.debug_dbug;
set @@global.debug_dbug='d,simulate_checksum_test_failure';
start slave io_thread;
include/wait_for_slave_io_error.inc [errno=1595,1913]
set @@global.debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
start slave io_thread;
include/wait_for_slave_param.inc [Read_Master_Log_Pos]
set @@global.slave_sql_verify_checksum = 1;
@ -110,7 +113,7 @@ set @@global.debug_dbug='d,simulate_checksum_test_failure';
start slave sql_thread;
include/wait_for_slave_sql_error.inc [errno=1593]
Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at position 4'
set @@global.debug_dbug='';
set @@global.debug_dbug = @saved_dbug;
include/start_slave.inc
connection master;
connection slave;

View File

@ -13,6 +13,7 @@ connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100));
include/stop_slave.inc
# 2. Corruption in master binlog and SHOW BINLOG EVENTS
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char";
SHOW BINLOG EVENTS;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
@ -55,9 +56,9 @@ connection slave;
include/diff_tables.inc [master:test.t1, slave:test.t1]
# 8. Clean up
connection master;
SET GLOBAL debug_dbug= "";
set @@global.debug_dbug = @saved_dbug;
SET GLOBAL master_verify_checksum = @old_master_verify_checksum;
DROP TABLE t1;
connection slave;
SET GLOBAL debug_dbug= "";
set @@global.debug_dbug = @saved_dbug;
include/rpl_end.inc

View File

@ -14,6 +14,7 @@ a
1
2
3
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*';
REPLACE INTO t1 VALUES (4);
SELECT * FROM t1;
@ -22,6 +23,7 @@ a
2
3
4
set @@global.debug_dbug = @saved_dbug;
connection slave;
call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590");
include/wait_for_slave_sql_error.inc [errno=1590]

View File

@ -4,12 +4,13 @@ connection slave;
stop slave;
reset slave;
connection slave;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
include/wait_for_slave_sql_error.inc [errno=1593]
Last_SQL_Error = 'Failed during slave thread initialization'
call mtr.add_suppression("Failed during slave.* thread initialization");
SET GLOBAL debug_dbug= "";
set @@global.debug_dbug = @saved_dbug;
connection slave;
reset slave;
SET GLOBAL init_slave= "garbage";

View File

@ -11,39 +11,59 @@
##############################################################################
GCF-1081 : MDEV-18283 Galera test failure on galera.GCF-1081
GCF-939 : MDEV-21520 galera.GCF-939
MDEV-16509 : MDEV-21523 galera.MDEV-16509
MDEV-20225 : MDEV-20886 galera.MDEV-20225
MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill
MW-328A : MDEV-21483 galera.MW-328A galera.MW-328B
MW-328B : MDEV-21483 galera.MW-328A galera.MW-328B
MW-329 : MDEV-19962 Galera test failure on MW-329
MW-336 : MDEV-21409: Galera test failure on MW-336
MW-360 : needs rewrite to be MariaDB gtid compatible
MW-388: MDEV-19803 Long semaphore wait error on galera.MW-388
galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults
galera_account_management : MariaDB 10.0 does not support ALTER USER
galera_as_master_gtid : Requires MySQL GTID
galera_as_master_gtid_change_master : Requires MySQL GTID
galera_as_slave_gtid_myisam : MDEV-21421 galera.galera_as_slave_gtid_myisam
galera_as_slave_gtid_replicate_do_db_cc : Requires MySQL GTID
galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()
galera_bf_abort_group_commit : MDEV-18282 Galera test failure on galera.galera_bf_abort_group_commit
galera_autoinc_sst_mariabackup : Known issue, may require porting MDEV-17458 from later versions
galera_bf_abort_group_commit : MDEV-18282 Galera test failure on galera.galera_bf_abort_group_commit
galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events
galera_binlog_stmt_autoinc: MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc
galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc
galera_concurrent_ctas : MDEV-18180 Galera test failure on galera.galera_concurrent_ctas
galera_encrypt_tmp_files : Get error failed to enable encryption of temporary files
galera_flush : MariaDB does not have global.thread_statistics
galera_ftwrl : MDEV-21525 galera.galera_ftwrl
galera_gcache_recover_manytrx : MDEV-18834 Galera test failure
galera_ist_mariabackup : MDEV-18829 test leaves port open
galera_ist_progress : MDEV-15236 fails when trying to read transfer status
galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_largechanges
galera_kill_nochanges : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges
galera_load_data : MDEV-19968 galera.galera_load_data
galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk
galera_mdl_race : MDEV-21524 galera.galera_mdl_race
galera_migrate : MariaDB does not support START SLAVE USER
galera_parallel_autoinc_largetrx : MDEV-20916 galera.galera_parallel_autoinc_largetrx
galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb
galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim
galera_split_brain : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges
galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade
galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key
galera_sst_mariabackup_table_options: MDEV-19741 Galera test failure on galera.galera_sst_mariabackup_table_options
galera_toi_ddl_nonconflicting : MDEV-21518 galera.galera_toi_ddl_nonconflicting
galera_var_innodb_disallow_writes : MDEV-20928 galera.galera_var_innodb_disallow_writes
galera_var_node_address : MDEV-20485 Galera test failure
galera_var_notify_cmd : MDEV-20600 Galera test galera_var_notify_cmd causes hang
galera_var_notify_cmd : MDEV-21488,MDEV-20600
galera_var_reject_queries : assertion in inline_mysql_socket_send
galera_var_retry_autocommit: MDEV-18181 Galera test failure on galera.galera_var_retry_autocommit
galera_wan : MDEV-17259 Test failure on galera.galera_wan
galera_wan_restart_sst : MDEV-21514 galera.galera_wan_restart_sst
galera_wsrep_new_cluster : MDEV-21515 galera.galera_wsrep_new_cluster
mysql-wsrep#198 : MDEV-18935 Galera test mysql-wsrep#198 sporaric assertion transaction.cpp:362: int wsrep::transaction::before_commit(): Assertion `state() == s_executing || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed.
mysql-wsrep#33 : MDEV-21420 galera.mysql-wsrep#33
partition : MDEV-19958 Galera test failure on galera.partition
query_cache: MDEV-15805 Test failure on galera.query_cache
sql_log_bin : MDEV-21491 galera.sql_log_bin
versioning_trx_id : MDEV-18590 galera.versioning_trx_id

View File

@ -20,18 +20,16 @@ connection node_1a;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
connection node_1;
SET SESSION wsrep_sync_wait = 0;
SET SESSION DEBUG_SYNC = 'wsrep_after_certification SIGNAL wsrep_after_certification_reached WAIT_FOR wsrep_after_certification_continue';
CALL insert_proc ();;
connection node_1a;
SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_certification_reached";
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL DEBUG_DBUG = "";
SET DEBUG_SYNC = "now SIGNAL wsrep_after_certification_continue";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
connection node_2;
connection node_1;
SELECT @errno `expect 1213`;
expect 1213
1213
SELECT @errno = 1213;
@errno = 1213
1
SELECT * FROM t1;
f1 f2
1 node 2

View File

@ -16,6 +16,7 @@ SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFIN
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def test event_2 root@localhost SQL INSERT INTO event_table VALUES (1) RECURRING NULL 1 SECOND ENABLED NOT PRESERVE
connection node_2;
set global wsrep_sync_wait=15;
# node_2 event should be there
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT

View File

@ -0,0 +1,36 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_2;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
SET GLOBAL wsrep_slave_threads = 2;
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
connection node_1;
INSERT INTO t1 VALUES (1, 'node_1');;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a;
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
connection node_2;
SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_retry_autocommit = 0;
INSERT INTO t1 VALUES (1, 'node_2');;
connection node_2a;
SET SESSION wsrep_sync_wait = 0;
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
connection node_2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_1;
connection node_2a;
SET GLOBAL DEBUG_DBUG = "";
SET DEBUG_SYNC = "RESET";
disconnect node_2a;
connection node_2;
connection node_1;
SET SESSION wsrep_sync_wait = 0;
Performing --wsrep-recover ...
connection node_2;
Using --wsrep-start-position when starting mysqld ...
connection node_1;
DROP TABLE t1;
SET GLOBAL wsrep_slave_threads = DEFAULT;

View File

@ -0,0 +1,36 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
SET GLOBAL wsrep_slave_threads = 2;
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
connection node_2;
INSERT INTO t1 VALUES (1, 'node_2');;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
SET SESSION wsrep_sync_wait=0;
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
connection node_1;
SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_retry_autocommit = 0;
INSERT INTO t1 VALUES (1, 'node_1');;
connection node_1a;
SET GLOBAL DEBUG_DBUG = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_2;
connection node_2;
connection node_1;
SET SESSION wsrep_sync_wait = 0;
Performing --wsrep-recover ...
connection node_2;
Using --wsrep-start-position when starting mysqld ...
connection node_1;
DROP TABLE t1;
SET GLOBAL wsrep_slave_threads = DEFAULT;
connection node_1a;
SET GLOBAL DEBUG_DBUG=NULL;
SET DEBUG_SYNC = "RESET";

View File

@ -13,6 +13,7 @@
--source include/galera_cluster.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/galera_have_debug_sync.inc
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT);
INSERT INTO t1 VALUES (1, 0), (5, 0);

View File

@ -1,5 +1,6 @@
--source include/galera_cluster.inc
--source include/have_debug_sync.inc
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
@ -30,6 +31,8 @@ DELIMITER ;|
SET GLOBAL wsrep_slave_threads = 2;
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
--connection node_2
--send INSERT INTO t1 VALUES (1, 'node 2');
@ -39,25 +42,24 @@ SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
--connection node_1
SET SESSION wsrep_sync_wait = 0;
SET SESSION DEBUG_SYNC = 'wsrep_after_certification SIGNAL wsrep_after_certification_reached WAIT_FOR wsrep_after_certification_continue';
--send CALL insert_proc ();
--connection node_1a
SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_certification_reached";
SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'
--source include/wait_condition.inc
SET GLOBAL DEBUG_DBUG = "";
SET DEBUG_SYNC = "now SIGNAL wsrep_after_certification_continue";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
--connection node_2
--reap
--connection node_1
# We expect no errors here, because the handler in insert_proc()
# caught the deadlock error
# We expect no errors here, because the handler in insert_proc() caught the deadlock error
--reap
SELECT @errno `expect 1213`;
SELECT @errno = 1213;
SELECT * FROM t1;
--connection node_2

View File

@ -23,6 +23,7 @@ DO
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2';
--connection node_2
set global wsrep_sync_wait=15;
--echo # node_2 event should be there
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2';
@ -66,6 +67,9 @@ ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
--source include/wait_condition.inc
use events_test;
--echo "The definer should be ev_test@localhost"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';

View File

@ -0,0 +1,98 @@
#
# Check that wsrep position is updated in innodb after
# a local certification failure.
#
--source include/galera_cluster.inc
--source include/have_debug_sync.inc
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
#
# Cause a certification failure. The INSERT on node_2 will fail certification,
# and it is going to be the last event before shutting down node_2.
#
--connection node_2
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
SET GLOBAL wsrep_slave_threads = 2;
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
--connection node_1
--send INSERT INTO t1 VALUES (1, 'node_1');
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2a
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
--connection node_2
SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_retry_autocommit = 0;
--send INSERT INTO t1 VALUES (1, 'node_2');
--connection node_2a
SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'
--source include/wait_condition.inc
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
--connection node_2
--error ER_LOCK_DEADLOCK
--reap
--connection node_1
--reap
--connection node_2a
SET GLOBAL DEBUG_DBUG = "";
SET DEBUG_SYNC = "RESET";
#
# Keep track of the current position in variable $expected_position
#
--let $expected_position_uuid = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'`
--let $expected_position_seqno = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--let $expected_position = $expected_position_uuid:$expected_position_seqno
--disconnect node_2a
#
# Shutdown node 2
#
--connection node_2
--source include/shutdown_mysqld.inc
--connection node_1
SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
#
# Check that start position matches the position we recorded
# before shutdown in $expected_position
#
--let $galera_wsrep_recover_server_id = 2
--source suite/galera/include/galera_wsrep_recover.inc
if ($galera_wsrep_start_position != $expected_position)
{
--exec echo "expected position $expected_position"
--exec echo "recover position $galera_wsrep_start_position"
die("Expected position and recover position did not match");
}
#
# Restart node 2 and cleanup
#
--connection node_2
--source include/start_mysqld.inc
--connection node_1
DROP TABLE t1;
SET GLOBAL wsrep_slave_threads = DEFAULT;
--source include/auto_increment_offset_restore.inc

View File

@ -0,0 +1,99 @@
#
# Check that wsrep position is updated in innodb after
# a dummy write set is applied.
#
--source include/galera_cluster.inc
--source include/have_debug_sync.inc
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
#
# Cause a certification failure. The INSERT on in node_1 will fail certification,
# and will result in a dummy writeset on node_2. This is going to be the last
# writeset before shutting down node_2.
#
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
SET GLOBAL wsrep_slave_threads = 2;
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
--connection node_2
--send INSERT INTO t1 VALUES (1, 'node_2');
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1a
SET SESSION wsrep_sync_wait=0;
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
--connection node_1
SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_retry_autocommit = 0;
--send INSERT INTO t1 VALUES (1, 'node_1');
--connection node_1a
--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'
--source include/wait_condition.inc
SET GLOBAL DEBUG_DBUG = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
--connection node_1
--error ER_LOCK_DEADLOCK
--reap
--connection node_2
--reap
#
# Keep track of the current position in variable $expected_position
#
--let $expected_position_uuid = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'`
--let $expected_position_seqno = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--let $expected_position = $expected_position_uuid:$expected_position_seqno
#
# Shutdown node 2
#
--connection node_2
--source include/shutdown_mysqld.inc
--connection node_1
SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
#
# Check that start position matches the position we recorded
# before shutdown in $expected_position
#
--let $galera_wsrep_recover_server_id = 2
--source suite/galera/include/galera_wsrep_recover.inc
if ($galera_wsrep_start_position != $expected_position)
{
--exec echo "expected position $expected_position"
--exec echo "recover position $galera_wsrep_start_position"
die("Expected position and recover position did not match");
}
#
# Restart the node 2 and cleanup
#
--connection node_2
--source include/start_mysqld.inc
--connection node_1
DROP TABLE t1;
SET GLOBAL wsrep_slave_threads = DEFAULT;
--source include/auto_increment_offset_restore.inc
--connection node_1a
SET GLOBAL DEBUG_DBUG=NULL;
SET DEBUG_SYNC = "RESET";

View File

@ -1,3 +1,18 @@
galera_sr_table_contents : missing file
GCF-437 : test relies on InnoDB redo log size limitation
##############################################################################
#
# List the test cases that are to be disabled temporarily.
#
# Separate the test case name and the comment with ':'.
#
# <testcasename> : MDEV-<xxxx> <comment>
#
# Do not use any TAB characters for whitespace.
#
##############################################################################
GCF-1043A : MDEV-21170 Galera test failure on galera_sr.GCF-1043A
GCF-437 : test relies on InnoDB redo log size limitation
GCF-561 : MDEV-21517 galera_sr.GCF-561
GCF_1060 : MDEV-20848 galera_sr.GCF_1060
galera-features#56 : MDEV-18542 galera_sr.galera-features#56
galera_sr_table_contents : missing file

View File

@ -11,3 +11,5 @@
##############################################################################
create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails
innodb_wl6326 : MDEV-21535 Too broad ha_innobase::records_in_range()
innodb_wl6326_big : MDEV-21537 invalid DEFAULT for ENUM NOT NULL column

View File

@ -7,9 +7,11 @@ insert into t1 values (1, repeat('*', 50000));
select f1, substring(f2, 1, 40) from t1;
f1 substring(f2, 1, 40)
1 ****************************************
set debug_dbug = 'd,row_ins_index_entry_timeout';
set @saved_debug = @@session.debug_dbug;
SET debug_dbug = 'd,row_ins_index_entry_timeout';
update t1 set f1 = 3;
select f1, substring(f2, 1, 40) from t1;
f1 substring(f2, 1, 40)
3 ****************************************
drop table t1;
SET debug_dbug= @saved_debug;

View File

@ -5,10 +5,10 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2),
key k2(f3)) engine=innodb;
insert into t1 values (14, 24, 34);
set @old_dbug= @@session.debug_dbug;
set debug_dbug = '+d,row_ins_sec_index_entry_timeout';
SET debug_dbug = '+d,row_ins_sec_index_entry_timeout';
replace into t1 values (14, 25, 34);
select * from t1;
f1 f2 f3
14 25 34
drop table t1;
set debug_dbug = @old_dbug;
SET debug_dbug = @old_dbug;

View File

@ -1,4 +1,5 @@
call mtr.add_suppression("InnoDB: Warning: Index.*");
SET @saved_dbug = @@SESSION.debug_dbug;
set DEBUG_DBUG='+d,ib_ha_innodb_stat_not_initialized';
create table t1(a int not null primary key, b int, c int, key(b), key(c)) engine=innodb;
create procedure innodb_insert_proc (repeat_count int)
@ -27,6 +28,6 @@ count(1)
select count(1) from t1 where c between 7 and 787;
count(1)
781
set DEBUG_DBUG=NULL;
drop procedure innodb_insert_proc;
drop table t1;
SET debug_dbug= @saved_dbug;

View File

@ -389,7 +389,7 @@ CREATE TABLE testdb_wl5522.t1 ( i bigint) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Column i precise type mismatch.)
ERROR HY000: Schema mismatch (Column i precise type mismatch, it's 0X408 in the table and 0X403 in the tablespace meta file)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE testdb_wl5522.t1;

View File

@ -431,7 +431,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Column c2 precise type mismatch.)
ERROR HY000: Schema mismatch (Column c2 precise type mismatch, it's 0X408 in the table and 0X403 in the tablespace meta file)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;

View File

@ -1,3 +1,5 @@
CREATE TABLE bug11754376 (c INT) ENGINE=INNODB;
SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION DEBUG_DBUG='+d,test_normalize_table_name_low';
DROP TABLE bug11754376;
SET debug_dbug= @saved_dbug;

View File

@ -0,0 +1,122 @@
SET GLOBAL innodb_adaptive_hash_index = false;
SET GLOBAL innodb_stats_persistent = false;
connect purge_control,localhost,root,,;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connect con2,localhost,root,,;
CREATE TABLE t1 (
a00 CHAR(255) NOT NULL DEFAULT 'a',
a01 CHAR(255) NOT NULL DEFAULT 'a',
a02 CHAR(255) NOT NULL DEFAULT 'a',
b INT NOT NULL DEFAULT 0,
PRIMARY KEY(a00, a01, a02)
) charset latin1 ENGINE = InnoDB COMMENT='MERGE_THRESHOLD=45';
SET GLOBAL innodb_limit_optimistic_insert_debug = 3;
CREATE PROCEDURE data_load_t1()
BEGIN
DECLARE c1 INT DEFAULT 97;
DECLARE c2 INT DEFAULT 97;
DECLARE c3 INT DEFAULT 97;
WHILE c1 < 102 DO
WHILE c2 < 123 DO
WHILE c3 < 123 DO
INSERT INTO t1 (a00) VALUES (CHAR(c1,c2,c3));
SET c3 = c3 + 1;
END WHILE;
SET c3 = 97;
SET c2 = c2 + 1;
END WHILE;
SET c2 = 97;
SET c1 = c1 + 1;
END WHILE;
END |
call data_load_t1();
DROP PROCEDURE data_load_t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
1856
connection con2;
DELETE FROM t1 WHERE a00 = 'cnm';
COMMIT;
BEGIN;
INSERT INTO t1 SET a00 = 'cnm';
connection purge_control;
COMMIT;
connection con2;
SET GLOBAL innodb_limit_optimistic_insert_debug = 0;
ROLLBACK;
# Test start
connection purge_control;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection con2;
DELETE FROM t1 WHERE a00 = 'bii';
COMMIT;
BEGIN;
INSERT INTO t1 SET a00 = 'bii';
SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2';
SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume';
ROLLBACK;
connection purge_control;
SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait';
COMMIT;
SET DEBUG_SYNC = 'now SIGNAL roll2';
connect con1,localhost,root,,;
SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting';
SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
SELECT a00 FROM t1 WHERE a00 = 'bii';
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR lockwait1';
SET DEBUG_SYNC = 'now SIGNAL resume';
connection con1;
a00
connection con2;
connection default;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
1856
DELETE FROM t1 WHERE a00 = 'dpn';
COMMIT;
INSERT INTO t1 SET a00 = 'dpn';
ROLLBACK;
ALTER TABLE t1 COMMENT='MERGE_THRESHOLD=35';
connection purge_control;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection con2;
DELETE FROM t1 WHERE a00 = 'cnd';
COMMIT;
BEGIN;
INSERT INTO t1 SET a00 = 'cnd';
SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2';
SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume EXECUTE 2';
ROLLBACK;
connection purge_control;
SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait';
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SET DEBUG_SYNC = 'now SIGNAL roll2';
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
SET DEBUG_SYNC = 'now SIGNAL resume';
SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
disconnect purge_control;
connection default;
SET DEBUG_SYNC = 'now SIGNAL resume';
disconnect con1;
connection con2;
disconnect con2;
connection default;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
1856
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;

View File

@ -1,5 +1,6 @@
SET GLOBAL innodb_file_per_table=0;
create table bug56947(a int not null) engine = innodb;
SET @saved_dbug = @@SESSION.debug_dbug;
SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename';
alter table bug56947 add unique index (a);
ERROR HY000: Got error 11 "xxx" from storage engine InnoDB
@ -8,3 +9,4 @@ Table Op Msg_type Msg_text
test.bug56947 check status OK
drop table bug56947;
SET @@global.innodb_file_per_table=DEFAULT;
SET debug_dbug= @saved_dbug;

View File

@ -24,7 +24,7 @@ test.corrupt_bit_test_ā check Warning InnoDB: Index idx is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: Index idxā is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: Index idxē is marked as corrupted
test.corrupt_bit_test_ā check error Corrupt
SET debug_dbug = @save_dbug;
SET @@SESSION.debug_dbug = @save_dbug;
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
ERROR HY000: Index idx is corrupted
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);

View File

@ -4,6 +4,7 @@ drop table if exists t1;
connection con1;
create table t1 (id integer, x integer) engine = InnoDB;
insert into t1 values(0, 0);
SET @saved_dbug = @@SESSION.debug_dbug;
set DEBUG_DBUG='+d,fatal-semaphore-timeout';
set autocommit=0;
# Sending query on con1,
@ -21,6 +22,6 @@ connection default;
# Waitting for reconnect after mysqld restarts
# Reconnected after mysqld was successfully restarted
# Cleaning up before exit
set DEBUG_DBUG=NULL;
SET debug_dbug = @saved_dbug;
drop table if exists t1;
# Clean exit

View File

@ -0,0 +1,387 @@
SET GLOBAL innodb_adaptive_hash_index = false;
SET GLOBAL innodb_stats_persistent = false;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connect con3,localhost,root,,;
CREATE TABLE t1 (
a00 CHAR(255) NOT NULL DEFAULT 'a',
a01 CHAR(255) NOT NULL DEFAULT 'a',
a02 CHAR(255) NOT NULL DEFAULT 'a',
a03 CHAR(255) NOT NULL DEFAULT 'a',
a04 CHAR(255) NOT NULL DEFAULT 'a',
a05 CHAR(255) NOT NULL DEFAULT 'a',
a06 CHAR(255) NOT NULL DEFAULT 'a',
b INT NOT NULL DEFAULT 0
) ENGINE = InnoDB;
ALTER TABLE t1 ADD PRIMARY KEY(
a00,
a01,
a02,
a03,
a04,
a05,
a06
);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
1
SET GLOBAL innodb_limit_optimistic_insert_debug = 7;
INSERT INTO t1 (a00) VALUES ('aa');
INSERT INTO t1 (a00) VALUES ('ab');
INSERT INTO t1 (a00) VALUES ('ac');
INSERT INTO t1 (a00) VALUES ('ad');
INSERT INTO t1 (a00) VALUES ('ae');
INSERT INTO t1 (a00) VALUES ('af');
INSERT INTO t1 (a00) VALUES ('ag');
INSERT INTO t1 (a00) VALUES ('ah');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
3
INSERT INTO t1 (a00) VALUES ('ai');
INSERT INTO t1 (a00) VALUES ('aj');
INSERT INTO t1 (a00) VALUES ('ak');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
4
INSERT INTO t1 (a00) VALUES ('al');
INSERT INTO t1 (a00) VALUES ('am');
INSERT INTO t1 (a00) VALUES ('an');
INSERT INTO t1 (a00) VALUES ('ao');
INSERT INTO t1 (a00) VALUES ('ap');
INSERT INTO t1 (a00) VALUES ('aq');
INSERT INTO t1 (a00) VALUES ('ar');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
5
INSERT INTO t1 (a00) VALUES ('as');
INSERT INTO t1 (a00) VALUES ('at');
INSERT INTO t1 (a00) VALUES ('au');
INSERT INTO t1 (a00) VALUES ('av');
INSERT INTO t1 (a00) VALUES ('aw');
INSERT INTO t1 (a00) VALUES ('ax');
INSERT INTO t1 (a00) VALUES ('ay');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
6
INSERT INTO t1 (a00) VALUES ('az');
INSERT INTO t1 (a00) VALUES ('ba');
INSERT INTO t1 (a00) VALUES ('bb');
INSERT INTO t1 (a00) VALUES ('bc');
INSERT INTO t1 (a00) VALUES ('bd');
INSERT INTO t1 (a00) VALUES ('be');
INSERT INTO t1 (a00) VALUES ('bf');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
7
INSERT INTO t1 (a00) VALUES ('bg');
INSERT INTO t1 (a00) VALUES ('bh');
INSERT INTO t1 (a00) VALUES ('bi');
INSERT INTO t1 (a00) VALUES ('bj');
INSERT INTO t1 (a00) VALUES ('bk');
INSERT INTO t1 (a00) VALUES ('bl');
INSERT INTO t1 (a00) VALUES ('bm');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
8
INSERT INTO t1 (a00) VALUES ('bn');
INSERT INTO t1 (a00) VALUES ('bo');
INSERT INTO t1 (a00) VALUES ('bp');
INSERT INTO t1 (a00) VALUES ('bq');
INSERT INTO t1 (a00) VALUES ('br');
INSERT INTO t1 (a00) VALUES ('bs');
INSERT INTO t1 (a00) VALUES ('bt');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
11
INSERT INTO t1 (a00) VALUES ('bu');
INSERT INTO t1 (a00) VALUES ('bv');
INSERT INTO t1 (a00) VALUES ('bw');
INSERT INTO t1 (a00) VALUES ('bx');
INSERT INTO t1 (a00) VALUES ('by');
INSERT INTO t1 (a00) VALUES ('bz');
INSERT INTO t1 (a00) VALUES ('ca');
INSERT INTO t1 (a00) VALUES ('cb');
INSERT INTO t1 (a00) VALUES ('cc');
INSERT INTO t1 (a00) VALUES ('cd');
INSERT INTO t1 (a00) VALUES ('ce');
INSERT INTO t1 (a00) VALUES ('cf');
INSERT INTO t1 (a00) VALUES ('cg');
INSERT INTO t1 (a00) VALUES ('ch');
INSERT INTO t1 (a00) VALUES ('ci');
INSERT INTO t1 (a00) VALUES ('cj');
INSERT INTO t1 (a00) VALUES ('ck');
INSERT INTO t1 (a00) VALUES ('cl');
INSERT INTO t1 (a00) VALUES ('cm');
INSERT INTO t1 (a00) VALUES ('cn');
INSERT INTO t1 (a00) VALUES ('co');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
15
INSERT INTO t1 (a00) VALUES ('cp');
INSERT INTO t1 (a00) VALUES ('cq');
INSERT INTO t1 (a00) VALUES ('cr');
INSERT INTO t1 (a00) VALUES ('cs');
INSERT INTO t1 (a00) VALUES ('ct');
INSERT INTO t1 (a00) VALUES ('cu');
INSERT INTO t1 (a00) VALUES ('cv');
INSERT INTO t1 (a00) VALUES ('cw');
INSERT INTO t1 (a00) VALUES ('cx');
INSERT INTO t1 (a00) VALUES ('cy');
INSERT INTO t1 (a00) VALUES ('cz');
INSERT INTO t1 (a00) VALUES ('da');
INSERT INTO t1 (a00) VALUES ('db');
INSERT INTO t1 (a00) VALUES ('dc');
INSERT INTO t1 (a00) VALUES ('dd');
INSERT INTO t1 (a00) VALUES ('de');
INSERT INTO t1 (a00) VALUES ('df');
INSERT INTO t1 (a00) VALUES ('dg');
INSERT INTO t1 (a00) VALUES ('dh');
INSERT INTO t1 (a00) VALUES ('di');
INSERT INTO t1 (a00) VALUES ('dj');
INSERT INTO t1 (a00) VALUES ('dk');
INSERT INTO t1 (a00) VALUES ('dl');
INSERT INTO t1 (a00) VALUES ('dm');
INSERT INTO t1 (a00) VALUES ('dn');
INSERT INTO t1 (a00) VALUES ('do');
INSERT INTO t1 (a00) VALUES ('dp');
INSERT INTO t1 (a00) VALUES ('dq');
INSERT INTO t1 (a00) VALUES ('dr');
INSERT INTO t1 (a00) VALUES ('ds');
INSERT INTO t1 (a00) VALUES ('dt');
INSERT INTO t1 (a00) VALUES ('du');
INSERT INTO t1 (a00) VALUES ('dv');
INSERT INTO t1 (a00) VALUES ('dw');
INSERT INTO t1 (a00) VALUES ('dx');
INSERT INTO t1 (a00) VALUES ('dy');
INSERT INTO t1 (a00) VALUES ('dz');
INSERT INTO t1 (a00) VALUES ('ea');
INSERT INTO t1 (a00) VALUES ('eb');
INSERT INTO t1 (a00) VALUES ('ec');
INSERT INTO t1 (a00) VALUES ('ed');
INSERT INTO t1 (a00) VALUES ('ee');
INSERT INTO t1 (a00) VALUES ('ef');
INSERT INTO t1 (a00) VALUES ('eg');
INSERT INTO t1 (a00) VALUES ('eh');
INSERT INTO t1 (a00) VALUES ('ei');
INSERT INTO t1 (a00) VALUES ('ej');
INSERT INTO t1 (a00) VALUES ('ek');
INSERT INTO t1 (a00) VALUES ('el');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
23
INSERT INTO t1 (a00) VALUES ('em');
INSERT INTO t1 (a00) VALUES ('en');
INSERT INTO t1 (a00) VALUES ('eo');
INSERT INTO t1 (a00) VALUES ('ep');
INSERT INTO t1 (a00) VALUES ('eq');
INSERT INTO t1 (a00) VALUES ('er');
INSERT INTO t1 (a00) VALUES ('es');
INSERT INTO t1 (a00) VALUES ('et');
INSERT INTO t1 (a00) VALUES ('eu');
INSERT INTO t1 (a00) VALUES ('ev');
INSERT INTO t1 (a00) VALUES ('ew');
INSERT INTO t1 (a00) VALUES ('ex');
INSERT INTO t1 (a00) VALUES ('ey');
INSERT INTO t1 (a00) VALUES ('ez');
INSERT INTO t1 (a00) VALUES ('fa');
INSERT INTO t1 (a00) VALUES ('fb');
INSERT INTO t1 (a00) VALUES ('fc');
INSERT INTO t1 (a00) VALUES ('fd');
INSERT INTO t1 (a00) VALUES ('fe');
INSERT INTO t1 (a00) VALUES ('ff');
INSERT INTO t1 (a00) VALUES ('fg');
INSERT INTO t1 (a00) VALUES ('fh');
INSERT INTO t1 (a00) VALUES ('fi');
INSERT INTO t1 (a00) VALUES ('fj');
INSERT INTO t1 (a00) VALUES ('fk');
INSERT INTO t1 (a00) VALUES ('fl');
INSERT INTO t1 (a00) VALUES ('fm');
INSERT INTO t1 (a00) VALUES ('fn');
INSERT INTO t1 (a00) VALUES ('fo');
INSERT INTO t1 (a00) VALUES ('fp');
INSERT INTO t1 (a00) VALUES ('fq');
INSERT INTO t1 (a00) VALUES ('fr');
INSERT INTO t1 (a00) VALUES ('fs');
INSERT INTO t1 (a00) VALUES ('ft');
INSERT INTO t1 (a00) VALUES ('fu');
INSERT INTO t1 (a00) VALUES ('fv');
INSERT INTO t1 (a00) VALUES ('fw');
INSERT INTO t1 (a00) VALUES ('fx');
INSERT INTO t1 (a00) VALUES ('fy');
INSERT INTO t1 (a00) VALUES ('fz');
INSERT INTO t1 (a00) VALUES ('ga');
INSERT INTO t1 (a00) VALUES ('gb');
INSERT INTO t1 (a00) VALUES ('gc');
INSERT INTO t1 (a00) VALUES ('gd');
INSERT INTO t1 (a00) VALUES ('ge');
INSERT INTO t1 (a00) VALUES ('gf');
INSERT INTO t1 (a00) VALUES ('gg');
INSERT INTO t1 (a00) VALUES ('gh');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
29
SET GLOBAL innodb_limit_optimistic_insert_debug = 0;
# Test start
SET DEBUG_SYNC = 'RESET';
INSERT INTO t1 (a00) VALUES ('bfa');
connection con1;
SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
INSERT INTO t1 (a00) VALUES ('bfb');
connection con2;
SET DEBUG_SYNC = 'now WAIT_FOR reached';
SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
a00 a01
aa a
SELECT a00,a01 FROM t1 WHERE a00 = 'aq';
a00 a01
aq a
SELECT a00,a01 FROM t1 WHERE a00 = 'cp';
a00 a01
cp a
SELECT a00,a01 FROM t1 WHERE a00 = 'el';
a00 a01
el a
SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
SELECT a00,a01 FROM t1 WHERE a00 = 'ar';
connection con3;
SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
SELECT a00,a01 FROM t1 WHERE a00 = 'cn';
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
SET DEBUG_SYNC = 'now SIGNAL continue';
connection con1;
Warnings:
Warning 1639 debug sync point wait timed out
connection con2;
a00 a01
ar a
connection con3;
a00 a01
cn a
connection default;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
30
SET DEBUG_SYNC = 'RESET';
INSERT INTO t1 (a00) VALUES ('coa');
connection con1;
SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
INSERT INTO t1 (a00) VALUES ('cob');
connection con2;
SET DEBUG_SYNC = 'now WAIT_FOR reached';
SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
connection con3;
SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
SELECT a00,a01 FROM t1 WHERE a00 = 'el';
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
SET DEBUG_SYNC = 'now SIGNAL continue';
connection con1;
connection con2;
a00 a01
aa a
connection con3;
a00 a01
el a
connection default;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
31
SET DEBUG_SYNC = 'RESET';
INSERT INTO t1 (a00) VALUES ('gba');
connection con1;
SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
INSERT INTO t1 (a00) VALUES ('gbb');
connection con2;
SET DEBUG_SYNC = 'now WAIT_FOR reached';
SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
a00 a01
aa a
SELECT a00,a01 FROM t1 WHERE a00 = 'ek';
a00 a01
ek a
SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
SELECT a00,a01 FROM t1 WHERE a00 = 'el';
connection con3;
SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
SELECT a00,a01 FROM t1 WHERE a00 = 'gb';
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
SET DEBUG_SYNC = 'now SIGNAL continue';
connection con1;
connection con2;
a00 a01
el a
connection con3;
a00 a01
gb a
connection default;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
CLUST_INDEX_SIZE
32
SET DEBUG_SYNC = 'RESET';
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
DROP TABLE t1;

View File

@ -0,0 +1,449 @@
CREATE SCHEMA my_schema;
USE my_schema;
CREATE FUNCTION f_thread_id (i INT) RETURNS CHAR(4) DETERMINISTIC
RETURN CONCAT(LPAD(CAST(i AS CHAR),3,'_'),'_') ;
SELECT CONCAT('->', f_thread_id( 1), '<-');
CONCAT('->', f_thread_id( 1), '<-')
->__1_<-
SELECT CONCAT('->', f_thread_id(12), '<-');
CONCAT('->', f_thread_id(12), '<-')
->_12_<-
SET @extra_int = 1;
SET @extra_string = f_thread_id(@extra_int);
SELECT @extra_int , @extra_string;
@extra_int @extra_string
1 __1_
CREATE FUNCTION f_col_int1 (i INT) RETURNS INT(20) DETERMINISTIC
RETURN i * 1000 + @extra_int ;
SELECT f_col_int1(my_col) AS my_result
FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
UNION SELECT 1234 UNION SELECT 12345) AS tx;
my_result
1001
12001
123001
1234001
12345001
CREATE FUNCTION f_col_int2 (i INT) RETURNS INT(20) DETERMINISTIC
RETURN @extra_int * 10000000 + i ;
SELECT f_col_int2(my_col) AS my_result
FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
UNION SELECT 1234 UNION SELECT 12345) AS tx;
my_result
10000001
10000012
10000123
10001234
10012345
CREATE FUNCTION f_col_int3 (i INT) RETURNS INT(20) DETERMINISTIC
RETURN @extra_int ;
SELECT f_col_int3(my_col) AS my_result
FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
UNION SELECT 1234 UNION SELECT 12345) AS tx;
my_result
1
1
1
1
1
CREATE FUNCTION f_col_blob (i INT) RETURNS BLOB DETERMINISTIC
RETURN RPAD(@extra_string,(@@innodb_page_size / 2 ) + 1,'a');
SELECT CONCAT('->', SUBSTR(f_col_blob(my_col) FROM 1 FOR 10),
'<-.....->', SUBSTR(f_col_blob(my_col) FROM -10 FOR 10), '<-') AS my_result
FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
UNION SELECT 1234 UNION SELECT 12345) AS tx;
my_result
->__1_aaaaaa<-.....->aaaaaaaaaa<-
->__1_aaaaaa<-.....->aaaaaaaaaa<-
->__1_aaaaaa<-.....->aaaaaaaaaa<-
->__1_aaaaaa<-.....->aaaaaaaaaa<-
->__1_aaaaaa<-.....->aaaaaaaaaa<-
CREATE FUNCTION f_col_char0 (i INT) RETURNS CHAR(255) DETERMINISTIC
RETURN LPAD(CAST(i AS CHAR),255,' ');
SELECT CONCAT('->', f_col_char0(my_col), '<-') AS my_result
FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
UNION SELECT 1234 UNION SELECT 12345) AS tx;
my_result
-> 1<-
-> 12<-
-> 123<-
-> 1234<-
-> 12345<-
CREATE FUNCTION f_col_char1 (i INT) RETURNS CHAR(26) DETERMINISTIC
RETURN
CONCAT('B',
LPAD(SUBSTR(CAST(i AS CHAR),1,(LENGTH(CAST(i AS CHAR)) DIV 2)),10,' '),
@extra_string,
RPAD(SUBSTR(CAST(i AS CHAR), -((LENGTH(CAST(i AS CHAR)) + 1) DIV 2)),10,' '),
'E') ;
SELECT CONCAT('->', f_col_char1(my_col), '<-') AS my_result
FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
UNION SELECT 1234 UNION SELECT 12345) AS tx;
my_result
->B __1_1 E<-
->B 1__1_2 E<-
->B 1__1_23 E<-
->B 12__1_34 E<-
->B 12__1_345 E<-
CREATE FUNCTION f_col_char2 (i INT) RETURNS CHAR(26) DETERMINISTIC
RETURN
CONCAT('B',
RPAD(SUBSTR(CAST(i AS CHAR),1,(LENGTH(CAST(i AS CHAR)) DIV 2)),10,' '),
@extra_string,
LPAD(SUBSTR(CAST(i AS CHAR), -((LENGTH(CAST(i AS CHAR)) + 1) DIV 2)),10,' '),
'E');
SELECT CONCAT('->', f_col_char2(my_col), '<-') AS my_result
FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
UNION SELECT 1234 UNION SELECT 12345) AS tx;
my_result
->B __1_ 1E<-
->B1 __1_ 2E<-
->B1 __1_ 23E<-
->B12 __1_ 34E<-
->B12 __1_ 345E<-
CREATE FUNCTION f_col_char3 (i INT) RETURNS CHAR(26) DETERMINISTIC
RETURN
CONCAT('B',@extra_string,LPAD(CAST(i AS CHAR),20,' '),'E');
SELECT CONCAT('->', f_col_char3(my_col), '<-') AS my_result
FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
UNION SELECT 1234 UNION SELECT 12345) AS tx;
my_result
->B__1_ 1E<-
->B__1_ 12E<-
->B__1_ 123E<-
->B__1_ 1234E<-
->B__1_ 12345E<-
CREATE FUNCTION f_col_char4 (i INT) RETURNS CHAR(26) DETERMINISTIC
RETURN
CONCAT('B',RPAD(CAST(i AS CHAR),20,' '),@extra_string,'E');
SELECT CONCAT('->', f_col_char4(my_col), '<-') AS my_result
FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
UNION SELECT 1234 UNION SELECT 12345) AS tx;
my_result
->B1 __1_E<-
->B12 __1_E<-
->B123 __1_E<-
->B1234 __1_E<-
->B12345 __1_E<-
CREATE TABLE my_metrics LIKE information_schema.innodb_metrics;
ALTER TABLE my_metrics ADD COLUMN phase ENUM('after', 'before'),
DROP COLUMN SUBSYSTEM, DROP COLUMN TYPE, DROP COLUMN COMMENT,
ADD PRIMARY KEY (NAME,phase);
CREATE TABLE t1 (
col_int0 BIGINT,
col_int1 BIGINT,
col_int2 BIGINT,
col_int3 BIGINT,
col_blob BLOB,
col_char0 VARCHAR(255),
col_char1 VARCHAR(30),
col_char2 VARCHAR(30),
col_char3 VARCHAR(30),
col_char4 VARCHAR(30)
) ENGINE = InnoDB;
ALTER TABLE t1 ADD UNIQUE KEY uidx_col_int0 (col_int0),
ADD UNIQUE KEY uidx1 (col_int1, col_char0),
ADD UNIQUE KEY uidx2 (col_int2, col_char0, col_int1),
ADD UNIQUE KEY uidx3 (col_int3, col_int2, col_char0),
ADD UNIQUE KEY uidx4 (col_char1, col_char0),
ADD UNIQUE KEY uidx5 (col_char2, col_char0, col_char1),
ADD UNIQUE KEY uidx6 (col_char3, col_char2, col_char0),
ADD UNIQUE KEY uidx7 (col_int1, col_int2, col_int3, col_char4,
col_char1, col_char2, col_char3, col_char0),
ADD KEY idx8 (col_blob(10), col_char4);
CREATE PROCEDURE proc_fill_t1 (max_row_count INT, load_unit INT)
BEGIN
DECLARE my_count INTEGER DEFAULT 0;
DECLARE max_load_count INTEGER DEFAULT 0;
DROP TABLE IF EXISTS t0;
CREATE TEMPORARY TABLE t0 (col_int0 BIGINT, PRIMARY KEY(col_int0));
WHILE (my_count < load_unit ) DO
SET my_count = my_count + 1;
INSERT INTO t0 SET col_int0 = my_count;
END WHILE;
SET max_load_count = (SELECT (max_row_count DIV load_unit) + 1 );
SELECT COUNT(col_int0) INTO @val FROM t1;
SET my_count = 0;
REPEAT
INSERT INTO t1 (col_int0, col_int1, col_int2, col_int3, col_blob,
col_char0, col_char1, col_char2,col_char3,col_char4)
SELECT col_int0 + @val,
f_col_int1(col_int0 + @val),
f_col_int2(col_int0 + @val),
f_col_int3(col_int0 + @val),
f_col_blob(col_int0 + @val),
f_col_char0(col_int0 + @val),
f_col_char1(col_int0 + @val),
f_col_char2(col_int0 + @val),
f_col_char3(col_int0 + @val),
f_col_char4(col_int0 + @val)
FROM t0;
COMMIT;
SELECT MAX(col_int0) INTO @val FROM t1;
SET my_count = my_count + 1;
UNTIL( my_count > max_load_count OR @val >= max_row_count )
END REPEAT;
DROP TEMPORARY TABLE t0;
END|
CREATE PROCEDURE proc_dml (max_duration INT, t1_stripe_half INT)
BEGIN
DECLARE aux INTEGER DEFAULT 0;
DECLARE start_time INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND BEGIN END;
SET @extra_int = CONNECTION_ID();
SET @extra_string = f_thread_id(@extra_int);
SELECT ROUND(MAX(col_int0) / 2 ) INTO @t1_half FROM t1;
# The user lock 'Blocker' should be already set by some other session S1.
# S1 starts the race by releasing that lock.
# Wait till the lock is released and the lock can be obtained.
# In order to prevent endless waiting in case of non foreseen problems
# limit the timespan to 30 seconds.
SELECT GET_LOCK('Blocker', 30) INTO @aux;
# Release the lock immediate so that the other "runner" sessions start too.
SELECT RELEASE_LOCK('Blocker') INTO @aux;
SET start_time = UNIX_TIMESTAMP();
WHILE (UNIX_TIMESTAMP() - start_time < max_duration) DO
SET @aux = @t1_half - t1_stripe_half + ROUND(RAND() * t1_stripe_half * 2);
UPDATE t1 SET
col_int1 = f_col_int1(col_int0),
col_int2 = f_col_int2(col_int0),
col_int3 = f_col_int3(col_int0),
col_blob = f_col_blob(col_int0),
col_char0 = f_col_char0(col_int0),
col_char1 = f_col_char1(col_int0),
col_char2 = f_col_char2(col_int0),
col_char3 = f_col_char3(col_int0),
col_char4 = f_col_char4(col_int0)
WHERE col_int0 = @aux;
COMMIT;
END WHILE;
END|
SET GLOBAL innodb_monitor_disable = "innodb_rwlock_sx_%";
SET @pre_reset_ts = NOW();
SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
SET @pre_enable_ts = NOW();
SET GLOBAL innodb_monitor_enable = "innodb_rwlock_sx_%";
SET @pre_collect_ts = NOW();
DELETE FROM my_metrics;
INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'before'
FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%';
# TC-01 There are exact three entries "innodb_rwlock_sx_%" with the
# with the name which follow in innodb_metrics.
# pass
SELECT COUNT(*) INTO @sx_count FROM my_metrics;
# TC-02 Counting is now enabled. ALL = @sx_count entries show that.
# pass
# TC-03 @pre_reset_ts < TIME_RESET. ALL = @sx_count entries show that.
# pass
# TC-04 @pre_enable_ts < TIME_ENABLED. ALL = @sx_count entries show that.
# pass
# TC-05 TIME_RESET < TIME_ENABLED AND TIME_ENABLED < @pre_collect_ts
# AND TIME_ELAPSED > 0. ALL = @sx_count entries show that.
# pass
# TC-06 COUNT_RESET = MAX_COUNT_RESET. ALL = @sx_count entries show that.
# pass
SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
SHOW ENGINE INNODB STATUS;
DELETE FROM my_metrics;
INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'before'
FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%';
SET @extra_string = '__0_';
SET @extra_int = 0;
# TC-07 One session inserts some significant amount of rows into t1.
# The system MUST survive that.
SET @max_row_count = <max_row_count>;
SET @load_unit = <load_unit>;
SET @start_time = UNIX_TIMESTAMP();
SET AUTOCOMMIT = OFF;
CALL proc_fill_t1 (@max_row_count, @load_unit);
# pass
SET AUTOCOMMIT = ON;
SELECT col_int0 INTO @t1_half FROM t1
WHERE col_int0 >= (@val DIV 2) ORDER BY col_int0 LIMIT 1;
SHOW ENGINE INNODB STATUS;
SELECT col_int0, col_int1, col_int2, col_int3,
CONCAT('->', SUBSTR(col_blob FROM 1 FOR 10),
'<-.....->', SUBSTR(col_blob FROM -10 FOR 10), '<-') AS col_blobx,
CONCAT('->',col_char0,'<-') AS col_char0x,
CONCAT('->',col_char1,'<-') AS col_char1x,
CONCAT('->',col_char2,'<-') AS col_char2x,
CONCAT('->',col_char3,'<-') AS col_char3x,
CONCAT('->',col_char4,'<-') AS col_char4x
FROM t1 WHERE col_int0 between 98 AND 102;
col_int0 98
col_int1 98000
col_int2 98
col_int3 0
col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<-
col_char0x -> 98<-
col_char1x ->B 9__0_8 E<-
col_char2x ->B9 __0_ 8E<-
col_char3x ->B__0_ 98E<-
col_char4x ->B98 __0_E<-
col_int0 99
col_int1 99000
col_int2 99
col_int3 0
col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<-
col_char0x -> 99<-
col_char1x ->B 9__0_9 E<-
col_char2x ->B9 __0_ 9E<-
col_char3x ->B__0_ 99E<-
col_char4x ->B99 __0_E<-
col_int0 100
col_int1 100000
col_int2 100
col_int3 0
col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<-
col_char0x -> 100<-
col_char1x ->B 1__0_00 E<-
col_char2x ->B1 __0_ 00E<-
col_char3x ->B__0_ 100E<-
col_char4x ->B100 __0_E<-
col_int0 101
col_int1 101000
col_int2 101
col_int3 0
col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<-
col_char0x -> 101<-
col_char1x ->B 1__0_01 E<-
col_char2x ->B1 __0_ 01E<-
col_char3x ->B__0_ 101E<-
col_char4x ->B101 __0_E<-
col_int0 102
col_int1 102000
col_int2 102
col_int3 0
col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<-
col_char0x -> 102<-
col_char1x ->B 1__0_02 E<-
col_char2x ->B1 __0_ 02E<-
col_char3x ->B__0_ 102E<-
col_char4x ->B102 __0_E<-
# TC-11 Several concurrent sessions perform updates in t1 like mad.
# The system MUST survive this.
# Printing of statements is partially suppressed.
SET @start_time = UNIX_TIMESTAMP();
SELECT 1 FROM t1 WHERE col_int0 = @t1_half FOR UPDATE;
1
1
SELECT GET_LOCK('Blocker', 1000) ;
GET_LOCK('Blocker', 1000)
1
RELEASE_LOCK('Blocker')
1
# pass
SHOW ENGINE INNODB STATUS;
# TC-13 One session performs ALTER TABLE t1 ADD KEY ... on the fat table t1.
# The system MUST survive this.
SET @start_time = UNIX_TIMESTAMP();
ALTER TABLE t1 ADD KEY idx_col_char4_col_char0 (col_char4,col_char0);
SHOW ENGINE INNODB STATUS;
# pass
# TC-15 One session performs a fat update on the fat table t1.
# The system MUST survive this.
SET @start_time = UNIX_TIMESTAMP();
SET @extra_int = 13;
SET @extra_string = f_thread_id(@extra_int);
UPDATE t1 SET
col_int1 = f_col_int1(col_int0), col_int2 = f_col_int2(col_int0),
col_int3 = f_col_int3(col_int0), col_blob = f_col_blob(col_int0),
col_char0 = f_col_char0(col_int0), col_char1 = f_col_char1(col_int0),
col_char2 = f_col_char2(col_int0), col_char3 = f_col_char3(col_int0),
col_char4 = f_col_char4(col_int0)
WHERE col_int0 BETWEEN @t1_half - 2500 AND @t1_half + 2500;
COMMIT;
SHOW ENGINE INNODB STATUS;
# pass
INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'after'
FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%';
# TC-16 The following activities happend after reset in innodb_metrics
# - Insert some significant amount of rows into t1.
# - Several concurrent users perform excessive updates in t1.
# - ALTER TABLE ... ADD KEY <sufficient big enough structure>
# - One UPDATE statement modifying a huge slice of t1.
# Any of them causes heavy use of SX lock and therefore COUNT_RESET
# must have grown for ALL = @sx_count entries.
# pass
# TC-09 Heavy activity after reset.
# COUNT_RESET = MAX_COUNT_RESET for ALL = @sx_count entries
# needs to stay valid though he counters will have grown.
# pass
DELETE FROM my_metrics;
INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'before'
FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%';
SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'after'
FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%';
# TC-08 There was a reset. COUNT_RESET = MAX_COUNT_RESET for ALL
# = @sx_count entries.
# pass
# TC-17 We had heavy activity causing big counters and after that a reset.
# Reset causes COUNT > COUNT_RESET AND MAX_COUNT > MAX_COUNT_RESET
# for ALL @sx_count entries.
# pass
# TC-18 We had some reset but this must not decrease COUNT or MAX_COUNT
# after.COUNT >= before.COUNT AND
# after.MAX_COUNT >= before.MAX_COUNT for ALL @sx_count entries.
# pass
# TC-19 We had some reset after heavy activity and this must cause
# after.COUNT_RESET < before.COUNT_RESET
# AND after.MAX_COUNT_RESET < before.MAX_COUNT_RESET AND
# for ALL @sx_count entries.
# pass
connection con10;
disconnect con10;
connection con9;
disconnect con9;
connection con8;
disconnect con8;
connection con7;
disconnect con7;
connection con6;
disconnect con6;
connection con5;
disconnect con5;
connection con4;
disconnect con4;
connection con3;
disconnect con3;
connection con2;
disconnect con2;
connection con1;
disconnect con1;
connection default;
USE test;
DROP SCHEMA my_schema;
SET GLOBAL innodb_monitor_disable = all;
SET GLOBAL innodb_monitor_reset_all = all;
SET GLOBAL innodb_monitor_enable = default;
SET GLOBAL innodb_monitor_disable = default;
SET GLOBAL innodb_monitor_reset = default;
SET GLOBAL innodb_monitor_reset_all = default;
SET GLOBAL innodb_monitor_disable = "innodb_rwlock_sx_%";
SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";

View File

@ -1,5 +1,5 @@
--- suite/innodb/r/instant_alter.result 2019-12-05 10:54:59.611505580 +0100
+++ suite/innodb/r/instant_alter,4k.reject 2019-12-05 11:47:54.013615820 +0100
--- instant_alter.result
+++ instant_alter,4k.result
@@ -242,7 +242,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@ -318,8 +318,8 @@
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-196
+198
-199
+201
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
#
# MDEV-18266: Changing an index comment unnecessarily rebuilds index

View File

@ -932,6 +932,9 @@ SELECT * FROM t1;
a b vb
fubar 42 42
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
ALTER TABLE t1 MODIFY b INT FIRST;
DROP TABLE t1;
CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
@ -1809,6 +1812,9 @@ SELECT * FROM t1;
a b vb
fubar 42 42
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
ALTER TABLE t1 MODIFY b INT FIRST;
DROP TABLE t1;
CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
@ -2686,12 +2692,15 @@ SELECT * FROM t1;
a b vb
fubar 42 42
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
ALTER TABLE t1 MODIFY b INT FIRST;
DROP TABLE t1;
disconnect analyze;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
196
199
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
#
# MDEV-18266: Changing an index comment unnecessarily rebuilds index

View File

@ -4,8 +4,8 @@ SET GLOBAL innodb_master_thread_disabled_debug = 1;
SET GLOBAL innodb_log_checkpoint_now = 1;
CREATE DATABASE very_long_database_name;
USE very_long_database_name;
set debug_dbug = '+d,increase_mtr_checkpoint_size';
set debug_dbug = '+d,crash_after_checkpoint';
SET debug_dbug = '+d,increase_mtr_checkpoint_size';
SET debug_dbug = '+d,crash_after_checkpoint';
set global innodb_log_checkpoint_now = 1;
ERROR HY000: Lost connection to MySQL server during query
# Skip MLOG_FILE_NAME redo records during recovery
@ -18,7 +18,7 @@ SET GLOBAL innodb_log_checkpoint_now = 1;
# exceeds LOG_CHECKPOINT_FREE_PER_THREAD size during checkpoint.
CREATE DATABASE very_long_database_name;
USE very_long_database_name;
set debug_dbug = '+d,crash_after_checkpoint';
SET debug_dbug = '+d,crash_after_checkpoint';
set global innodb_log_checkpoint_now = 1;
ERROR HY000: Lost connection to MySQL server during query
# Skip MLOG_FILE_NAME redo records during recovery

View File

@ -11,7 +11,9 @@
create table t1 (f1 int primary key, f2 blob) engine = innodb;
insert into t1 values (1, repeat('*', 50000));
select f1, substring(f2, 1, 40) from t1;
set debug_dbug = 'd,row_ins_index_entry_timeout';
set @saved_debug = @@session.debug_dbug;
SET debug_dbug = 'd,row_ins_index_entry_timeout';
update t1 set f1 = 3;
select f1, substring(f2, 1, 40) from t1;
drop table t1;
SET debug_dbug= @saved_debug;

View File

@ -9,8 +9,8 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2),
key k2(f3)) engine=innodb;
insert into t1 values (14, 24, 34);
set @old_dbug= @@session.debug_dbug;
set debug_dbug = '+d,row_ins_sec_index_entry_timeout';
SET debug_dbug = '+d,row_ins_sec_index_entry_timeout';
replace into t1 values (14, 25, 34);
select * from t1;
drop table t1;
set debug_dbug = @old_dbug;
SET debug_dbug = @old_dbug;

View File

@ -6,6 +6,7 @@
call mtr.add_suppression("InnoDB: Warning: Index.*");
# This caused crash earlier
SET @saved_dbug = @@SESSION.debug_dbug;
set DEBUG_DBUG='+d,ib_ha_innodb_stat_not_initialized';
create table t1(a int not null primary key, b int, c int, key(b), key(c)) engine=innodb;
@ -32,8 +33,8 @@ select count(1) from t1 where a between 5 and 100;
select count(1) from t1 where b between 5 and 256;
select count(1) from t1 where c between 7 and 787;
set DEBUG_DBUG=NULL;
drop procedure innodb_insert_proc;
drop table t1;
SET debug_dbug= @saved_dbug;

View File

@ -8,7 +8,8 @@
CREATE TABLE bug11754376 (c INT) ENGINE=INNODB;
# This will invoke test_normalize_table_name_low() in debug builds
SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION DEBUG_DBUG='+d,test_normalize_table_name_low';
DROP TABLE bug11754376;
SET debug_dbug= @saved_dbug;

View File

@ -0,0 +1 @@
--innodb-sys-tablestats

View File

@ -0,0 +1,236 @@
#
# Test for Bug#30113362 : BTR_CUR_WILL_MODIFY_TREE() IS INSUFFICIENT FOR HIGHER TREE LEVEL
#
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_innodb_16k.inc
--disable_query_log
SET @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
SET @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index;
SET @old_innodb_stats_persistent = @@innodb_stats_persistent;
--enable_query_log
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
SET GLOBAL innodb_adaptive_hash_index = false;
SET GLOBAL innodb_stats_persistent = false;
connect (purge_control,localhost,root,,);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--connect (con2,localhost,root,,)
CREATE TABLE t1 (
a00 CHAR(255) NOT NULL DEFAULT 'a',
a01 CHAR(255) NOT NULL DEFAULT 'a',
a02 CHAR(255) NOT NULL DEFAULT 'a',
b INT NOT NULL DEFAULT 0,
PRIMARY KEY(a00, a01, a02)
) charset latin1 ENGINE = InnoDB COMMENT='MERGE_THRESHOLD=45';
#
# Prepare primary key index tree to be used for this test.
#
SET GLOBAL innodb_limit_optimistic_insert_debug = 3;
delimiter |;
CREATE PROCEDURE data_load_t1()
BEGIN
DECLARE c1 INT DEFAULT 97;
DECLARE c2 INT DEFAULT 97;
DECLARE c3 INT DEFAULT 97;
WHILE c1 < 102 DO
WHILE c2 < 123 DO
WHILE c3 < 123 DO
INSERT INTO t1 (a00) VALUES (CHAR(c1,c2,c3));
SET c3 = c3 + 1;
END WHILE;
SET c3 = 97;
SET c2 = c2 + 1;
END WHILE;
SET c2 = 97;
SET c1 = c1 + 1;
END WHILE;
END |
delimiter ;|
call data_load_t1();
DROP PROCEDURE data_load_t1;
# all node pages are sparse (max 3 node_ptrs)
ANALYZE TABLE t1;
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
connection con2;
DELETE FROM t1 WHERE a00 = 'cnm';
COMMIT;
BEGIN;
INSERT INTO t1 SET a00 = 'cnm';
# causes "domino falling" merges to upper level
connection purge_control;
COMMIT;
connection con2;
SET GLOBAL innodb_limit_optimistic_insert_debug = 0;
ROLLBACK;
# at this moment, in the tree,
# ...
# level 4: ...(ast,avw,ayz)(bcc,bff,bii,bll,boo,brr,buu,bxx,cba,ced,cqp,cts)(cwv,czy,ddb)...
# ...
--echo # Test start
# (1) Similar case to the first reported corefile at bug#30113362
# - Deleting 'bii' causes "domino falling" merges and the node_ptr becomes left_most of level 4.
# So, the operation needs upper level pages' X-latch, though doesn't cause merge more.
connection purge_control;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection con2;
DELETE FROM t1 WHERE a00 = 'bii';
COMMIT;
BEGIN;
INSERT INTO t1 SET a00 = 'bii';
SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2';
SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume';
send ROLLBACK;
connection purge_control;
SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait';
COMMIT;
SET DEBUG_SYNC = 'now SIGNAL roll2';
connect (con1,localhost,root,,);
SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting';
SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
send SELECT a00 FROM t1 WHERE a00 = 'bii';
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR lockwait1';
# bug#30113362 caused deadlock
SET DEBUG_SYNC = 'now SIGNAL resume';
connection con1;
reap;
connection con2;
reap;
connection default;
ANALYZE TABLE t1;
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
# (2) Confirm blocking domain caused by DELETE modify_tree for tall index tree
# at this moment, in the tree,
# ...
# level 4: ...(ajk,amn,apq)(ast,avw,ayz,bll,boo,brr,buu,bxx,cba,ced,cqp,cts)(cwv,czy,ddb)(dge,djh,dmk)(dpn,dsq,dvt)(dyw,ebz,efc)...
# ...
# makes >17 records in level4 [(2^(4-1))*2 + 1]. (causes never left_most records)
DELETE FROM t1 WHERE a00 = 'dpn';
COMMIT;
INSERT INTO t1 SET a00 = 'dpn';
ROLLBACK;
# at this moment, in the tree,
# (* before "]" and after "[" records are treated as left_most possible records)
# ...
# level 4: ...(ajk,amn,apq)(ast,avw,ayz,bll,boo,brr,buu,bxx],cba,ced,[cqp,cts,cwv,czy,ddb,dge,dsq,dvt)(dyw,ebz,efc)...
# level 3: ...(cba,ccb,cdc)(ced,cfe,cgf,chg],cih,cji,[ckj,clk,con,cpo)(cqp,crq,csr)...
# level 2: ...(ckj,cks,clb)(clk,clt],cmc,cml,cmu,cnd,[cnv,coe)(con,cow,cpf)...
# level 1: ...(cmu,cmx,cna)(cnd],cng,cnj,cnp,[cns)(cnv,cny,cob)...
# level 0: ...(cnd,cne,cnf)(cng,cnh,cni)(cnj,cnk,cnl,cnn,cno)(cnp,cnq,cnr)...
# deletes just 'ced' node_ptr only from level 4. doesn't cause merge and never left_most.
# adjusts MERGE_THRESHOLD to do so.
ALTER TABLE t1 COMMENT='MERGE_THRESHOLD=35';
connection purge_control;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection con2;
DELETE FROM t1 WHERE a00 = 'cnd';
COMMIT;
BEGIN;
INSERT INTO t1 SET a00 = 'cnd';
SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2';
SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume EXECUTE 2';
send ROLLBACK;
connection purge_control;
SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait';
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SET DEBUG_SYNC = 'now SIGNAL roll2';
connection con1;
# FIXME: For some reason, we will not always receive these signals!
--disable_warnings
# An optimistic row_undo_mod_remove_clust_low() will fail.
SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
SET DEBUG_SYNC = 'now SIGNAL resume';
# Wait for the pessimistic row_undo_mod_remove_clust_low() attempt.
SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
--enable_warnings
disconnect purge_control;
# The expectation should be...
# level 0: (#cnd#,cne,cnf): causes merge
# level 1: (#cnd#],cng,cnj,cnp,[cns): left_most
# level 2: (clk,clt],cmc,cml,cmu,#cnd#,[cnv,coe): causes merge
# level 3: (ced,cfe,cgf,chg],cih,cji,[ckj,#clk#,con,cpo): left_most possible (not cause merge)
# level 4: (ast,avw,ayz,bll,boo,brr,buu,bxx],cba,#ced#,[cqp,cts,cwv,czy,ddb,dge,dsq,dvt): no merge, not left_most possible
# So, the top X-latch page is at level4. (ast~dvt)
# blocking domain based on whether its ancestor is latched or not.
# (*[]: ancestor is X-latched)
# level 0: ...(asq,asr,ass) [(ast,asu,asv)...(dyt,dyu,dyv)] (dyw,dyx,dyy)...
# Not blocked searches
## In MariaDB, both these will block, because we use different DEBUG_SYNC
## instrumentation (in rollback, not purge) and the root page (number 3)
## is being latched in row_undo_mod_remove_clust_low().
## SELECT a00 FROM t1 WHERE a00 = 'ass';
## SELECT a00 FROM t1 WHERE a00 = 'dyx';
## SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
## send SELECT a00 FROM t1 WHERE a00 = 'ast';
## connection con2;
## SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
## send SELECT a00 FROM t1 WHERE a00 = 'dyw';
connection default;
## SET DEBUG_SYNC = 'now WAIT_FOR lockwait1';
## SET DEBUG_SYNC = 'now WAIT_FOR lockwait2';
SET DEBUG_SYNC = 'now SIGNAL resume';
## connection con1;
## reap;
disconnect con1;
connection con2;
reap;
disconnect con2;
connection default;
ANALYZE TABLE t1;
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
# Cleanup
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
--disable_query_log
SET GLOBAL innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index;
SET GLOBAL innodb_stats_persistent = @old_innodb_stats_persistent;
--enable_query_log
--source include/wait_until_count_sessions.inc

View File

@ -7,6 +7,7 @@
SET GLOBAL innodb_file_per_table=0;
create table bug56947(a int not null) engine = innodb;
SET @saved_dbug = @@SESSION.debug_dbug;
SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename';
--replace_regex /"[^"]*"/"xxx"/
--error ER_GET_ERRNO
@ -15,3 +16,4 @@ check table bug56947;
drop table bug56947;
SET @@global.innodb_file_per_table=DEFAULT;
SET debug_dbug= @saved_dbug;

View File

@ -36,7 +36,7 @@ select count(*) from corrupt_bit_test_ā;
SET @save_dbug = @@SESSION.debug_dbug;
SET debug_dbug = '+d,dict_set_index_corrupted';
check table corrupt_bit_test_ā;
SET debug_dbug = @save_dbug;
SET @@SESSION.debug_dbug = @save_dbug;
# Cannot create new indexes while corrupted indexes exist
--error ER_INDEX_CORRUPT

View File

@ -17,6 +17,7 @@ eval create table t1 (id integer, x integer) engine = InnoDB;
insert into t1 values(0, 0);
# Enable the debug injection.
SET @saved_dbug = @@SESSION.debug_dbug;
set DEBUG_DBUG='+d,fatal-semaphore-timeout';
set autocommit=0;
@ -107,7 +108,7 @@ source include/wait_until_connected_again.inc;
--echo # Cleaning up before exit
--disable_warnings
set DEBUG_DBUG=NULL;
SET debug_dbug = @saved_dbug;
drop table if exists t1;
--enable_warnings

Some files were not shown because too many files have changed in this diff Show More