1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-01 17:39:21 +03:00

merge from 5.5

This commit is contained in:
Vladislav Vaintroub
2012-02-16 17:33:37 +01:00
202 changed files with 6684 additions and 3439 deletions

View File

@@ -0,0 +1,66 @@
set global aria_log_file_size=4294967295;
Warnings:
Warning 1292 Truncated incorrect aria_log_file_size value: '4294967295'
drop database if exists mysqltest;
create database mysqltest;
use mysqltest;
* shut down mysqld, removed logs, restarted it
CREATE TABLE t1 (
i int,
shape GEOMETRY NOT NULL,
SPATIAL (shape)
) ENGINE=ARIA;
insert into t1 values(1,POINT(1, 1));
* copied t1 for feeding_recovery
insert into t1 values(2,POINT(2, 2)), (3,POINT(3, 3)), (4,POINT(4, 4));
flush table t1;
* copied t1 for comparison
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global aria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* copied t1 back for feeding_recovery
* recovery happens
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL,
`shape` geometry NOT NULL,
SPATIAL KEY `shape` (`shape`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
* TEST of UPDATE vs state.auto_increment
* copied t1 for feeding_recovery
update t1 set shape=POINT(5, 5) where i=2;
flush table t1;
* copied t1 for comparison
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global aria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* copied t1 back for feeding_recovery
* recovery happens
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL,
`shape` geometry NOT NULL,
SPATIAL KEY `shape` (`shape`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
drop table t1;
drop database mysqltest_for_feeding_recovery;
drop database mysqltest_for_comparison;
drop database mysqltest;

View File

@@ -0,0 +1 @@
--skip-stack-trace --skip-core-file --loose-aria-log-dir-path=$MYSQLTEST_VARDIR/tmp

View File

@@ -0,0 +1,64 @@
--source include/not_embedded.inc
# Don't test this under valgrind, memory leaks will occur as we crash
--source include/not_valgrind.inc
# Binary must be compiled with debug for crash to occur
--source include/have_debug.inc
--source include/have_maria.inc
--source include/have_geometry.inc
set global aria_log_file_size=4294967295;
let $MARIA_LOG=../../tmp;
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
let $mms_tname=t;
# Include scripts can perform SQL. For it to not influence the main test
# they use a separate connection. This way if they use a DDL it would
# not autocommit in the main test.
connect (admin, localhost, root,,mysqltest,,);
--enable_reconnect
connection default;
use mysqltest;
--enable_reconnect
-- source include/maria_empty_logs.inc
let $mms_tables=1;
CREATE TABLE t1 (
i int,
shape GEOMETRY NOT NULL,
SPATIAL (shape)
) ENGINE=ARIA;
insert into t1 values(1,POINT(1, 1));
-- source include/maria_make_snapshot_for_feeding_recovery.inc
insert into t1 values(2,POINT(2, 2)), (3,POINT(3, 3)), (4,POINT(4, 4));
-- source include/maria_make_snapshot_for_comparison.inc
let $mvr_restore_old_snapshot=1;
let $mms_compare_physically=0;
let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
let $mvr_crash_statement= set global aria_checkpoint_interval=1;
-- source include/maria_verify_recovery.inc
show create table t1;
# Test that UPDATE's effect on auto-increment is recovered
--echo * TEST of UPDATE vs state.auto_increment
-- source include/maria_make_snapshot_for_feeding_recovery.inc
update t1 set shape=POINT(5, 5) where i=2;
-- source include/maria_make_snapshot_for_comparison.inc
let $mvr_restore_old_snapshot=1;
let $mms_compare_physically=0;
let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
let $mvr_crash_statement= set global aria_checkpoint_interval=1;
-- source include/maria_verify_recovery.inc
show create table t1;
drop table t1;
# clean up everything
let $mms_purpose=feeding_recovery;
eval drop database mysqltest_for_$mms_purpose;
let $mms_purpose=comparison;
eval drop database mysqltest_for_$mms_purpose;
drop database mysqltest;

View File

@@ -1,733 +0,0 @@
drop table if exists t1,t2,t3;
create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
insert into t1 values(1,1),(2,2),(3,3),(4,4);
delete from t1 where a=1 or a=0;
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH
select * from t1;
a b
2 2
3 3
4 4
select * from t1 where a=4;
a b
4 4
update t1 set b=5 where a=4;
update t1 set b=b+1 where a>=3;
replace t1 values (3,3);
select * from t1;
a b
2 2
3 3
4 6
alter table t1 add c int not null, add key (c,a);
drop table t1;
create table t1 (a int not null,b int not null, primary key (a)) engine=memory comment="testing heaps";
insert into t1 values(1,1),(2,2),(3,3),(4,4);
delete from t1 where a > 0;
select * from t1;
a b
drop table t1;
create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps";
insert into t1 values(1,1),(2,2),(3,3),(4,4);
alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table";
select * from t1;
a b
1 1
2 2
3 3
4 4
drop table t1;
create table t1 (a int not null) engine=heap;
insert into t1 values (869751),(736494),(226312),(802616),(728912);
select * from t1 where a > 736494;
a
869751
802616
alter table t1 add unique uniq_id(a);
select * from t1 where a > 736494;
a
869751
802616
select * from t1 where a = 736494;
a
736494
select * from t1 where a=869751 or a=736494;
a
736494
869751
select * from t1 where a in (869751,736494,226312,802616);
a
226312
736494
802616
869751
alter table t1 engine=myisam;
explain select * from t1 where a in (869751,736494,226312,802616);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
drop table t1;
create table t1 (x int not null, y int not null, key x (x), unique y (y))
engine=heap;
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
select * from t1 where x=1;
x y
1 3
1 1
select * from t1,t1 as t2 where t1.x=t2.y;
x y x y
1 1 1 1
2 2 2 2
1 3 1 1
2 4 2 2
2 5 2 2
2 6 2 2
explain select * from t1,t1 as t2 where t1.x=t2.y;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL x NULL NULL NULL 6
1 SIMPLE t2 eq_ref y y 4 test.t1.x 1
drop table t1;
create table t1 (a int) engine=heap;
insert into t1 values(1);
select max(a) from t1;
max(a)
1
drop table t1;
CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key(a), key(b) ) ENGINE=HEAP;
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
select * from t1 where a=1;
a b
1 6
1 5
1 4
1 3
1 2
1 1
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
select * from t1 where a=1;
a b
1 6
1 5
1 4
1 3
1 2
1 1
1 6
1 5
1 4
1 3
1 2
1 1
drop table t1;
create table t1 (id int unsigned not null, primary key (id)) engine=HEAP;
insert into t1 values(1);
select max(id) from t1;
max(id)
1
insert into t1 values(2);
select max(id) from t1;
max(id)
2
replace into t1 values(1);
drop table t1;
create table t1 (n int) engine=heap;
drop table t1;
create table t1 (n int) engine=heap;
drop table if exists t1;
CREATE table t1(f1 int not null,f2 char(20) not
null,index(f2)) engine=heap;
INSERT into t1 set f1=12,f2="bill";
INSERT into t1 set f1=13,f2="bill";
INSERT into t1 set f1=14,f2="bill";
INSERT into t1 set f1=15,f2="bill";
INSERT into t1 set f1=16,f2="ted";
INSERT into t1 set f1=12,f2="ted";
INSERT into t1 set f1=12,f2="ted";
INSERT into t1 set f1=12,f2="ted";
INSERT into t1 set f1=12,f2="ted";
delete from t1 where f2="bill";
select * from t1;
f1 f2
16 ted
12 ted
12 ted
12 ted
12 ted
drop table t1;
create table t1 (btn char(10) not null, key(btn)) engine=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn;
update t1 set new_col=left(btn,1);
explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
b int default NULL,
KEY a (a),
UNIQUE b (b)
) engine=heap;
INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 5 const 2 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
SELECT * FROM t1 WHERE b=NULL;
a b
explain SELECT * FROM t1 WHERE b IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 5 const 1 Using where
SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
INSERT INTO t1 VALUES (1,3);
ERROR 23000: Duplicate entry '3' for key 'b'
DROP TABLE t1;
CREATE TABLE t1 (
a int default NULL,
key a (a)
) ENGINE=HEAP;
INSERT INTO t1 VALUES (10), (10), (10);
EXPLAIN SELECT * FROM t1 WHERE a=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 5 const 3
SELECT * FROM t1 WHERE a=10;
a
10
10
10
DROP TABLE t1;
CREATE TABLE t1 (a int not null, primary key(a)) engine=heap;
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
DELETE from t1 where a < 100;
SELECT * from t1;
a
DROP TABLE t1;
CREATE TABLE `job_titles` (
`job_title_id` int(6) unsigned NOT NULL default '0',
`job_title` char(18) NOT NULL default '',
PRIMARY KEY (`job_title_id`),
UNIQUE KEY `job_title_id` (`job_title_id`,`job_title`)
) ENGINE=HEAP;
SELECT MAX(job_title_id) FROM job_titles;
MAX(job_title_id)
NULL
DROP TABLE job_titles;
CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
INSERT INTO t1 VALUES(1,1), (1,NULL);
SELECT * FROM t1 WHERE B is not null;
a B
1 1
DROP TABLE t1;
CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int(10) unsigned NOT NULL) ENGINE=HEAP;
INSERT INTO t1 VALUES ('massecot',1101106491),('altec',1101106492),('stitch+',1101106304),('Seb Corgan',1101106305),('beerfilou',1101106263),('flaker',1101106529),('joce8',5),('M4vrick',1101106418),('gabay008',1101106525),('Vamp irX',1101106291),('ZoomZip',1101106546),('rip666',1101106502),('CBP ',1101106397),('guezpard',1101106496);
DELETE FROM t1 WHERE date<1101106546;
SELECT * FROM t1;
pseudo date
ZoomZip 1101106546
DROP TABLE t1;
create table t1(a char(2)) engine=memory;
insert into t1 values (NULL), (NULL);
delete from t1 where a is null;
insert into t1 values ('2'), ('3');
select * from t1;
a
3
2
drop table t1;
set storage_engine=HEAP;
create table t1 (v varchar(10), c char(10), t varchar(50));
insert into t1 values('+ ', '+ ', '+ ');
set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings:
Note 1265 Data truncated for column 'v' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*')
*+ *+*+ *
*+ *+*+ *
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`t` varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
create table t2 like t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`t` varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
create table t3 select * from t1;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`t` varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
alter table t1 modify c varchar(10);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` varchar(10) DEFAULT NULL,
`t` varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
alter table t1 modify v char(10);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` char(10) DEFAULT NULL,
`c` varchar(10) DEFAULT NULL,
`t` varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10);
Warnings:
Warning 1265 Data truncated for column 't' at row 2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` char(10) DEFAULT NULL,
`c` varchar(10) DEFAULT NULL,
`t` varchar(10) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*')
*+*+*+ *
*+*+*+ *
drop table t1,t2,t3;
create table t1 (v varchar(10), c char(10), t varchar(50), key(v), key(c), key(t(10)));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`t` varchar(50) DEFAULT NULL,
KEY `v` (`v`),
KEY `c` (`c`),
KEY `t` (`t`(10))
) ENGINE=MEMORY DEFAULT CHARSET=latin1
select count(*) from t1;
count(*)
270
insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
select count(*) from t1 where v='a';
count(*)
10
select count(*) from t1 where c='a';
count(*)
10
select count(*) from t1 where t='a';
count(*)
10
select count(*) from t1 where v='a ';
count(*)
10
select count(*) from t1 where c='a ';
count(*)
10
select count(*) from t1 where t='a ';
count(*)
10
select count(*) from t1 where v between 'a' and 'a ';
count(*)
10
select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
count(*)
10
select count(*) from t1 where v like 'a%';
count(*)
11
select count(*) from t1 where c like 'a%';
count(*)
11
select count(*) from t1 where t like 'a%';
count(*)
11
select count(*) from t1 where v like 'a %';
count(*)
9
explain select count(*) from t1 where v='a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const 10 Using where
explain select count(*) from t1 where c='a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c c 11 const 10 Using where
explain select count(*) from t1 where t='a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref t t 13 const 10 Using where
explain select count(*) from t1 where v like 'a%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL v NULL NULL NULL 271 Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const 10 Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const 10 Using where
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
qq
*a*a*a*
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const 10 Using where
select v,count(*) from t1 group by v limit 10;
v count(*)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
select v,count(t) from t1 group by v limit 10;
v count(t)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
select v,count(c) from t1 group by v limit 10;
v count(c)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
select sql_big_result trim(v),count(t) from t1 group by v limit 10;
trim(v) count(t)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
select sql_big_result trim(v),count(c) from t1 group by v limit 10;
trim(v) count(c)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
select c,count(*) from t1 group by c limit 10;
c count(*)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
select c,count(t) from t1 group by c limit 10;
c count(t)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
select sql_big_result c,count(t) from t1 group by c limit 10;
c count(t)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
select t,count(*) from t1 group by t limit 10;
t count(*)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
select t,count(t) from t1 group by t limit 10;
t count(t)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
select sql_big_result trim(t),count(t) from t1 group by t limit 10;
trim(t) count(t)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
drop table t1;
create table t1 (a char(10), unique (a));
insert into t1 values ('a');
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a ';
update t1 set a='a ' where a like 'a ';
drop table t1;
create table t1 (v varchar(10), c char(10), t varchar(50), key using btree (v), key using btree (c), key using btree (t(10)));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`t` varchar(50) DEFAULT NULL,
KEY `v` (`v`) USING BTREE,
KEY `c` (`c`) USING BTREE,
KEY `t` (`t`(10)) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=latin1
select count(*) from t1;
count(*)
270
insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
select count(*) from t1 where v='a';
count(*)
10
select count(*) from t1 where c='a';
count(*)
10
select count(*) from t1 where t='a';
count(*)
10
select count(*) from t1 where v='a ';
count(*)
10
select count(*) from t1 where c='a ';
count(*)
10
select count(*) from t1 where t='a ';
count(*)
10
select count(*) from t1 where v between 'a' and 'a ';
count(*)
10
select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
count(*)
10
explain select count(*) from t1 where v='a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where
explain select count(*) from t1 where c='a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c c 11 const # Using where
explain select count(*) from t1 where t='a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref t t 13 const # Using where
explain select count(*) from t1 where v like 'a%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 13 NULL # Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
qq
*a*a*a*
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
*a *a*a *
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where
drop table t1;
create table t1 (a char(10), unique using btree (a)) engine=heap;
insert into t1 values ('a');
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a ';
update t1 set a='a ' where a like 'a ';
drop table t1;
create table t1 (v varchar(10), c char(10), t varchar(50), key(v(5)), key(c(5)), key(t(5)));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`t` varchar(50) DEFAULT NULL,
KEY `v` (`v`(5)),
KEY `c` (`c`(5)),
KEY `t` (`t`(5))
) ENGINE=MEMORY DEFAULT CHARSET=latin1
drop table t1;
create table t1 (v varchar(65530), key(v(10)));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(65530) DEFAULT NULL,
KEY `v` (`v`(10))
) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values(repeat('a',65530));
select length(v) from t1 where v=repeat('a',65530);
length(v)
65530
drop table t1;
set storage_engine=PBXT;
create table t1 (a bigint unsigned auto_increment primary key, b int,
key (b, a)) engine=heap;
insert t1 (b) values (1),(1),(1),(1),(1),(1),(1),(1);
select * from t1;
a b
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
drop table t1;
create table t1 (a int not null, b int not null auto_increment,
primary key(a, b), key(b)) engine=heap;
insert t1 (a) values (1),(1),(1),(1),(1),(1),(1),(1);
select * from t1;
a b
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
drop table t1;
create table t1 (a int not null, b int not null auto_increment,
primary key(a, b)) engine=heap;
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
create table t1 (c char(255), primary key(c(90)));
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 'PRIMARY'
drop table t1;
CREATE TABLE t1 (a int, key(a)) engine=heap;
insert into t1 values (0);
delete from t1;
select * from t1;
a
insert into t1 values (0), (1);
select * from t1 where a = 0;
a
0
drop table t1;
create table t1 (c char(10)) engine=memory;
create table t2 (c varchar(10)) engine=memory;
show table status like 't_';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MEMORY 10 Fixed 0 11 0 # 0 0 NULL # NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 0 12 0 # 0 0 NULL # NULL NULL latin1_swedish_ci NULL
drop table t1, t2;
CREATE TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256),
KEY(a), KEY(b), KEY(c)) ENGINE=MEMORY;
INSERT INTO t1 VALUES('a','aa',REPEAT('a', 256)),('a','aa',REPEAT('a',256));
SELECT COUNT(*) FROM t1 WHERE a='a';
COUNT(*)
2
SELECT COUNT(*) FROM t1 WHERE b='aa';
COUNT(*)
2
SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256);
COUNT(*)
2
DROP TABLE t1;

View File

@@ -428,5 +428,6 @@ Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 5
DROP TABLE t1,t2,t3,t4;

View File

@@ -121,8 +121,8 @@ insert into t1 values (1);
explain select * from t1 where 3 in (select (1+1) union select 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 1 Using index
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
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
select * from t1 where 3 in (select (1+1) union select 1);
a

View File

@@ -2789,10 +2789,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
1 SIMPLE t1 index key1 key1 5 NULL 4 Using where; Using index
explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
1 SIMPLE t1 index key1 key1 5 NULL 4 Using where; Using index
select max(key1) from t1 where key1 <= 0.6158;
max(key1)
0.6158000230789185
@@ -2811,10 +2811,18 @@ max(key1) min(key2)
0.6158000230789185 1.3761999607086182
select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
max(key1)
<<<<<<< TREE
0.6158000230789185
=======
0.384499996900558
>>>>>>> MERGE-SOURCE
select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
min(key1)
<<<<<<< TREE
0.37619999051094055
=======
0.384499996900558
>>>>>>> MERGE-SOURCE
DROP TABLE t1,t2;
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
INSERT INTO t1 VALUES (10);

View File

@@ -277,6 +277,7 @@ Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
flush status;
update t1 set a=9999 order by a limit 1;
@@ -292,6 +293,21 @@ Handler_read_last 1
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 2
<<<<<<< TREE
=======
Handler_read_rnd_deleted 0
Handler_read_rnd_next 18
flush status;
delete from t1 order by a limit 1;
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
Handler_read_rnd_deleted 0
>>>>>>> MERGE-SOURCE
Handler_read_rnd_next 9
flush status;
delete from t1 order by a limit 1;
@@ -313,8 +329,14 @@ Handler_read_key 0
Handler_read_last 1
Handler_read_next 0
Handler_read_prev 0
<<<<<<< TREE
Handler_read_rnd 0
Handler_read_rnd_next 0
=======
Handler_read_rnd 1
Handler_read_rnd_deleted 0
Handler_read_rnd_next 8
>>>>>>> MERGE-SOURCE
alter table t1 disable keys;
Warnings:
Note 1031 Table storage engine for 't1' doesn't have this option
@@ -327,8 +349,14 @@ Handler_read_key 0
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
<<<<<<< TREE
Handler_read_rnd 0
Handler_read_rnd_next 0
=======
Handler_read_rnd 1
Handler_read_rnd_deleted 0
Handler_read_rnd_next 7
>>>>>>> MERGE-SOURCE
select * from t1;
a b
0 0
@@ -382,6 +410,7 @@ Handler_read_last 0
Handler_read_next 1
Handler_read_prev 0
Handler_read_rnd 1
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
drop table t1, t2;
create table t1(f1 int, `*f2` int);

View File

@@ -1,959 +0,0 @@
drop database if exists mysqltest;
drop view if exists v1,v2,v3;
grant create view on test.* to test@localhost;
show grants for test@localhost;
Grants for test@localhost
GRANT USAGE ON *.* TO 'test'@'localhost'
GRANT CREATE VIEW ON `test`.* TO 'test'@'localhost'
revoke create view on test.* from test@localhost;
show grants for test@localhost;
Grants for test@localhost
GRANT USAGE ON *.* TO 'test'@'localhost'
drop user test@localhost;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
create table mysqltest.t2 (a int, b int);
grant select on mysqltest.t1 to mysqltest_1@localhost;
grant create view,select on test.* to mysqltest_1@localhost;
create definer=root@localhost view v1 as select * from mysqltest.t1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
create view v1 as select * from mysqltest.t1;
alter view v1 as select * from mysqltest.t1;
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1'
create or replace view v1 as select * from mysqltest.t1;
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1'
create view mysqltest.v2 as select * from mysqltest.t1;
ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2'
create view v2 as select * from mysqltest.t2;
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
grant create view,drop,select on test.* to mysqltest_1@localhost;
use test;
alter view v1 as select * from mysqltest.t1;
create or replace view v1 as select * from mysqltest.t1;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
revoke all privileges on test.* from mysqltest_1@localhost;
drop database mysqltest;
drop view test.v1;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
select c from mysqltest.v1;
c
select d from mysqltest.v1;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v1'
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1';
drop database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
create algorithm=temptable view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
select c from mysqltest.v1;
c
select d from mysqltest.v1;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v1'
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1';
drop database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
create table mysqltest.t2 (a int, b int);
create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
create algorithm=temptable view mysqltest.v2 (c,d) as select a+1,b+1 from mysqltest.t1;
create view mysqltest.v3 (c,d) as select a+1,b+1 from mysqltest.t2;
create algorithm=temptable view mysqltest.v4 (c,d) as select a+1,b+1 from mysqltest.t2;
grant select on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.v2 to mysqltest_1@localhost;
grant select on mysqltest.v3 to mysqltest_1@localhost;
grant select on mysqltest.v4 to mysqltest_1@localhost;
select c from mysqltest.v1;
c
select c from mysqltest.v2;
c
select c from mysqltest.v3;
c
select c from mysqltest.v4;
c
show columns from mysqltest.v1;
Field Type Null Key Default Extra
c bigint(12) YES NULL
d bigint(12) YES NULL
show columns from mysqltest.v2;
Field Type Null Key Default Extra
c bigint(12) YES NULL
d bigint(12) YES NULL
explain select c from mysqltest.v1;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v1;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
explain select c from mysqltest.v2;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v2;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2'
explain select c from mysqltest.v3;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v3;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v3'
explain select c from mysqltest.v4;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v4;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4'
grant select on mysqltest.t1 to mysqltest_1@localhost;
explain select c from mysqltest.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 0
show create view mysqltest.v1;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
explain select c from mysqltest.v2;
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 0
show create view mysqltest.v2;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2'
explain select c from mysqltest.v3;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v3;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v3'
explain select c from mysqltest.v4;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v4;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4'
grant show view on mysqltest.* to mysqltest_1@localhost;
explain select c from mysqltest.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 0
show create view mysqltest.v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
explain select c from mysqltest.v2;
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 0
show create view mysqltest.v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
explain select c from mysqltest.v3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 0
show create view mysqltest.v3;
View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v3` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci
explain select c from mysqltest.v4;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t2 ALL NULL NULL NULL NULL 0
show create view mysqltest.v4;
View Create View character_set_client collation_connection
v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v4` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1';
drop database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key(a));
insert into mysqltest.t1 values (10,2), (20,3), (30,4), (40,5), (50,10);
create table mysqltest.t2 (x int);
insert into mysqltest.t2 values (3), (4), (5), (6);
create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1;
create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1;
create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1;
grant update (a) on mysqltest.v2 to mysqltest_1@localhost;
grant update on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.* to mysqltest_1@localhost;
use mysqltest;
update t2,v1 set v1.a=v1.a+v1.c where t2.x=v1.c;
select * from t1 order by a;
a b
13 2
24 3
35 4
46 5
50 10
update v1 set a=a+c;
select * from t1 order by a;
a b
16 2
28 3
40 4
52 5
61 10
update t2,v2 set v2.a=v2.a+v2.c where t2.x=v2.c;
select * from t1 order by a;
a b
16 2
31 3
44 4
57 5
61 10
update v2 set a=a+c;
select * from t1 order by a;
a b
18 2
34 3
48 4
62 5
71 10
update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c;
ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column 'c' in table 'v2'
update v2 set c=a+c;
ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column 'c' in table 'v2'
update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c;
ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 'v3'
update v3 set a=a+c;
ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 'v3'
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key(a));
insert into mysqltest.t1 values (1,2), (2,3), (3,4), (4,5), (5,10);
create table mysqltest.t2 (x int);
insert into mysqltest.t2 values (3), (4), (5), (6);
create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1;
create view mysqltest.v2 (a,c) as select a, b+1 from mysqltest.t1;
grant delete on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.* to mysqltest_1@localhost;
use mysqltest;
delete from v1 where c < 4;
select * from t1;
a b
2 3
3 4
4 5
5 10
delete v1 from t2,v1 where t2.x=v1.c;
select * from t1;
a b
5 10
delete v2 from t2,v2 where t2.x=v2.c;
ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v2'
delete from v2 where c < 4;
ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v2'
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key(a));
insert into mysqltest.t1 values (1,2), (2,3);
create table mysqltest.t2 (x int, y int);
insert into mysqltest.t2 values (3,4);
create view mysqltest.v1 (a,c) as select a, b from mysqltest.t1;
create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1;
grant insert on mysqltest.v1 to mysqltest_1@localhost;
grant select on mysqltest.* to mysqltest_1@localhost;
use mysqltest;
insert into v1 values (5,6);
select * from t1;
a b
1 2
2 3
5 6
insert into v1 select x,y from t2;
select * from t1;
a b
1 2
2 3
5 6
3 4
insert into v2 values (5,6);
ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 'v2'
insert into v2 select x,y from t2;
ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 'v2'
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
create table mysqltest.t2 (a int, b int);
grant update on mysqltest.t1 to mysqltest_1@localhost;
grant update(b) on mysqltest.t2 to mysqltest_1@localhost;
grant create view,update on test.* to mysqltest_1@localhost;
create view v1 as select * from mysqltest.t1;
create view v2 as select b from mysqltest.t2;
create view mysqltest.v1 as select * from mysqltest.t1;
ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
create view v3 as select a from mysqltest.t2;
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 't2'
create table mysqltest.v3 (b int);
grant create view on mysqltest.v3 to mysqltest_1@localhost;
drop table mysqltest.v3;
create view mysqltest.v3 as select b from mysqltest.t2;
grant create view, update on mysqltest.v3 to mysqltest_1@localhost;
drop view mysqltest.v3;
create view mysqltest.v3 as select b from mysqltest.t2;
create view v4 as select b+1 from mysqltest.t2;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2'
grant create view,update,select on test.* to mysqltest_1@localhost;
create view v4 as select b+1 from mysqltest.t2;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2'
grant update,select(b) on mysqltest.t2 to mysqltest_1@localhost;
create view v4 as select b+1 from mysqltest.t2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest;
drop view v1,v2,v4;
create database mysqltest;
create table mysqltest.t1 (a int);
grant all privileges on mysqltest.* to mysqltest_1@localhost;
use mysqltest;
create view v1 as select * from t1;
use test;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
grant select on mysqltest.t1 to mysqltest_1@localhost;
grant create view,select on test.* to mysqltest_1@localhost;
create view v1 as select * from mysqltest.t1;
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
revoke select on mysqltest.t1 from mysqltest_1@localhost;
select * from v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
grant select on mysqltest.t1 to mysqltest_1@localhost;
select * from v1;
a b
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop view v1;
drop database mysqltest;
create database mysqltest;
use mysqltest;
create table t1 (a int);
insert into t1 values (1);
create table t2 (s1 int);
drop function if exists f2;
create function f2 () returns int begin declare v int; select s1 from t2
into v; return v; end//
create algorithm=TEMPTABLE view v1 as select f2() from t1;
create algorithm=MERGE view v2 as select f2() from t1;
create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1;
create algorithm=MERGE SQL SECURITY INVOKER view v4 as select f2() from t1;
create SQL SECURITY INVOKER view v5 as select * from v4;
grant select on v1 to mysqltest_1@localhost;
grant select on v2 to mysqltest_1@localhost;
grant select on v3 to mysqltest_1@localhost;
grant select on v4 to mysqltest_1@localhost;
grant select on v5 to mysqltest_1@localhost;
use mysqltest;
select * from v1;
f2()
NULL
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
select * from v2;
f2()
NULL
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
select * from v3;
ERROR HY000: View 'mysqltest.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from v4;
ERROR HY000: View 'mysqltest.v4' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from v5;
ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
use test;
drop view v1, v2, v3, v4, v5;
drop function f2;
drop table t1, t2;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
use mysqltest;
create table t1 (a int);
insert into t1 values (1);
create table t2 (s1 int);
drop function if exists f2;
create function f2 () returns int begin declare v int; select s1 from t2
into v; return v; end//
grant select on t1 to mysqltest_1@localhost;
grant execute on function f2 to mysqltest_1@localhost;
grant create view on mysqltest.* to mysqltest_1@localhost;
use mysqltest;
create algorithm=TEMPTABLE view v1 as select f2() from t1;
create algorithm=MERGE view v2 as select f2() from t1;
create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1;
create algorithm=MERGE SQL SECURITY INVOKER view v4 as select f2() from t1;
use test;
create view v5 as select * from v1;
revoke execute on function f2 from mysqltest_1@localhost;
select * from v1;
ERROR HY000: View 'mysqltest.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from v2;
ERROR HY000: View 'mysqltest.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from v3;
f2()
NULL
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
select * from v4;
f2()
NULL
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
select * from v5;
ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1, v2, v3, v4, v5;
drop function f2;
drop table t1, t2;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
use mysqltest;
create table t1 (a int);
create table v1 (a int);
insert into t1 values (1);
grant select on t1 to mysqltest_1@localhost;
grant select on v1 to mysqltest_1@localhost;
grant create view on mysqltest.* to mysqltest_1@localhost;
drop table v1;
use mysqltest;
create algorithm=TEMPTABLE view v1 as select *, a as b from t1;
create algorithm=MERGE view v2 as select *, a as b from t1;
create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from t1;
create algorithm=MERGE SQL SECURITY INVOKER view v4 as select *, a as b from t1;
create view v5 as select * from v1;
use test;
revoke select on t1 from mysqltest_1@localhost;
select * from v1;
ERROR HY000: View 'mysqltest.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from v2;
ERROR HY000: View 'mysqltest.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from v3;
a b
1 1
select * from v4;
a b
1 1
select * from v5;
ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop table t1;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
use mysqltest;
create table t1 (a int);
insert into t1 values (1);
create algorithm=TEMPTABLE view v1 as select *, a as b from t1;
create algorithm=MERGE view v2 as select *, a as b from t1;
create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from t1;
create algorithm=MERGE SQL SECURITY INVOKER view v4 as select *, a as b from t1;
create SQL SECURITY INVOKER view v5 as select * from v4;
grant select on v1 to mysqltest_1@localhost;
grant select on v2 to mysqltest_1@localhost;
grant select on v3 to mysqltest_1@localhost;
grant select on v4 to mysqltest_1@localhost;
grant select on v5 to mysqltest_1@localhost;
use mysqltest;
select * from v1;
a b
1 1
select * from v2;
a b
1 1
select * from v3;
ERROR HY000: View 'mysqltest.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from v4;
ERROR HY000: View 'mysqltest.v4' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from v5;
ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
use test;
drop view v1, v2, v3, v4, v5;
drop table t1;
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest;
drop view if exists v1;
drop table if exists t1;
create table t1 as select * from mysql.user where user='';
delete from mysql.user where user='';
flush privileges;
grant all on test.* to 'test14256'@'%';
use test;
create view v1 as select 42;
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`test14256`@`%` SQL SECURITY DEFINER VIEW `v1` AS select 42 AS `42` latin1 latin1_swedish_ci
select definer into @v1def1 from information_schema.views
where table_schema = 'test' and table_name='v1';
drop view v1;
create definer=`test14256`@`%` view v1 as select 42;
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`test14256`@`%` SQL SECURITY DEFINER VIEW `v1` AS select 42 AS `42` latin1 latin1_swedish_ci
select definer into @v1def2 from information_schema.views
where table_schema = 'test' and table_name='v1';
drop view v1;
select @v1def1, @v1def2, @v1def1=@v1def2;
@v1def1 @v1def2 @v1def1=@v1def2
test14256@% test14256@% 1
drop user test14256;
insert into mysql.user select * from t1;
flush privileges;
drop table t1;
create database mysqltest;
use mysqltest;
CREATE TABLE t1 (i INT);
CREATE VIEW v1 AS SELECT * FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost;
use mysqltest;
LOCK TABLES v1 READ;
SHOW CREATE TABLE v1;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
UNLOCK TABLES;
use test;
use test;
drop user mysqltest_1@localhost;
drop database mysqltest;
create definer=some_user@`` sql security invoker view v1 as select 1;
Warnings:
Note 1449 The user specified as a definer ('some_user'@'') does not exist
create definer=some_user@localhost sql security invoker view v2 as select 1;
Warnings:
Note 1449 The user specified as a definer ('some_user'@'localhost') does not exist
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci
show create view v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select 1 AS `1` latin1 latin1_swedish_ci
drop view v1;
drop view v2;
CREATE DATABASE mysqltest1;
CREATE USER readonly@localhost;
CREATE TABLE mysqltest1.t1 (x INT);
INSERT INTO mysqltest1.t1 VALUES (1), (2);
CREATE SQL SECURITY INVOKER VIEW mysqltest1.v_t1 AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_ts AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_ti AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tu AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tus AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_td AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tds AS SELECT * FROM mysqltest1.t1;
GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly@localhost;
GRANT SELECT ON mysqltest1.v_ts TO readonly@localhost;
GRANT INSERT ON mysqltest1.v_ti TO readonly@localhost;
GRANT UPDATE ON mysqltest1.v_tu TO readonly@localhost;
GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost;
GRANT DELETE ON mysqltest1.v_td TO readonly@localhost;
GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost;
SELECT * FROM mysqltest1.v_t1;
ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
INSERT INTO mysqltest1.v_t1 VALUES(4);
ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
DELETE FROM mysqltest1.v_t1 WHERE x = 1;
ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2;
ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
UPDATE mysqltest1.v_t1 SET x = 3;
ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
DELETE FROM mysqltest1.v_t1;
ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
SELECT 1 FROM mysqltest1.v_t1;
ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
SELECT * FROM mysqltest1.t1;
ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 't1'
SELECT * FROM mysqltest1.v_ts;
x
1
2
SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x;
ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 't1'
SELECT * FROM mysqltest1.v_ti;
ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 'v_ti'
INSERT INTO mysqltest1.v_ts VALUES (100);
ERROR 42000: INSERT command denied to user 'readonly'@'localhost' for table 'v_ts'
INSERT INTO mysqltest1.v_ti VALUES (100);
UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100;
ERROR 42000: UPDATE command denied to user 'readonly'@'localhost' for table 'v_ts'
UPDATE mysqltest1.v_ts SET x= 200;
ERROR 42000: UPDATE command denied to user 'readonly'@'localhost' for table 'v_ts'
UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tu SET x= 200;
DELETE FROM mysqltest1.v_ts WHERE x= 200;
ERROR 42000: DELETE command denied to user 'readonly'@'localhost' for table 'v_ts'
DELETE FROM mysqltest1.v_ts;
ERROR 42000: DELETE command denied to user 'readonly'@'localhost' for table 'v_ts'
DELETE FROM mysqltest1.v_td WHERE x= 200;
ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for column 'x' in table 'v_td'
DELETE FROM mysqltest1.v_tds WHERE x= 200;
DELETE FROM mysqltest1.v_td;
DROP VIEW mysqltest1.v_tds;
DROP VIEW mysqltest1.v_td;
DROP VIEW mysqltest1.v_tus;
DROP VIEW mysqltest1.v_tu;
DROP VIEW mysqltest1.v_ti;
DROP VIEW mysqltest1.v_ts;
DROP VIEW mysqltest1.v_t1;
DROP TABLE mysqltest1.t1;
DROP USER readonly@localhost;
DROP DATABASE mysqltest1;
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2), (3);
CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
Warnings:
Note 1449 The user specified as a definer ('no-such-user'@'localhost') does not exist
SHOW CREATE VIEW v;
View Create View character_set_client collation_connection
v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('no-such-user'@'localhost') does not exist
SELECT * FROM v;
ERROR HY000: The user specified as a definer ('no-such-user'@'localhost') does not exist
DROP VIEW v;
DROP TABLE t1;
USE test;
CREATE USER mysqltest_db1@localhost identified by 'PWD';
GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
CREATE SCHEMA mysqltest_db1 ;
USE mysqltest_db1 ;
CREATE TABLE t1 (f1 INTEGER);
CREATE VIEW view1 AS
SELECT * FROM t1;
SHOW CREATE VIEW view1;
View Create View character_set_client collation_connection
view1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view1` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
CREATE VIEW view2 AS
SELECT * FROM view1;
# Here comes a suspicious warning
SHOW CREATE VIEW view2;
View Create View character_set_client collation_connection
view2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view2` AS select `view1`.`f1` AS `f1` from `view1` latin1 latin1_swedish_ci
# But the view view2 is usable
SELECT * FROM view2;
f1
CREATE VIEW view3 AS
SELECT * FROM view2;
SELECT * from view3;
f1
DROP VIEW mysqltest_db1.view3;
DROP VIEW mysqltest_db1.view2;
DROP VIEW mysqltest_db1.view1;
DROP TABLE mysqltest_db1.t1;
DROP SCHEMA mysqltest_db1;
DROP USER mysqltest_db1@localhost;
CREATE DATABASE test1;
CREATE DATABASE test2;
CREATE TABLE test1.t0 (a VARCHAR(20)) engine=myisam;
CREATE TABLE test2.t1 (a VARCHAR(20));
CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
CREATE OR REPLACE VIEW test.v1 AS
SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
DROP VIEW test.v1;
DROP VIEW test2.t3;
DROP TABLE test2.t1, test1.t0;
DROP DATABASE test2;
DROP DATABASE test1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v2;
DROP VIEW IF EXISTS v3;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP PROCEDURE IF EXISTS p1;
CREATE SQL SECURITY DEFINER VIEW v1 AS SELECT CURRENT_USER() AS cu;
CREATE FUNCTION f1() RETURNS VARCHAR(77) SQL SECURITY INVOKER
RETURN CURRENT_USER();
CREATE SQL SECURITY DEFINER VIEW v2 AS SELECT f1() AS cu;
CREATE PROCEDURE p1(OUT cu VARCHAR(77)) SQL SECURITY INVOKER
SET cu= CURRENT_USER();
CREATE FUNCTION f2() RETURNS VARCHAR(77) SQL SECURITY INVOKER
BEGIN
DECLARE cu VARCHAR(77);
CALL p1(cu);
RETURN cu;
END|
CREATE SQL SECURITY DEFINER VIEW v3 AS SELECT f2() AS cu;
CREATE USER mysqltest_u1@localhost;
GRANT ALL ON test.* TO mysqltest_u1@localhost;
The following tests should all return 1.
SELECT CURRENT_USER() = 'mysqltest_u1@localhost';
CURRENT_USER() = 'mysqltest_u1@localhost'
1
SELECT f1() = 'mysqltest_u1@localhost';
f1() = 'mysqltest_u1@localhost'
1
CALL p1(@cu);
SELECT @cu = 'mysqltest_u1@localhost';
@cu = 'mysqltest_u1@localhost'
1
SELECT f2() = 'mysqltest_u1@localhost';
f2() = 'mysqltest_u1@localhost'
1
SELECT cu = 'root@localhost' FROM v1;
cu = 'root@localhost'
1
SELECT cu = 'root@localhost' FROM v2;
cu = 'root@localhost'
1
SELECT cu = 'root@localhost' FROM v3;
cu = 'root@localhost'
1
DROP VIEW v3;
DROP FUNCTION f2;
DROP PROCEDURE p1;
DROP FUNCTION f1;
DROP VIEW v2;
DROP VIEW v1;
DROP USER mysqltest_u1@localhost;
CREATE DATABASE db17254;
USE db17254;
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (10),(20);
CREATE USER def_17254@localhost;
GRANT SELECT ON db17254.* TO def_17254@localhost;
CREATE USER inv_17254@localhost;
GRANT SELECT ON db17254.t1 TO inv_17254@localhost;
GRANT CREATE VIEW ON db17254.* TO def_17254@localhost;
CREATE VIEW v1 AS SELECT * FROM t1;
DROP USER def_17254@localhost;
for a user
SELECT * FROM v1;
ERROR 42000: SELECT command denied to user 'inv_17254'@'localhost' for table 'v1'
for a superuser
SELECT * FROM v1;
ERROR HY000: The user specified as a definer ('def_17254'@'localhost') does not exist
DROP USER inv_17254@localhost;
DROP DATABASE db17254;
DROP DATABASE IF EXISTS mysqltest_db1;
DROP DATABASE IF EXISTS mysqltest_db2;
DROP USER mysqltest_u1;
DROP USER mysqltest_u2;
CREATE USER mysqltest_u1@localhost;
CREATE USER mysqltest_u2@localhost;
CREATE DATABASE mysqltest_db1;
CREATE DATABASE mysqltest_db2;
GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost WITH GRANT OPTION;
GRANT ALL ON mysqltest_db2.* TO mysqltest_u2@localhost;
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1);
CREATE VIEW v1 AS SELECT i FROM t1 WHERE 1 IN (SELECT * FROM t1);
CREATE TABLE t2 (s CHAR(7));
INSERT INTO t2 VALUES ('public');
GRANT SELECT ON v1 TO mysqltest_u2@localhost;
GRANT SELECT ON t2 TO mysqltest_u2@localhost;
SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2;
i s
1 public
PREPARE stmt1 FROM "SELECT * FROM mysqltest_db1.t2";
EXECUTE stmt1;
s
public
PREPARE stmt2 FROM "SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2";
EXECUTE stmt2;
i s
1 public
REVOKE SELECT ON t2 FROM mysqltest_u2@localhost;
UPDATE t2 SET s = 'private' WHERE s = 'public';
SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2;
ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2'
EXECUTE stmt1;
ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2'
EXECUTE stmt2;
ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2'
REVOKE ALL ON mysqltest_db1.* FROM mysqltest_u1@localhost;
REVOKE ALL ON mysqltest_db2.* FROM mysqltest_u2@localhost;
DROP DATABASE mysqltest_db1;
DROP DATABASE mysqltest_db2;
DROP USER mysqltest_u1@localhost;
DROP USER mysqltest_u2@localhost;
CREATE DATABASE db26813;
USE db26813;
CREATE TABLE t1(f1 INT, f2 INT);
CREATE VIEW v1 AS SELECT f1 FROM t1;
CREATE VIEW v2 AS SELECT f1 FROM t1;
CREATE VIEW v3 AS SELECT f1 FROM t1;
CREATE USER u26813@localhost;
GRANT DROP ON db26813.v1 TO u26813@localhost;
GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost;
GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost;
GRANT SELECT ON db26813.t1 TO u26813@localhost;
ALTER VIEW v1 AS SELECT f2 FROM t1;
ERROR 42000: CREATE VIEW command denied to user 'u26813'@'localhost' for table 'v1'
ALTER VIEW v2 AS SELECT f2 FROM t1;
ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2'
ALTER VIEW v3 AS SELECT f2 FROM t1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
SHOW CREATE VIEW v3;
View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
DROP USER u26813@localhost;
DROP DATABASE db26813;
#
# Bug#29908 A user can gain additional access through the ALTER VIEW.
#
CREATE DATABASE mysqltest_29908;
USE mysqltest_29908;
CREATE TABLE t1(f1 INT, f2 INT);
CREATE USER u29908_1@localhost;
CREATE DEFINER = u29908_1@localhost VIEW v1 AS SELECT f1 FROM t1;
CREATE DEFINER = u29908_1@localhost SQL SECURITY INVOKER VIEW v2 AS
SELECT f1 FROM t1;
GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost;
GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost;
GRANT SELECT ON mysqltest_29908.t1 TO u29908_1@localhost;
CREATE USER u29908_2@localhost;
GRANT SELECT, DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost;
GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost;
ALTER VIEW v1 AS SELECT f2 FROM t1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
ALTER VIEW v2 AS SELECT f2 FROM t1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
SHOW CREATE VIEW v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
ALTER VIEW v1 AS SELECT f2 FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci
ALTER VIEW v2 AS SELECT f2 FROM t1;
SHOW CREATE VIEW v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci
ALTER VIEW v1 AS SELECT f1 FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
ALTER VIEW v2 AS SELECT f1 FROM t1;
SHOW CREATE VIEW v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
DROP USER u29908_1@localhost;
DROP USER u29908_2@localhost;
DROP DATABASE mysqltest_29908;
#######################################################################
DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2;
CREATE DATABASE mysqltest1;
CREATE DATABASE mysqltest2;
CREATE TABLE mysqltest1.t1(c1 INT);
CREATE TABLE mysqltest1.t2(c2 INT);
CREATE TABLE mysqltest1.t3(c3 INT);
CREATE TABLE mysqltest1.t4(c4 INT);
INSERT INTO mysqltest1.t1 VALUES (11), (12), (13), (14);
INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24);
INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34);
INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44);
GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost;
GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost;
GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost;
GRANT SELECT, DELETE ON mysqltest1.t4 TO mysqltest_u1@localhost;
GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u1@localhost;
---> connection: bug24040_con
SELECT * FROM mysqltest1.t1;
c1
11
12
13
14
INSERT INTO mysqltest1.t2 VALUES(25);
UPDATE mysqltest1.t3 SET c3 = 331 WHERE c3 = 31;
DELETE FROM mysqltest1.t4 WHERE c4 = 44;
CREATE VIEW v1 AS SELECT * FROM mysqltest1.t1;
CREATE VIEW v2 AS SELECT * FROM mysqltest1.t2;
CREATE VIEW v3 AS SELECT * FROM mysqltest1.t3;
CREATE VIEW v4 AS SELECT * FROM mysqltest1.t4;
SELECT * FROM v1;
c1
11
12
13
14
INSERT INTO v2 VALUES(26);
UPDATE v3 SET c3 = 332 WHERE c3 = 32;
DELETE FROM v4 WHERE c4 = 43;
CREATE VIEW v12 AS SELECT c1, c2 FROM mysqltest1.t1, mysqltest1.t2;
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v12'
CREATE VIEW v13 AS SELECT c1, c3 FROM mysqltest1.t1, mysqltest1.t3;
CREATE VIEW v14 AS SELECT c1, c4 FROM mysqltest1.t1, mysqltest1.t4;
CREATE VIEW v21 AS SELECT c2, c1 FROM mysqltest1.t2, mysqltest1.t1;
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c1' in table 'v21'
CREATE VIEW v23 AS SELECT c2, c3 FROM mysqltest1.t2, mysqltest1.t3;
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c3' in table 'v23'
CREATE VIEW v24 AS SELECT c2, c4 FROM mysqltest1.t2, mysqltest1.t4;
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c4' in table 'v24'
CREATE VIEW v31 AS SELECT c3, c1 FROM mysqltest1.t3, mysqltest1.t1;
CREATE VIEW v32 AS SELECT c3, c2 FROM mysqltest1.t3, mysqltest1.t2;
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v32'
CREATE VIEW v34 AS SELECT c3, c4 FROM mysqltest1.t3, mysqltest1.t4;
CREATE VIEW v41 AS SELECT c4, c1 FROM mysqltest1.t4, mysqltest1.t1;
CREATE VIEW v42 AS SELECT c4, c2 FROM mysqltest1.t4, mysqltest1.t2;
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v42'
CREATE VIEW v43 AS SELECT c4, c3 FROM mysqltest1.t4, mysqltest1.t3;
---> connection: default
SELECT * FROM mysqltest1.t1;
c1
11
12
13
14
SELECT * FROM mysqltest1.t2;
c2
21
22
23
24
25
26
SELECT * FROM mysqltest1.t3 order by c3;
c3
33
34
331
332
SELECT * FROM mysqltest1.t4;
c4
41
42
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
DROP USER mysqltest_u1@localhost;
End of 5.0 tests.
DROP VIEW IF EXISTS v1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT);
CREATE VIEW v1 AS SELECT * FROM t1;
ALTER VIEW v1 AS SELECT * FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
ALTER DEFINER=no_such@user_1 VIEW v1 AS SELECT * FROM t1;
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1;
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`no_such`@`user_2` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist
DROP VIEW v1;
DROP TABLE t1;
End of 5.1 tests.

View File

@@ -0,0 +1 @@
--innodb_flush_neighbor_pages=cont

View File

@@ -0,0 +1,21 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT AUTO_INCREMENT, foo CHAR(255), PRIMARY KEY (id)) ENGINE=InnoDB;
INSERT INTO t1(foo) VALUES ('a'), ('b');
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
DROP TABLE t1;

View File

@@ -0,0 +1,37 @@
# Test for innodb_flush_neighbor_pages=contiguous.
# The test is very crude: we simply overflow the buffer pool with such a number of
# new/modified pages that some flushing is bound to happen.
--source include/have_innodb.inc
--source include/big_test.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (id INT AUTO_INCREMENT, foo CHAR(255), PRIMARY KEY (id)) ENGINE=InnoDB;
INSERT INTO t1(foo) VALUES ('a'), ('b');
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
INSERT INTO t1(foo) SELECT foo FROM t1;
# TODO: cannot record a stable value here. A check of > 0 should be enough,
# but the variable is not accessible through INFORMATION_SCHEMA currently.
# SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_pages_flushed';
DROP TABLE t1;

View File

@@ -100,10 +100,10 @@ SHOW QUERY_RESPONSE_TIME;
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -146,10 +146,10 @@ time count total
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
@@ -251,10 +251,10 @@ SHOW QUERY_RESPONSE_TIME;
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -297,10 +297,10 @@ time count total
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
@@ -375,7 +375,7 @@ SHOW QUERY_RESPONSE_TIME;
1000.000000 0 0.000000
10000.000000 0 0.000000
100000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -391,7 +391,7 @@ time count total
1000.000000 0 0.000000
10000.000000 0 0.000000
100000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
@@ -469,7 +469,7 @@ SHOW QUERY_RESPONSE_TIME;
16807.000000 0 0.000000
117649.000000 0 0.000000
823543.000000 0 0.000000
5764801.00000 0 0.000000
5764801.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -488,7 +488,7 @@ time count total
16807.000000 0 0.000000
117649.000000 0 0.000000
823543.000000 0 0.000000
5764801.00000 0 0.000000
5764801.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
@@ -556,7 +556,7 @@ SHOW QUERY_RESPONSE_TIME;
1.000000 34 12.250000
156.000000 33 77.099997
24336.000000 0 0.000000
3796416.00000 0 0.000000
3796416.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -565,7 +565,7 @@ time count total
1.000000 34 12.250000
156.000000 33 77.099997
24336.000000 0 0.000000
3796416.00000 0 0.000000
3796416.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
@@ -632,7 +632,7 @@ SHOW QUERY_RESPONSE_TIME;
0.001000 0 0.000000
1.000000 34 12.250000
1000.000000 33 77.099997
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -640,7 +640,7 @@ time count total
0.001000 0 0.000000
1.000000 34 12.250000
1000.000000 33 77.099997
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
@@ -709,7 +709,7 @@ SHOW QUERY_RESPONSE_TIME;
0.001000 0 0.000000
1.000000 34 12.250000
1000.000000 33 77.099997
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -717,7 +717,7 @@ time count total
0.001000 0 0.000000
1.000000 34 12.250000
1000.000000 33 77.099997
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;

View File

@@ -80,10 +80,10 @@ SHOW QUERY_RESPONSE_TIME;
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -126,10 +126,10 @@ time count total
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -204,10 +204,10 @@ SHOW QUERY_RESPONSE_TIME;
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -250,10 +250,10 @@ time count total
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -301,7 +301,7 @@ SHOW QUERY_RESPONSE_TIME;
1000.000000 0 0.000000
10000.000000 0 0.000000
100000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -317,7 +317,7 @@ time count total
1000.000000 0 0.000000
10000.000000 0 0.000000
100000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -368,7 +368,7 @@ SHOW QUERY_RESPONSE_TIME;
16807.000000 0 0.000000
117649.000000 0 0.000000
823543.000000 0 0.000000
5764801.00000 0 0.000000
5764801.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -387,7 +387,7 @@ time count total
16807.000000 0 0.000000
117649.000000 0 0.000000
823543.000000 0 0.000000
5764801.00000 0 0.000000
5764801.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -428,7 +428,7 @@ SHOW QUERY_RESPONSE_TIME;
1.000000 55 8.450000
156.000000 11 25.699999
24336.000000 0 0.000000
3796416.00000 0 0.000000
3796416.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -437,7 +437,7 @@ time count total
1.000000 55 8.450000
156.000000 11 25.699999
24336.000000 0 0.000000
3796416.00000 0 0.000000
3796416.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -477,7 +477,7 @@ SHOW QUERY_RESPONSE_TIME;
0.001000 0 0.000000
1.000000 55 8.450000
1000.000000 11 25.699999
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -485,7 +485,7 @@ time count total
0.001000 0 0.000000
1.000000 55 8.450000
1000.000000 11 25.699999
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -527,7 +527,7 @@ SHOW QUERY_RESPONSE_TIME;
0.001000 0 0.000000
1.000000 55 8.450000
1000.000000 11 25.699999
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -535,7 +535,7 @@ time count total
0.001000 0 0.000000
1.000000 55 8.450000
1000.000000 11 25.699999
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;

View File

@@ -45,10 +45,10 @@ SHOW QUERY_RESPONSE_TIME;
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -91,10 +91,10 @@ time count total
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SET SESSION query_exec_time=0.31;
@@ -231,10 +231,10 @@ SHOW QUERY_RESPONSE_TIME;
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -277,10 +277,10 @@ time count total
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -328,10 +328,10 @@ SHOW QUERY_RESPONSE_TIME;
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -374,10 +374,10 @@ time count total
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SET SESSION query_exec_time=0.31;
@@ -514,10 +514,10 @@ SHOW QUERY_RESPONSE_TIME;
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -560,10 +560,10 @@ time count total
131072.000000 0 0.000000
262144.000000 0 0.000000
524288.000000 0 0.000000
1048576.00000 0 0.000000
2097152.00000 0 0.000000
4194304.00000 0 0.000000
8388608.00000 0 0.000000
1048576.000000 0 0.000000
2097152.000000 0 0.000000
4194304.000000 0 0.000000
8388608.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -584,7 +584,7 @@ SHOW QUERY_RESPONSE_TIME;
1000.000000 0 0.000000
10000.000000 0 0.000000
100000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -600,7 +600,7 @@ time count total
1000.000000 0 0.000000
10000.000000 0 0.000000
100000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SET SESSION query_exec_time=0.31;
@@ -710,7 +710,7 @@ SHOW QUERY_RESPONSE_TIME;
1000.000000 0 0.000000
10000.000000 0 0.000000
100000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -726,7 +726,7 @@ time count total
1000.000000 0 0.000000
10000.000000 0 0.000000
100000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -750,7 +750,7 @@ SHOW QUERY_RESPONSE_TIME;
16807.000000 0 0.000000
117649.000000 0 0.000000
823543.000000 0 0.000000
5764801.00000 0 0.000000
5764801.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -769,7 +769,7 @@ time count total
16807.000000 0 0.000000
117649.000000 0 0.000000
823543.000000 0 0.000000
5764801.00000 0 0.000000
5764801.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SET SESSION query_exec_time=0.31;
@@ -882,7 +882,7 @@ SHOW QUERY_RESPONSE_TIME;
16807.000000 0 0.000000
117649.000000 0 0.000000
823543.000000 0 0.000000
5764801.00000 0 0.000000
5764801.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -901,7 +901,7 @@ time count total
16807.000000 0 0.000000
117649.000000 0 0.000000
823543.000000 0 0.000000
5764801.00000 0 0.000000
5764801.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -915,7 +915,7 @@ SHOW QUERY_RESPONSE_TIME;
1.000000 0 0.000000
156.000000 0 0.000000
24336.000000 0 0.000000
3796416.00000 0 0.000000
3796416.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -924,7 +924,7 @@ time count total
1.000000 0 0.000000
156.000000 0 0.000000
24336.000000 0 0.000000
3796416.00000 0 0.000000
3796416.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SET SESSION query_exec_time=0.31;
@@ -1027,7 +1027,7 @@ SHOW QUERY_RESPONSE_TIME;
1.000000 11 4.050000
156.000000 11 25.699999
24336.000000 0 0.000000
3796416.00000 0 0.000000
3796416.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -1036,7 +1036,7 @@ time count total
1.000000 11 4.050000
156.000000 11 25.699999
24336.000000 0 0.000000
3796416.00000 0 0.000000
3796416.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -1049,7 +1049,7 @@ SHOW QUERY_RESPONSE_TIME;
0.001000 0 0.000000
1.000000 0 0.000000
1000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -1057,7 +1057,7 @@ time count total
0.001000 0 0.000000
1.000000 0 0.000000
1000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SET SESSION query_exec_time=0.31;
@@ -1159,7 +1159,7 @@ SHOW QUERY_RESPONSE_TIME;
0.001000 0 0.000000
1.000000 11 4.050000
1000.000000 11 25.699999
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -1167,7 +1167,7 @@ time count total
0.001000 0 0.000000
1.000000 11 4.050000
1000.000000 11 25.699999
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET SESSION query_exec_time=0.1;
@@ -1182,7 +1182,7 @@ SHOW QUERY_RESPONSE_TIME;
0.001000 0 0.000000
1.000000 0 0.000000
1000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -1190,7 +1190,7 @@ time count total
0.001000 0 0.000000
1.000000 0 0.000000
1000.000000 0 0.000000
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SET SESSION query_exec_time=0.31;
@@ -1292,7 +1292,7 @@ SHOW QUERY_RESPONSE_TIME;
0.001000 0 0.000000
1.000000 11 4.050000
1000.000000 11 25.699999
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time count total
@@ -1300,7 +1300,7 @@ time count total
0.001000 0 0.000000
1.000000 11 4.050000
1000.000000 11 25.699999
1000000.00000 0 0.000000
1000000.000000 0 0.000000
TOO LONG 0 TOO LONG
SET SESSION query_exec_time=default;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;

View File

@@ -109,6 +109,7 @@ INNODB_FILE_FORMAT
INNODB_FILE_FORMAT_CHECK
INNODB_FILE_FORMAT_MAX
INNODB_FILE_PER_TABLE
INNODB_FLUSH_CHECKPOINT_DEBUG
INNODB_FLUSH_LOG_AT_TRX_COMMIT
INNODB_FLUSH_METHOD
INNODB_FLUSH_NEIGHBOR_PAGES
@@ -228,6 +229,7 @@ MAX_SP_RECURSION_DEPTH
MAX_TMP_TABLES
MAX_USER_CONNECTIONS
MAX_WRITE_LOCK_COUNT
METADATA_LOCKS_CACHE_SIZE
MIN_EXAMINED_ROW_LIMIT
MULTI_RANGE_COUNT
MYISAM_DATA_POINTER_SIZE

View File

@@ -225,6 +225,7 @@ MAX_SP_RECURSION_DEPTH
MAX_TMP_TABLES
MAX_USER_CONNECTIONS
MAX_WRITE_LOCK_COUNT
METADATA_LOCKS_CACHE_SIZE
MIN_EXAMINED_ROW_LIMIT
MULTI_RANGE_COUNT
MYISAM_DATA_POINTER_SIZE

View File

@@ -0,0 +1,35 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT AUTO_INCREMENT, foo CHAR(255), PRIMARY KEY (id)) ENGINE=InnoDB;
SET @@global.innodb_flush_checkpoint_debug=1;
INSERT INTO t1(foo) VALUES ('a'), ('b');
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
SET @@global.innodb_flush_checkpoint_debug=0;
UPDATE t1 SET foo='d' WHERE foo='c';
DROP TABLE t1;

View File

@@ -0,0 +1,33 @@
# Test for InnoDB sync state flushing.
--source include/have_innodb.inc
--source include/have_debug.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (id INT AUTO_INCREMENT, foo CHAR(255), PRIMARY KEY (id)) ENGINE=InnoDB;
# It is hard to get to InnoDB sync state flushing in MTR with regular workload. Perhaps
# it is possible with many parallel connections, but that would be brittle anyway.
# So, just disable preflushing and checkpointing and issue simple workload.
SET @@global.innodb_flush_checkpoint_debug=1;
INSERT INTO t1(foo) VALUES ('a'), ('b');
let $rep=0;
while ($rep < 14)
{
INSERT INTO t1(foo) SELECT foo FROM t1;
UPDATE t1 SET foo='c';
inc $rep;
}
# By now checkpoint age should be well past sync flush point. Allow
# preflushing/checkpointing again and do some work in order to do the sync flush.
SET @@global.innodb_flush_checkpoint_debug=0;
UPDATE t1 SET foo='d' WHERE foo='c';
DROP TABLE t1;

View File

@@ -91,5 +91,27 @@ let $query=select * from t1 -- comment in the end
;
--source percona_query_cache_with_comments_eval.inc
let $query=select */* a comment \*/from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select *# a comment \\
from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select *-- a comment \\
from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select "\\\\"" /* not a comment */" from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select "\\\\"" /*! not a comment */" from t1;
--source include/percona_query_cache_with_comments_eval.inc
# following two queries related to bug #856404.
# There are different queries, but opt_query_cache_strip_comments thinks that they are equal.
let $query=select ' \' ' from t1;
--source percona_query_cache_with_comments_eval.inc
let $query=select ' \' /* comment inside quotes with internal backslash quote */' from t1;
--source percona_query_cache_with_comments_eval.inc

View File

@@ -831,7 +831,7 @@ show status like "Qcache_hits";
Variable_name Value
Qcache_hits 50
-----------------------------------------------------
select ' \' ' from t1
select */* a comment \*/from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
@@ -842,6 +842,167 @@ Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 50
select */* a comment \*/from t1;
a
1
2
3
select */* a comment \*/from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 52
-----------------------------------------------------
select *# a comment \
from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 52
select *# a comment \
from t1;
a
1
2
3
select *# a comment \
from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 54
-----------------------------------------------------
select *-- a comment \
from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 54
select *-- a comment \
from t1;
a
1
2
3
select *-- a comment \
from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 56
-----------------------------------------------------
select "\\"" /* not a comment */" from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 56
select "\\"" /* not a comment */" from t1;
\" /* not a comment */
\" /* not a comment */
\" /* not a comment */
\" /* not a comment */
select "\\"" /* not a comment */" from t1;
\" /* not a comment */
\" /* not a comment */
\" /* not a comment */
\" /* not a comment */
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 2
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 57
-----------------------------------------------------
select "\\"" /*! not a comment */" from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 2
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 57
select "\\"" /*! not a comment */" from t1;
\" /*! not a comment */
\" /*! not a comment */
\" /*! not a comment */
\" /*! not a comment */
select "\\"" /*! not a comment */" from t1;
\" /*! not a comment */
\" /*! not a comment */
\" /*! not a comment */
\" /*! not a comment */
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 3
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 58
-----------------------------------------------------
select ' \' ' from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 3
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 58
select ' \' ' from t1;
'
'
@@ -854,13 +1015,44 @@ select ' \' ' from t1;
'
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
Qcache_queries_in_cache 4
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 2
Qcache_inserts 4
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 51
Qcache_hits 59
-----------------------------------------------------
select ' \' /* comment inside quotes with internal backslash quote */' from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 4
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 4
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 59
select ' \' /* comment inside quotes with internal backslash quote */' from t1;
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
select ' \' /* comment inside quotes with internal backslash quote */' from t1;
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 5
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 5
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 60
DROP TABLE t1;
SET GLOBAL query_cache_size=default;
set global query_cache_strip_comments=OFF;

View File

@@ -830,7 +830,7 @@ show status like "Qcache_hits";
Variable_name Value
Qcache_hits 25
-----------------------------------------------------
select ' \' ' from t1
select */* a comment \*/from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
@@ -841,6 +841,167 @@ Qcache_inserts 20
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 25
select */* a comment \*/from t1;
a
1
2
3
select */* a comment \*/from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 21
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 21
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 26
-----------------------------------------------------
select *# a comment \
from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 21
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 21
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 26
select *# a comment \
from t1;
a
1
2
3
select *# a comment \
from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 22
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 22
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 27
-----------------------------------------------------
select *-- a comment \
from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 22
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 22
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 27
select *-- a comment \
from t1;
a
1
2
3
select *-- a comment \
from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 23
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 23
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 28
-----------------------------------------------------
select "\\"" /* not a comment */" from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 23
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 23
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 28
select "\\"" /* not a comment */" from t1;
\" /* not a comment */
\" /* not a comment */
\" /* not a comment */
\" /* not a comment */
select "\\"" /* not a comment */" from t1;
\" /* not a comment */
\" /* not a comment */
\" /* not a comment */
\" /* not a comment */
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 24
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 24
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 29
-----------------------------------------------------
select "\\"" /*! not a comment */" from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 24
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 24
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 29
select "\\"" /*! not a comment */" from t1;
\" /*! not a comment */
\" /*! not a comment */
\" /*! not a comment */
\" /*! not a comment */
select "\\"" /*! not a comment */" from t1;
\" /*! not a comment */
\" /*! not a comment */
\" /*! not a comment */
\" /*! not a comment */
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 25
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 25
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 30
-----------------------------------------------------
select ' \' ' from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 25
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 25
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 30
select ' \' ' from t1;
'
'
@@ -853,13 +1014,44 @@ select ' \' ' from t1;
'
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 21
Qcache_queries_in_cache 26
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 21
Qcache_inserts 26
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 26
Qcache_hits 31
-----------------------------------------------------
select ' \' /* comment inside quotes with internal backslash quote */' from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 26
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 26
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 31
select ' \' /* comment inside quotes with internal backslash quote */' from t1;
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
select ' \' /* comment inside quotes with internal backslash quote */' from t1;
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
' /* comment inside quotes with internal backslash quote */
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 27
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 27
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 32
DROP TABLE t1;
SET GLOBAL query_cache_size=default;
set global query_cache_strip_comments=OFF;

View File

@@ -3,21 +3,18 @@ flush query cache;
flush query cache;
reset query cache;
flush status;
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT, number INT);
INSERT INTO t VALUES (0,1);
INSERT INTO t VALUES (1,2);
INSERT INTO t VALUES (2,3);
SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
SELECT number from t where id > 0;
SHOW PROCESSLIST;
Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
### root ### test Query ### NULL SHOW PROCESSLIST ### ### ###
### root ### test Query ### Waiting on query cache mutex SELECT number from t where id > 0 ### ### ###
SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
id info state
### SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id executing
### SELECT number from t where id > 0 Waiting on query cache mutex
DROP TABLE t;
SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
SELECT "mutex_locked_query" as action;
SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
SELECT "try_lock_mutex_query" as action;
SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='SELECT "try_lock_mutex_query" as action';
state
Waiting on query cache mutex
SET DEBUG_SYNC='now SIGNAL unlock_mutex';
action
mutex_locked_query
action
try_lock_mutex_query
SET GLOBAL query_cache_size=0;

View File

@@ -3,29 +3,33 @@
--source include/have_debug_sync.inc
SET GLOBAL query_cache_size=1355776;
--source include/percona_query_cache_with_comments_clear.inc
--let try_lock_mutex_query=SELECT "try_lock_mutex_query" as action
-- disable_warnings
DROP TABLE IF EXISTS t;
-- enable_warnings
CREATE TABLE t(id INT, number INT);
INSERT INTO t VALUES (0,1);
INSERT INTO t VALUES (1,2);
INSERT INTO t VALUES (2,3);
--connect (mutex_locked_conn, localhost, root,,)
--connect (try_mutex_lock_conn, localhost, root,,)
--connect (conn,localhost,root,,)
--connection conn
SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
SEND SELECT number from t where id > 0;
--connection mutex_locked_conn
SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
send SELECT "mutex_locked_query" as action;
--connection default
--replace_column 1 ### 3 ### 6 ### 9 ### 10 ### 11 ###
SHOW PROCESSLIST;
SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
--replace_column 1 ###
SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
--connection try_mutex_lock_conn
SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
send_eval $try_lock_mutex_query;
--disconnect conn
DROP TABLE t;
--connection default
SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
eval SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='$try_lock_mutex_query';
SET DEBUG_SYNC='now SIGNAL unlock_mutex';
--connection mutex_locked_conn
reap;
--connection try_mutex_lock_conn
reap;
--connection default
--disconnect mutex_locked_conn
--disconnect try_mutex_lock_conn
SET GLOBAL query_cache_size=0;

View File

@@ -1,5 +1,8 @@
use performance_schema;
select name from mutex_instances where name not rlike '/(DEBUG_SYNC::mutex)$' group by name;
select name from mutex_instances
where name not rlike '/(DEBUG_SYNC::mutex)$'
and name != 'wait/synch/mutex/mysys/BITMAP::mutex'
group by name;
name
wait/synch/mutex/archive/archive_mutex
wait/synch/mutex/aria/LOCK_trn_list
@@ -16,7 +19,6 @@ wait/synch/mutex/blackhole/blackhole
wait/synch/mutex/csv/tina
wait/synch/mutex/memory/HP_SHARE::intern_lock
wait/synch/mutex/myisam/MYISAM_SHARE::intern_lock
wait/synch/mutex/mysys/BITMAP::mutex
wait/synch/mutex/mysys/KEY_CACHE::cache_lock
wait/synch/mutex/mysys/LOCK_alarm
wait/synch/mutex/mysys/LOCK_uuid_generator
@@ -51,7 +53,6 @@ wait/synch/mutex/sql/LOCK_global_index_stats
wait/synch/mutex/sql/LOCK_global_system_variables
wait/synch/mutex/sql/LOCK_global_table_stats
wait/synch/mutex/sql/LOCK_global_user_client_stats
wait/synch/mutex/sql/LOCK_manager
wait/synch/mutex/sql/LOCK_open
wait/synch/mutex/sql/LOCK_plugin
wait/synch/mutex/sql/LOCK_prepared_stmt_count
@@ -112,7 +113,6 @@ wait/synch/cond/mysys/COND_alarm
wait/synch/cond/mysys/my_thread_var::suspend
wait/synch/cond/mysys/THR_COND_threads
wait/synch/cond/sql/COND_flush_thread_cache
wait/synch/cond/sql/COND_manager
wait/synch/cond/sql/COND_queue_state
wait/synch/cond/sql/COND_rpl_status
wait/synch/cond/sql/COND_server_started

View File

@@ -82,7 +82,7 @@ count(name)
select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_manager";
count(name)
1
0
select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_global_system_variables";
count(name)
@@ -170,7 +170,7 @@ count(name)
select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_manager";
count(name)
1
0
select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_thread_cache";
count(name)

View File

@@ -18,7 +18,10 @@ use performance_schema;
# "where" filters out instances that can be conditionally compiled out
#
select name from mutex_instances where name not rlike '/(DEBUG_SYNC::mutex)$' group by name;
select name from mutex_instances
where name not rlike '/(DEBUG_SYNC::mutex)$'
and name != 'wait/synch/mutex/mysys/BITMAP::mutex'
group by name;
# CRYPTO_dynlock_value::lock exists only when building with OpenSSL (not YaSSL).
select name from rwlock_instances
where name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock")

View File

@@ -0,0 +1,30 @@
install plugin unix_socket soname 'auth_socket.so';
#
# with named user
#
create user USER identified via unix_socket;
#
# name match = ok
#
select user(), current_user(), database();
user() current_user() database()
USER@localhost USER@% test
#
# name does not match = failure
#
drop user USER;
#
# and now with anonymous user
#
grant SELECT ON test.* TO '' identified via unix_socket;
#
# name match = ok
#
select user(), current_user(), database();
user() current_user() database()
USER@localhost @% test
#
# name does not match = failure
#
delete from mysql.user where user='';
uninstall plugin unix_socket;

View File

@@ -0,0 +1,56 @@
--source include/not_embedded.inc
if (!$AUTH_SOCKET_SO) {
skip No auth_socket plugin;
}
let $plugindir=`SELECT @@global.plugin_dir`;
eval install plugin unix_socket soname '$AUTH_SOCKET_SO';
--echo #
--echo # with named user
--echo #
--replace_result $USER USER
eval create user $USER identified via unix_socket;
--write_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt
--replace_result $USER USER
select user(), current_user(), database();
EOF
--echo #
--echo # name match = ok
--echo #
--exec $MYSQL_TEST -u $USER --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
--echo #
--echo # name does not match = failure
--echo #
--error 1
--exec $MYSQL_TEST -u foobar --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
--replace_result $USER USER
eval drop user $USER;
--echo #
--echo # and now with anonymous user
--echo #
grant SELECT ON test.* TO '' identified via unix_socket;
--echo #
--echo # name match = ok
--echo #
--exec $MYSQL_TEST -u $USER --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
--echo #
--echo # name does not match = failure
--echo #
--error 1
--exec $MYSQL_TEST -u foobar --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
# restoring mysql.user to the original state.
delete from mysql.user where user='';
uninstall plugin unix_socket;
--remove_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt

View File

@@ -1,12 +1,12 @@
include/master-slave.inc
[connection master]
include/stop_slave.inc
call mtr.add_suppression("Error in Log_event::read_log_event()");
include/rpl_stop_server.inc [server_number=1]
include/rpl_start_server.inc [server_number=1]
show binlog events;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log");
stop slave;
reset slave;
start slave;
include/wait_for_slave_param.inc [Last_IO_Errno]
@@ -15,5 +15,5 @@ Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary
reset master;
stop slave;
reset slave;
drop table t;
drop table if exists t;
End of the tests

View File

@@ -25,14 +25,14 @@ SET GLOBAL debug_dbug="-d,corrupt_read_log_event2";
SET GLOBAL master_verify_checksum=0;
SET GLOBAL debug_dbug="+d,corrupt_read_log_event2";
START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1595,1722,1923]
include/wait_for_slave_io_error.inc [errno=1595,1913]
SET GLOBAL debug_dbug="-d,corrupt_read_log_event2";
SET GLOBAL debug_dbug= "";
SET GLOBAL master_verify_checksum=1;
# 5. Slave. Corruption in network
SET GLOBAL debug_dbug="+d,corrupt_queue_event";
START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1595,1722,1923]
include/wait_for_slave_io_error.inc [errno=1595,1913]
SET GLOBAL debug_dbug="-d,corrupt_queue_event";
# 6. Slave. Corruption in relay log
SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char";

View File

@@ -5,6 +5,7 @@ Log_name File_size
master-bin.000001 #
create table t1 (f text) engine=innodb;
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
SET DEBUG_SYNC = 'after_purge_logs_before_date SIGNAL continued';
insert into t1 set f=repeat('a', 4096);
*** there must be two logs in the list ***
show binary logs;
@@ -19,11 +20,14 @@ master-bin.000001 #
master-bin.000002 #
master-bin.000003 #
SET DEBUG_SYNC = 'now SIGNAL rotated';
SET DEBUG_SYNC = 'now WAIT_FOR continued';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
SET DEBUG_SYNC = 'after_purge_logs_before_date SIGNAL continued';
insert into t1 set f=repeat('b', 4096);
SET DEBUG_SYNC = 'now SIGNAL rotated';
SET DEBUG_SYNC = 'now WAIT_FOR continued';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC = 'RESET';
drop table t1;

View File

@@ -20,9 +20,15 @@
#
--source include/not_windows.inc
call mtr.add_suppression("Error in Log_event::read_log_event()");
--connection slave
# Make sure the slave is stopped while we are messing with master.
# Otherwise we get occasional failures as the slave manages to re-connect
# to the newly started master and we get extra events applied, causing
# conflicts.
--source include/stop_slave.inc
--connection master
call mtr.add_suppression("Error in Log_event::read_log_event()");
--let $datadir= `SELECT @@datadir`
--let $rpl_server_number= 1
@@ -42,7 +48,6 @@ show binlog events;
--connection slave
call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log");
stop slave;
reset slave;
start slave;
@@ -64,6 +69,12 @@ reset master;
--connection slave
stop slave;
reset slave;
drop table t; # table was created from binlog. it does not exist on master.
# The table t may have been created on the slave from binlog. It does not exist
# on the master.
# "May", as it depends on whether the SQL thread had time do do the CREATE
# TABLE before we stopped.
--disable_warnings
drop table if exists t;
--enable_warnings
--echo End of the tests

View File

@@ -115,7 +115,11 @@ SET GLOBAL master_verify_checksum=0;
SET GLOBAL debug_dbug="+d,corrupt_read_log_event2";
--connection slave
START SLAVE IO_THREAD;
let $slave_io_errno= 1595,1722,1923;
# When the checksum error is detected, the slave sets error code 1913
# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately
# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io().
# So we usually get 1595, but it is occasionally possible to get 1913.
let $slave_io_errno= 1595,1913;
--source include/wait_for_slave_io_error.inc
--connection master
SET GLOBAL debug_dbug="-d,corrupt_read_log_event2";
@@ -127,7 +131,7 @@ SET GLOBAL master_verify_checksum=1;
--connection slave
SET GLOBAL debug_dbug="+d,corrupt_queue_event";
START SLAVE IO_THREAD;
let $slave_io_errno= 1595,1722,1923;
let $slave_io_errno= 1595,1913;
--source include/wait_for_slave_io_error.inc
SET GLOBAL debug_dbug="-d,corrupt_queue_event";

View File

@@ -20,6 +20,7 @@ connection master;
source include/show_binary_logs.inc;
create table t1 (f text) engine=innodb;
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
SET DEBUG_SYNC = 'after_purge_logs_before_date SIGNAL continued';
send insert into t1 set f=repeat('a', 4096);
connection master1;
@@ -38,6 +39,7 @@ insert into t1 set f=repeat('b', 4096);
source include/show_binary_logs.inc;
SET DEBUG_SYNC = 'now SIGNAL rotated';
SET DEBUG_SYNC = 'now WAIT_FOR continued';
SET DEBUG_SYNC = 'RESET';
# the first connection finally completes its INSERT
@@ -54,6 +56,7 @@ sync_slave_with_master;
connection master;
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
SET DEBUG_SYNC = 'after_purge_logs_before_date SIGNAL continued';
send insert into t1 set f=repeat('b', 4096);
connection master1;
@@ -80,6 +83,7 @@ let $wait_condition=
--source include/wait_condition.inc
SET DEBUG_SYNC = 'now SIGNAL rotated';
SET DEBUG_SYNC = 'now WAIT_FOR continued';
SET DEBUG_SYNC = 'RESET';
connection master;

View File

@@ -0,0 +1,15 @@
SELECT @@global.innodb_flush_checkpoint_debug;
@@global.innodb_flush_checkpoint_debug
0
SET @@global.innodb_flush_checkpoint_debug=1;
SELECT @@global.innodb_flush_checkpoint_debug;
@@global.innodb_flush_checkpoint_debug
1
SET @@global.innodb_flush_checkpoint_debug=0;
SELECT @@global.innodb_flush_checkpoint_debug;
@@global.innodb_flush_checkpoint_debug
0
SET @@session.innodb_flush_checkpoint_debug=1;
ERROR HY000: Variable 'innodb_flush_checkpoint_debug' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@session.innodb_flush_checkpoint_debug;
ERROR HY000: Variable 'innodb_flush_checkpoint_debug' is a GLOBAL variable

View File

@@ -0,0 +1,12 @@
--source include/have_debug.inc
--source include/have_xtradb.inc
SELECT @@global.innodb_flush_checkpoint_debug;
SET @@global.innodb_flush_checkpoint_debug=1;
SELECT @@global.innodb_flush_checkpoint_debug;
SET @@global.innodb_flush_checkpoint_debug=0;
SELECT @@global.innodb_flush_checkpoint_debug;
--error ER_GLOBAL_VARIABLE
SET @@session.innodb_flush_checkpoint_debug=1;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.innodb_flush_checkpoint_debug;

View File

@@ -265,3 +265,33 @@ NULL
explain select sum(c) from t1 group by b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
#
# Bug #806057: join with USING over a virtual column
#
CREATE TABLE t1 (b int);
INSERT INTO t1 VALUES (NULL),( 78), (185), (0), (154);
CREATE TABLE t2 (a int, b int AS (a) VIRTUAL);
INSERT INTO t2 VALUES (187,187), (9,9), (187,187);
Warnings:
Warning 1906 The value specified for computed column 'b' in table 't2' ignored
Warning 1906 The value specified for computed column 'b' in table 't2' ignored
Warning 1906 The value specified for computed column 'b' in table 't2' ignored
EXPLAIN EXTENDED
SELECT * FROM t1 JOIN t2 USING (b);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`b` = `test`.`t2`.`b`)
SELECT * FROM t1 JOIN t2 USING (b);
b a
EXPLAIN EXTENDED
SELECT * FROM t1 NATURAL JOIN t2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`b` = `test`.`t2`.`b`)
SELECT * FROM t1 NATURAL JOIN t2;
b a
DROP TABLE t1,t2;

View File

@@ -107,7 +107,7 @@ MariaDB-5.3: the following EXPLAIN produces incorrect #rows for table t1.
MariaDB-5.3: this is expected to go away when FROM subquery optimizations are pushed
explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using filesort
drop view v1;
create view v1 as select c+1 from t1 order by 1 desc limit 2;
@@ -119,7 +119,7 @@ MariaDB-5.3: the following EXPLAIN produces incorrect #rows for table t1.
MariaDB-5.3: this is expected to go away when FROM subquery optimizations are pushed
explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using filesort
drop view v1;
drop table t1;

View File

@@ -107,7 +107,7 @@ MariaDB-5.3: the following EXPLAIN produces incorrect #rows for table t1.
MariaDB-5.3: this is expected to go away when FROM subquery optimizations are pushed
explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using filesort
drop view v1;
create view v1 as select c+1 from t1 order by 1 desc limit 2;
@@ -119,7 +119,7 @@ MariaDB-5.3: the following EXPLAIN produces incorrect #rows for table t1.
MariaDB-5.3: this is expected to go away when FROM subquery optimizations are pushed
explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using filesort
drop view v1;
drop table t1;

View File

@@ -48,3 +48,23 @@ eval SET @@session.storage_engine = 'MyISAM';
#------------------------------------------------------------------------------#
# Cleanup
--source suite/vcol/inc/vcol_cleanup.inc
--echo #
--echo # Bug #806057: join with USING over a virtual column
--echo #
CREATE TABLE t1 (b int);
INSERT INTO t1 VALUES (NULL),( 78), (185), (0), (154);
CREATE TABLE t2 (a int, b int AS (a) VIRTUAL);
INSERT INTO t2 VALUES (187,187), (9,9), (187,187);
EXPLAIN EXTENDED
SELECT * FROM t1 JOIN t2 USING (b);
SELECT * FROM t1 JOIN t2 USING (b);
EXPLAIN EXTENDED
SELECT * FROM t1 NATURAL JOIN t2;
SELECT * FROM t1 NATURAL JOIN t2;
DROP TABLE t1,t2;