1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge with 5.1-merge (new XTRADB code updated up to MySQL 5.1.47)

Fixed tests cases.
This commit is contained in:
Michael Widenius
2010-08-05 14:40:54 +03:00
207 changed files with 9702 additions and 3859 deletions

View File

@ -108,7 +108,8 @@ static struct my_option my_long_options[]=
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Prints version", 0, 0, 0, GET_NO_ARG, {"version", 'V', "Prints version", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
{"charset", 'C', "Charset dir", &charsets_dir, &charsets_dir, {"charset", 'C', "Charset dir",
(char**) &charsets_dir, (char**) &charsets_dir,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"in_file", 'F', "Input file", &TXTFILE, &TXTFILE, {"in_file", 'F', "Input file", &TXTFILE, &TXTFILE,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

View File

@ -49,7 +49,7 @@ static struct my_option my_long_options[] =
{"config-file", 'c', "Deprecated, please use --defaults-file instead. " {"config-file", 'c', "Deprecated, please use --defaults-file instead. "
"Name of config file to read; if no extension is given, default " "Name of config file to read; if no extension is given, default "
"extension (e.g., .ini or .cnf) will be added", "extension (e.g., .ini or .cnf) will be added",
&config_file, &config_file, 0, GET_STR, REQUIRED_ARG, (char**) &config_file, (char**) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF #ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit", {"debug", '#', "This is a non-debug version. Catch this and exit",
@ -61,7 +61,7 @@ static struct my_option my_long_options[] =
{"defaults-file", 'c', "Like --config-file, except: if first option, " {"defaults-file", 'c', "Like --config-file, except: if first option, "
"then read this file only, do not read global or per-user config " "then read this file only, do not read global or per-user config "
"files; should be the first option", "files; should be the first option",
&config_file, &config_file, 0, GET_STR, REQUIRED_ARG, (char**) &config_file, (char*) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"defaults-extra-file", 'e', {"defaults-extra-file", 'e',
"Read this file after the global config file and before the config " "Read this file after the global config file and before the config "
@ -70,7 +70,7 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"defaults-group-suffix", 'g', {"defaults-group-suffix", 'g',
"In addition to the given groups, read also groups with this suffix", "In addition to the given groups, read also groups with this suffix",
&my_defaults_group_suffix, &my_defaults_group_suffix, (char**) &my_defaults_group_suffix, (char**) &my_defaults_group_suffix,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extra-file", 'e', {"extra-file", 'e',
"Deprecated. Synonym for --defaults-extra-file.", "Deprecated. Synonym for --defaults-extra-file.",

View File

@ -53,6 +53,8 @@ extern my_bool bitmap_is_overlapping(const MY_BITMAP *map1,
extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit);
extern my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit);
extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit);
extern my_bool bitmap_union_is_set_all(const MY_BITMAP *map1,
const MY_BITMAP *map2);
extern uint bitmap_set_next(MY_BITMAP *map); extern uint bitmap_set_next(MY_BITMAP *map);
extern uint bitmap_get_first(const MY_BITMAP *map); extern uint bitmap_get_first(const MY_BITMAP *map);
extern uint bitmap_get_first_set(const MY_BITMAP *map); extern uint bitmap_get_first_set(const MY_BITMAP *map);

View File

@ -104,6 +104,7 @@ TEST_DIRS = t r include std_data std_data/parts collections \
suite/pbxt/t suite/pbxt/r \ suite/pbxt/t suite/pbxt/r \
suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include \ suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include \
suite/innodb_plugin suite/innodb_plugin/t suite/innodb_plugin/r suite/innodb_plugin/include \ suite/innodb_plugin suite/innodb_plugin/t suite/innodb_plugin/r suite/innodb_plugin/include \
suite/percona \
suite/engines suite/engines/funcs suite/engines/iuds suite/engines/rr_trx \ suite/engines suite/engines/funcs suite/engines/iuds suite/engines/rr_trx \
suite/engines/funcs/r suite/engines/funcs/t suite/engines/iuds/r \ suite/engines/funcs/r suite/engines/funcs/t suite/engines/iuds/r \
suite/engines/iuds/t suite/engines/rr_trx/include suite/engines/rr_trx/r \ suite/engines/iuds/t suite/engines/rr_trx/include suite/engines/rr_trx/r \

View File

@ -0,0 +1,95 @@
--source include/percona_query_cache_with_comments_clear.inc
let $query=/* with comment first */select * from t1;
eval $query;
--source include/percona_query_cache_with_comments_eval.inc
let $query=# with comment first
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=-- with comment first
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=/* with comment first and "quote" */select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=# with comment first and "quote"
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=-- with comment first and "quote"
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=
/* with comment and whitespaces first */select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=
# with comment and whitespaces first
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=
-- with comment and whitespaces first
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $internal=* internal comment *;
let $query=select * /$internal/ from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select */$internal/ from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select */$internal/from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $internal=* internal comment with "quote" *;
let $query=select * /$internal/ from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select */$internal/ from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select */$internal/from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1
;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 ;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 ;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1
/* comment in the end */;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1
/* *\/ */;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1
/* comment in the end */
;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 #comment in the end;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 #comment in the end
;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 -- comment in the end;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 -- comment in the end
;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select ' \' ' from t1;
--source include/percona_query_cache_with_comments_eval.inc

View File

@ -0,0 +1,12 @@
-- source include/have_query_cache.inc
set GLOBAL query_cache_size=1355776;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
--source include/percona_query_cache_with_comments_clear.inc

View File

@ -0,0 +1,5 @@
# Reset query cache variables.
flush query cache; # This crashed in some versions
flush query cache; # This crashed in some versions
reset query cache;
flush status;

View File

@ -0,0 +1,3 @@
DROP TABLE t1;
SET GLOBAL query_cache_size=default;
set global query_cache_strip_comments=OFF;

View File

@ -0,0 +1,7 @@
echo -----------------------------------------------------;
echo $query;
echo -----------------------------------------------------;
--source include/percona_query_cache_with_comments_show.inc
eval $query;
eval $query;
--source include/percona_query_cache_with_comments_show.inc

View File

@ -0,0 +1,8 @@
let $show=show status like "Qcache_queries_in_cache";
eval $show;
let $show=show status like "Qcache_inserts";
eval $show;
let $show=show status like "Qcache_hits";
eval $show;

View File

@ -130,7 +130,7 @@ my $path_config_file; # The generated config file, var/my.cnf
# executables will be used by the test suite. # executables will be used by the test suite.
our $opt_vs_config = $ENV{'MTR_VS_CONFIG'}; our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
my $DEFAULT_SUITES= "main,binlog,federated,rpl,maria,parts,innodb,innodb_plugin"; my $DEFAULT_SUITES= "main,binlog,federated,rpl,maria,parts,innodb,innodb_plugin,percona";
my $opt_suites; my $opt_suites;
our $opt_verbose= 0; # Verbose output, enable with --verbose our $opt_verbose= 0; # Verbose output, enable with --verbose

View File

@ -98,7 +98,7 @@ XTRADB_ENHANCEMENTS name
INNODB_BUFFER_POOL_PAGES_INDEX schema_name INNODB_BUFFER_POOL_PAGES_INDEX schema_name
XTRADB_ADMIN_COMMAND result_message XTRADB_ADMIN_COMMAND result_message
INNODB_TRX trx_id INNODB_TRX trx_id
INNODB_SYS_TABLES NAME INNODB_SYS_TABLES SCHEMA
INNODB_LOCK_WAITS requesting_trx_id INNODB_LOCK_WAITS requesting_trx_id
INNODB_CMPMEM_RESET page_size INNODB_CMPMEM_RESET page_size
INNODB_LOCKS lock_id INNODB_LOCKS lock_id
@ -159,7 +159,7 @@ XTRADB_ENHANCEMENTS name
INNODB_BUFFER_POOL_PAGES_INDEX schema_name INNODB_BUFFER_POOL_PAGES_INDEX schema_name
XTRADB_ADMIN_COMMAND result_message XTRADB_ADMIN_COMMAND result_message
INNODB_TRX trx_id INNODB_TRX trx_id
INNODB_SYS_TABLES NAME INNODB_SYS_TABLES SCHEMA
INNODB_LOCK_WAITS requesting_trx_id INNODB_LOCK_WAITS requesting_trx_id
INNODB_CMPMEM_RESET page_size INNODB_CMPMEM_RESET page_size
INNODB_LOCKS lock_id INNODB_LOCKS lock_id

File diff suppressed because it is too large Load Diff

View File

@ -691,14 +691,16 @@ count(*)
select count(*) from t1 where sca_pic is null; select count(*) from t1 where sca_pic is null;
count(*) count(*)
2 2
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); alter table t1 drop index sca_pic;
alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*) count(*)
1 1
select count(*) from t1 where cat_code='E'; select count(*) from t1 where cat_code='E';
count(*) count(*)
0 0
alter table t1 drop index sca_pic, add index (sca_pic, cat_code); alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*) count(*)
1 1
@ -1508,7 +1510,7 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop index id2 on t2; drop index id2 on t2;
drop index id on t2; drop index id on t2;
Got one of the listed errors ERROR HY000: Cannot drop index 'id': needed in a foreign key constraint
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (

View File

@ -1,31 +0,0 @@
SET @old_innodb_file_format=@@innodb_file_format;
SET @old_innodb_file_per_table=@@innodb_file_per_table;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=ON;
DROP TABLE IF EXISTS `test1`;
CREATE TABLE IF NOT EXISTS `test1` (
`a` int primary key auto_increment,
`b` int default 0,
`c` char(100) default 'testtest'
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
set autocommit=0;
CREATE PROCEDURE insert_many(p1 int)
BEGIN
SET @x = 0;
SET @y = 0;
REPEAT
insert into test1 set b=1;
SET @x = @x + 1;
SET @y = @y + 1;
IF @y >= 1000 THEN
commit;
SET @y = 0;
END IF;
UNTIL @x >= p1 END REPEAT;
END|
DROP PROCEDURE insert_many;
ALTER TABLE test1 ENGINE=MyISAM;
DROP TABLE test1;
SET GLOBAL innodb_file_format=@old_innodb_file_format;
SET GLOBAL innodb_file_per_table=@old_innodb_file_per_table;
set global innodb_file_format_check=Antelope;

View File

@ -202,7 +202,7 @@ eval kill query $ID;
rollback; rollback;
connection con2; connection con2;
--error 0,ER_QUERY_INTERRUPTED --error 0,ER_QUERY_INTERRUPTED,ER_LOCK_WAIT_TIMEOUT
reap; reap;
# todo 1,2 above # todo 1,2 above
rollback; rollback;

View File

@ -198,14 +198,15 @@ NULL information_schema INNODB_SYS_INDEXES PAGE_NO 7 0 NO bigint NULL NULL 19 0
NULL information_schema INNODB_SYS_INDEXES SPACE 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_SYS_INDEXES SPACE 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_SYS_INDEXES TABLE_ID 1 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_SYS_INDEXES TABLE_ID 1 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_SYS_INDEXES TYPE 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_SYS_INDEXES TYPE 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_SYS_TABLES CLUSTER_NAME 7 NO varchar 192 576 NULL NULL utf8 utf8_general_ci varchar(192) select NULL information_schema INNODB_SYS_TABLES CLUSTER_NAME 8 NO varchar 192 576 NULL NULL utf8 utf8_general_ci varchar(192) select
NULL information_schema INNODB_SYS_TABLES ID 2 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_SYS_TABLES ID 3 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_SYS_TABLES MIX_ID 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_SYS_TABLES MIX_ID 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_SYS_TABLES MIX_LEN 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_SYS_TABLES MIX_LEN 7 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_SYS_TABLES NAME 1 NO varchar 192 576 NULL NULL utf8 utf8_general_ci varchar(192) select NULL information_schema INNODB_SYS_TABLES NAME 2 NO varchar 192 576 NULL NULL utf8 utf8_general_ci varchar(192) select
NULL information_schema INNODB_SYS_TABLES N_COLS 3 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_SYS_TABLES N_COLS 4 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_SYS_TABLES SPACE 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_SYS_TABLES SCHEMA 1 NO varchar 192 576 NULL NULL utf8 utf8_general_ci varchar(192) select
NULL information_schema INNODB_SYS_TABLES TYPE 4 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_SYS_TABLES SPACE 9 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_SYS_TABLES TYPE 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_TABLE_STATS clust_size 4 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_TABLE_STATS clust_size 4 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_TABLE_STATS modified 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_TABLE_STATS modified 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_TABLE_STATS other_size 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select NULL information_schema INNODB_TABLE_STATS other_size 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
@ -670,6 +671,7 @@ NULL information_schema INNODB_SYS_INDEXES N_FIELDS bigint NULL NULL NULL NULL b
NULL information_schema INNODB_SYS_INDEXES TYPE bigint NULL NULL NULL NULL bigint(21) unsigned NULL information_schema INNODB_SYS_INDEXES TYPE bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema INNODB_SYS_INDEXES SPACE bigint NULL NULL NULL NULL bigint(21) unsigned NULL information_schema INNODB_SYS_INDEXES SPACE bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema INNODB_SYS_INDEXES PAGE_NO bigint NULL NULL NULL NULL bigint(21) unsigned NULL information_schema INNODB_SYS_INDEXES PAGE_NO bigint NULL NULL NULL NULL bigint(21) unsigned
3.0000 information_schema INNODB_SYS_TABLES SCHEMA varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INNODB_SYS_TABLES NAME varchar 192 576 utf8 utf8_general_ci varchar(192) 3.0000 information_schema INNODB_SYS_TABLES NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
NULL information_schema INNODB_SYS_TABLES ID bigint NULL NULL NULL NULL bigint(21) unsigned NULL information_schema INNODB_SYS_TABLES ID bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema INNODB_SYS_TABLES N_COLS bigint NULL NULL NULL NULL bigint(21) unsigned NULL information_schema INNODB_SYS_TABLES N_COLS bigint NULL NULL NULL NULL bigint(21) unsigned

View File

@ -18,6 +18,7 @@
--source include/not_embedded.inc --source include/not_embedded.inc
# This test depends on having the PBXT information_schema stuff. # This test depends on having the PBXT information_schema stuff.
--source include/have_pbxt.inc --source include/have_pbxt.inc
--source include/have_xtradb.inc
let $my_where = WHERE table_schema = 'information_schema' let $my_where = WHERE table_schema = 'information_schema'
AND table_name <> 'profiling'; AND table_name <> 'profiling';

View File

@ -13,18 +13,18 @@ d1
1 1
2 2
INSERT INTO t1 VALUES(null); INSERT INTO t1 VALUES(null);
Got one of the listed errors
ALTER TABLE t1 AUTO_INCREMENT = 3; ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`d1` int(11) NOT NULL AUTO_INCREMENT, `d1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`d1`) PRIMARY KEY (`d1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null); INSERT INTO t1 VALUES(null);
SELECT * FROM t1; SELECT * FROM t1;
d1 d1
1 1
2 2
3 3
4
DROP TABLE t1; DROP TABLE t1;

View File

@ -691,14 +691,16 @@ count(*)
select count(*) from t1 where sca_pic is null; select count(*) from t1 where sca_pic is null;
count(*) count(*)
2 2
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); alter table t1 drop index sca_pic;
alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*) count(*)
1 1
select count(*) from t1 where cat_code='E'; select count(*) from t1 where cat_code='E';
count(*) count(*)
0 0
alter table t1 drop index sca_pic, add index (sca_pic, cat_code); alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*) count(*)
1 1
@ -1357,7 +1359,7 @@ insert t2 select * from t1;
insert t3 select * from t1; insert t3 select * from t1;
checksum table t1, t2, t3, t4 quick; checksum table t1, t2, t3, t4 quick;
Table Checksum Table Checksum
test.t1 2948697075 test.t1 3442722830
test.t2 NULL test.t2 NULL
test.t3 NULL test.t3 NULL
test.t4 NULL test.t4 NULL
@ -1365,17 +1367,17 @@ Warnings:
Error 1146 Table 'test.t4' doesn't exist Error 1146 Table 'test.t4' doesn't exist
checksum table t1, t2, t3, t4; checksum table t1, t2, t3, t4;
Table Checksum Table Checksum
test.t1 2948697075 test.t1 3442722830
test.t2 2948697075 test.t2 3442722830
test.t3 2948697075 test.t3 3442722830
test.t4 NULL test.t4 NULL
Warnings: Warnings:
Error 1146 Table 'test.t4' doesn't exist Error 1146 Table 'test.t4' doesn't exist
checksum table t1, t2, t3, t4 extended; checksum table t1, t2, t3, t4 extended;
Table Checksum Table Checksum
test.t1 2948697075 test.t1 3442722830
test.t2 2948697075 test.t2 3442722830
test.t3 2948697075 test.t3 3442722830
test.t4 NULL test.t4 NULL
Warnings: Warnings:
Error 1146 Table 'test.t4' doesn't exist Error 1146 Table 'test.t4' doesn't exist
@ -1432,7 +1434,7 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop index id2 on t2; drop index id2 on t2;
drop index id on t2; drop index id on t2;
Got one of the listed errors ERROR HY000: Cannot drop index 'id': needed in a foreign key constraint
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
@ -1662,7 +1664,7 @@ count(*)
drop table t1; drop table t1;
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total'; SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
variable_value variable_value
512 8191
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
variable_value variable_value
16384 16384
@ -1690,9 +1692,10 @@ variable_value - @innodb_row_lock_time_max_orig
SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'; SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
variable_value - @innodb_row_lock_time_avg_orig variable_value - @innodb_row_lock_time_avg_orig
0 0
SET @innodb_sync_spin_loops_orig = @@innodb_sync_spin_loops;
show variables like "innodb_sync_spin_loops"; show variables like "innodb_sync_spin_loops";
Variable_name Value Variable_name Value
innodb_sync_spin_loops 20 innodb_sync_spin_loops 30
set global innodb_sync_spin_loops=1000; set global innodb_sync_spin_loops=1000;
show variables like "innodb_sync_spin_loops"; show variables like "innodb_sync_spin_loops";
Variable_name Value Variable_name Value
@ -1705,10 +1708,11 @@ set global innodb_sync_spin_loops=20;
show variables like "innodb_sync_spin_loops"; show variables like "innodb_sync_spin_loops";
Variable_name Value Variable_name Value
innodb_sync_spin_loops 20 innodb_sync_spin_loops 20
set global innodb_sync_spin_loops=@innodb_sync_spin_loops_orig;
SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency; SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;
show variables like "innodb_thread_concurrency"; show variables like "innodb_thread_concurrency";
Variable_name Value Variable_name Value
innodb_thread_concurrency 8 innodb_thread_concurrency 0
set global innodb_thread_concurrency=1001; set global innodb_thread_concurrency=1001;
Warnings: Warnings:
Warning 1292 Truncated incorrect thread_concurrency value: '1001' Warning 1292 Truncated incorrect thread_concurrency value: '1001'
@ -2301,6 +2305,8 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 (v varchar(10), c char(10)) row_format=fixed; create table t1 (v varchar(10), c char(10)) row_format=fixed;
Warnings:
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (

View File

@ -25,8 +25,8 @@ ALTER TABLE t1 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150) ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
# Ensure that online column rename works. # Ensure that online column rename works.
ALTER TABLE t1 CHANGE b c INT; ALTER TABLE t1 CHANGE b c INT;
affected rows: 0 affected rows: 3
info: Records: 0 Duplicates: 0 Warnings: 0 info: Records: 3 Duplicates: 0 Warnings: 0
# Test renaming the column in the referencing table # Test renaming the column in the referencing table
@ -34,8 +34,8 @@ ALTER TABLE t2 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150) ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
# Ensure that online column rename works. # Ensure that online column rename works.
ALTER TABLE t2 CHANGE b c INT; ALTER TABLE t2 CHANGE b c INT;
affected rows: 0 affected rows: 3
info: Records: 0 Duplicates: 0 Warnings: 0 info: Records: 3 Duplicates: 0 Warnings: 0
# Test with self-referential constraints # Test with self-referential constraints
@ -45,8 +45,8 @@ ALTER TABLE t3 CHANGE b d INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150) ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
# Ensure that online column rename works. # Ensure that online column rename works.
ALTER TABLE t3 CHANGE c d INT; ALTER TABLE t3 CHANGE c d INT;
affected rows: 0 affected rows: 3
info: Records: 0 Duplicates: 0 Warnings: 0 info: Records: 3 Duplicates: 0 Warnings: 0
# Cleanup. # Cleanup.

View File

@ -763,6 +763,7 @@ t1 CREATE TABLE `t1` (
CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`) CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1 ) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
SET SESSION innodb_strict_mode = on;
CREATE TABLE t1 ( CREATE TABLE t1 (
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255), c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255), c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),

View File

@ -10,9 +10,5 @@
# #
############################################################################## ##############################################################################
innodb : Bug#53306 2010-04-30 VasilDimov valgrind warnings #innodb : Bug#53306 2010-04-30 VasilDimov valgrind warnings
innodb_bug52663 : Waiting for merge with XtraDB innodb_bug48024 : Waiting for merge with Percona Server; bug fixed in innodb_plugin in MySQL 5.1.48
innodb_bug51920 : Waiting for merge with XtraDB
innodb_bug48024 : Waiting for merge with XtraDB
innodb_bug49164 : Waiting for merge with XtraDB
innodb_bug54044 : Waiting for merge with XtraDB

View File

@ -27,7 +27,7 @@ SELECT * FROM t1;
# longer results in the two data dictionaries being out of sync. If they # longer results in the two data dictionaries being out of sync. If they
# revert their changes then this check for ER_AUTOINC_READ_FAILED will need # revert their changes then this check for ER_AUTOINC_READ_FAILED will need
# to be enabled. Also, see http://bugs.mysql.com/bug.php?id=47621. # to be enabled. Also, see http://bugs.mysql.com/bug.php?id=47621.
-- error ER_AUTOINC_READ_FAILED,1467 # -- error ER_AUTOINC_READ_FAILED,1467
INSERT INTO t1 VALUES(null); INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3; ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;

View File

@ -427,11 +427,13 @@ INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca
select count(*) from t1 where sca_code = 'PD'; select count(*) from t1 where sca_code = 'PD';
select count(*) from t1 where sca_code <= 'PD'; select count(*) from t1 where sca_code <= 'PD';
select count(*) from t1 where sca_pic is null; select count(*) from t1 where sca_pic is null;
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); alter table t1 drop index sca_pic;
alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where cat_code='E'; select count(*) from t1 where cat_code='E';
alter table t1 drop index sca_pic, add index (sca_pic, cat_code); alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where sca_pic >= 'n'; select count(*) from t1 where sca_pic >= 'n';
select sca_pic from t1 where sca_pic is null; select sca_pic from t1 where sca_pic is null;
@ -1124,7 +1126,7 @@ show create table t2;
create index id2 on t2 (id); create index id2 on t2 (id);
show create table t2; show create table t2;
drop index id2 on t2; drop index id2 on t2;
--error 1025,1025 --error ER_DROP_INDEX_FK
drop index id on t2; drop index id on t2;
show create table t2; show create table t2;
drop table t2; drop table t2;
@ -1292,6 +1294,7 @@ drop table t1;
# Test for testable InnoDB status variables. This test # Test for testable InnoDB status variables. This test
# uses previous ones(pages_created, rows_deleted, ...). # uses previous ones(pages_created, rows_deleted, ...).
--replace_result 8192 8191
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total'; SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted'; SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
@ -1306,6 +1309,7 @@ SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.g
SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'; SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
# Test for innodb_sync_spin_loops variable # Test for innodb_sync_spin_loops variable
SET @innodb_sync_spin_loops_orig = @@innodb_sync_spin_loops;
show variables like "innodb_sync_spin_loops"; show variables like "innodb_sync_spin_loops";
set global innodb_sync_spin_loops=1000; set global innodb_sync_spin_loops=1000;
show variables like "innodb_sync_spin_loops"; show variables like "innodb_sync_spin_loops";
@ -1313,6 +1317,7 @@ set global innodb_sync_spin_loops=0;
show variables like "innodb_sync_spin_loops"; show variables like "innodb_sync_spin_loops";
set global innodb_sync_spin_loops=20; set global innodb_sync_spin_loops=20;
show variables like "innodb_sync_spin_loops"; show variables like "innodb_sync_spin_loops";
set global innodb_sync_spin_loops=@innodb_sync_spin_loops_orig;
# Test for innodb_thread_concurrency variable # Test for innodb_thread_concurrency variable
SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency; SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;

View File

@ -1021,6 +1021,8 @@ DROP TABLE t1,t2;
# #
# Bug #21101 (Prints wrong error message if max row size is too large) # Bug #21101 (Prints wrong error message if max row size is too large)
# #
#from innodb-1.0.8, any size is passed without innodb_strict_mode.
SET SESSION innodb_strict_mode = on;
--error 1118 --error 1118
CREATE TABLE t1 ( CREATE TABLE t1 (
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255), c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),

View File

@ -1,18 +0,0 @@
drop table if exists t1;
drop database if exists mysqltest;
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
alter table t1 add unique index (b), add unique index (c), add unique index (d);
ERROR 23000: Duplicate entry '4' for key 'b'
alter table t1 add unique index (c), add unique index (b), add index (d);
ERROR 23000: Duplicate entry 'ac' for key 'c'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`d` varchar(20) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;

View File

@ -1,18 +0,0 @@
drop table if exists t1;
drop database if exists mysqltest;
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
alter table t1 add unique index (b), add unique index (c), add unique index (d);
ERROR 23000: Duplicate entry 'ac' for key 'c'
alter table t1 add unique index (c), add unique index (b), add index (d);
ERROR 23000: Duplicate entry 'ac' for key 'c'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`d` varchar(20) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;

View File

@ -440,6 +440,8 @@ t3 CREATE TABLE `t3` (
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
KEY `c` (`c`) KEY `c` (`c`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t2 drop index b, add index (b);
ERROR 42000: Incorrect index name 'b'
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
@ -623,6 +625,22 @@ t1 CREATE TABLE `t1` (
KEY `b` (`b`) KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
alter table t1 add unique index (b), add unique index (c), add unique index (d);
ERROR 23000: Duplicate entry '4' for key 'b'
alter table t1 add unique index (c), add unique index (b), add index (d);
ERROR 23000: Duplicate entry 'ac' for key 'c'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`d` varchar(20) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb; create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb;
insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1); insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1);
alter table t1 add unique index (b); alter table t1 add unique index (b);

View File

@ -1,31 +0,0 @@
drop table if exists t1;
drop database if exists mysqltest;
CREATE TABLE t1 (
sca_code char(6) NOT NULL,
cat_code char(6) NOT NULL,
sca_desc varchar(50),
lan_code char(2) NOT NULL,
sca_pic varchar(100),
sca_sdesc varchar(50),
sca_sch_desc varchar(16),
PRIMARY KEY (sca_code, cat_code, lan_code),
INDEX sca_pic (sca_pic)
) engine = innodb ;
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
ERROR 42000: Incorrect index name 'sca_pic'
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
select count(*) from t1 where sca_pic >= 'n';
count(*)
1
select sca_pic from t1 where sca_pic is null;
sca_pic
NULL
NULL
update t1 set sca_pic="test" where sca_pic is null;
delete from t1 where sca_code='pd';
drop table t1;

View File

@ -1,30 +0,0 @@
drop table if exists t1;
drop database if exists mysqltest;
CREATE TABLE t1 (
sca_code char(6) NOT NULL,
cat_code char(6) NOT NULL,
sca_desc varchar(50),
lan_code char(2) NOT NULL,
sca_pic varchar(100),
sca_sdesc varchar(50),
sca_sch_desc varchar(16),
PRIMARY KEY (sca_code, cat_code, lan_code),
INDEX sca_pic (sca_pic)
) engine = innodb ;
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
select count(*) from t1 where sca_pic >= 'n';
count(*)
1
select sca_pic from t1 where sca_pic is null;
sca_pic
NULL
NULL
update t1 set sca_pic="test" where sca_pic is null;
delete from t1 where sca_code='pd';
drop table t1;

View File

@ -700,6 +700,22 @@ count(*)
select count(*) from t1 where cat_code='E'; select count(*) from t1 where cat_code='E';
count(*) count(*)
0 0
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
ERROR 42000: Incorrect index name 'sca_pic'
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
select count(*) from t1 where sca_pic >= 'n';
count(*)
1
select sca_pic from t1 where sca_pic is null;
sca_pic
NULL
NULL
update t1 set sca_pic="test" where sca_pic is null;
delete from t1 where sca_code='pd';
drop table t1; drop table t1;
set @a:=now(); set @a:=now();
CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb; CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
@ -1657,13 +1673,13 @@ variable_value
16384 16384
SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted'; SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
variable_value - @innodb_rows_deleted_orig variable_value - @innodb_rows_deleted_orig
70 71
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'; SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
variable_value - @innodb_rows_inserted_orig variable_value - @innodb_rows_inserted_orig
1063 1066
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'; SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
variable_value - @innodb_rows_updated_orig variable_value - @innodb_rows_updated_orig
863 865
SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits'; SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
variable_value - @innodb_row_lock_waits_orig variable_value - @innodb_row_lock_waits_orig
0 0

View File

@ -1,55 +0,0 @@
#
# Bug#21704: Renaming column does not update FK definition.
#
# Test that it's not possible to rename columns participating in a
# foreign key (either in the referencing or referenced table).
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB;
CREATE TABLE t2 (a INT PRIMARY KEY, b INT,
CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a))
ROW_FORMAT=COMPACT ENGINE=INNODB;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT,
CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a))
ROW_FORMAT=COMPACT ENGINE=INNODB;
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3);
# Test renaming the column in the referenced table.
ALTER TABLE t1 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t1 CHANGE b c INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
# Test renaming the column in the referencing table
ALTER TABLE t2 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t2 CHANGE b c INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
# Test with self-referential constraints
ALTER TABLE t3 CHANGE a d INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
ALTER TABLE t3 CHANGE b d INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t3 CHANGE c d INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
# Cleanup.
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;

View File

@ -36,7 +36,7 @@ a b c
commit; commit;
select * from bug49164; select * from bug49164;
a b c a b c
1 1 1 1 1 6
2 2 2 2 2 2
3 3 3 3 3 3
drop table bug49164; drop table bug49164;

View File

@ -10,13 +10,10 @@
# #
############################################################################## ##############################################################################
innodb_bug48024 : Waiting for merge/fix from XtraDB
innodb_bug53590 : Waiting for merge/fix from XtraDB
innodb_bug53591 : Waiting for merge/fix from XtraDB
innodb_bug53592 : Waiting for merge/fix from XtraDB
innodb-use-sys-malloc : Waiting for bugfix from Percona for LP#612600 innodb-use-sys-malloc : Waiting for bugfix from Percona for LP#612600
innodb_plugin.innodb-autoinc-44030 : Waiting for merge with XtraDB innodb_bug53290 : Waiting for merge/fix from XtraDB
innodb_bug48024 : Waiting for merge with XtraDB innodb_bug54679 : Waiting for merge/fix from XtraDB
innodb_bug49164 : Waiting for merge with XtraDB
innodb_bug51378 : Waiting for merge with XtraDB
innodb_bug51920 : Waiting for merge with XtraDB
innodb_bug52663 : Waiting for merge with XtraDB
innodb_bug54044 : Waiting for merge with XtraDB
innodb_bug52745 : Waiting for merge with XtraDB
innodb_bug54679 : Waiting for merge with XtraDB

View File

@ -1,18 +0,0 @@
#
# Tests from innodb.test that has different results for innodb_plugin & xtradb.
-- source include/have_real_innodb_plugin.inc
--disable_warnings
drop table if exists t1;
drop database if exists mysqltest;
--enable_warnings
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
--error ER_DUP_ENTRY
alter table t1 add unique index (b), add unique index (c), add unique index (d);
--error ER_DUP_ENTRY
alter table t1 add unique index (c), add unique index (b), add index (d);
show create table t1;
drop table t1;

View File

@ -1,18 +0,0 @@
#
# Tests from innodb.test that has different results for innodb_plugin & xtradb.
-- source include/have_xtradb.inc
--disable_warnings
drop table if exists t1;
drop database if exists mysqltest;
--enable_warnings
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
--error ER_DUP_ENTRY
alter table t1 add unique index (b), add unique index (c), add unique index (d);
--error ER_DUP_ENTRY
alter table t1 add unique index (c), add unique index (b), add index (d);
show create table t1;
drop table t1;

View File

@ -141,6 +141,9 @@ show create table t4;
--error ER_CANT_CREATE_TABLE --error ER_CANT_CREATE_TABLE
alter table t3 add constraint dc foreign key (a) references t1(a); alter table t3 add constraint dc foreign key (a) references t1(a);
show create table t3; show create table t3;
# this should be fixed by MySQL (see Bug #51451)
--error ER_WRONG_NAME_FOR_INDEX
alter table t2 drop index b, add index (b);
show create table t2; show create table t2;
--error ER_ROW_IS_REFERENCED_2 --error ER_ROW_IS_REFERENCED_2
delete from t1; delete from t1;
@ -183,6 +186,15 @@ alter table t1 add index (b);
show create table t1; show create table t1;
drop table t1; drop table t1;
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
--error ER_DUP_ENTRY
alter table t1 add unique index (b), add unique index (c), add unique index (d);
--error ER_DUP_ENTRY
alter table t1 add unique index (c), add unique index (b), add index (d);
show create table t1;
drop table t1;
create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb; create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb;
insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1); insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1);
alter table t1 add unique index (b); alter table t1 add unique index (b);

View File

@ -1,35 +0,0 @@
#
# Tests from innodb.test that has different results for innodb_plugin.
-- source include/have_real_innodb_plugin.inc
--disable_warnings
drop table if exists t1;
drop database if exists mysqltest;
--enable_warnings
CREATE TABLE t1 (
sca_code char(6) NOT NULL,
cat_code char(6) NOT NULL,
sca_desc varchar(50),
lan_code char(2) NOT NULL,
sca_pic varchar(100),
sca_sdesc varchar(50),
sca_sch_desc varchar(16),
PRIMARY KEY (sca_code, cat_code, lan_code),
INDEX sca_pic (sca_pic)
) engine = innodb ;
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
# this should be fixed by MySQL (see Bug #51451)
--error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where sca_pic >= 'n';
select sca_pic from t1 where sca_pic is null;
update t1 set sca_pic="test" where sca_pic is null;
delete from t1 where sca_code='pd';
drop table t1;

View File

@ -1,35 +0,0 @@
#
# Tests from innodb.test that has different results for innodb_plugin.
-- source include/have_xtradb.inc
--disable_warnings
drop table if exists t1;
drop database if exists mysqltest;
--enable_warnings
CREATE TABLE t1 (
sca_code char(6) NOT NULL,
cat_code char(6) NOT NULL,
sca_desc varchar(50),
lan_code char(2) NOT NULL,
sca_pic varchar(100),
sca_sdesc varchar(50),
sca_sch_desc varchar(16),
PRIMARY KEY (sca_code, cat_code, lan_code),
INDEX sca_pic (sca_pic)
) engine = innodb ;
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
# this should be fixed by MySQL (see Bug #51451)
#--error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where sca_pic >= 'n';
select sca_pic from t1 where sca_pic is null;
update t1 set sca_pic="test" where sca_pic is null;
delete from t1 where sca_code='pd';
drop table t1;

View File

@ -439,6 +439,16 @@ alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where cat_code='E'; select count(*) from t1 where cat_code='E';
# this should be fixed by MySQL (see Bug #51451)
--error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where sca_pic >= 'n';
select sca_pic from t1 where sca_pic is null;
update t1 set sca_pic="test" where sca_pic is null;
delete from t1 where sca_code='pd';
drop table t1; drop table t1;
# #

View File

@ -1,96 +0,0 @@
-- source include/have_xtradb.inc
--echo #
--echo # Bug#21704: Renaming column does not update FK definition.
--echo #
--echo
--echo # Test that it's not possible to rename columns participating in a
--echo # foreign key (either in the referencing or referenced table).
--echo
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
--enable_warnings
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB;
CREATE TABLE t2 (a INT PRIMARY KEY, b INT,
CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a))
ROW_FORMAT=COMPACT ENGINE=INNODB;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT,
CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a))
ROW_FORMAT=COMPACT ENGINE=INNODB;
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3);
--echo
--echo # Test renaming the column in the referenced table.
--echo
# mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error ER_ERROR_ON_RENAME
ALTER TABLE t1 CHANGE a c INT;
--echo # Ensure that online column rename works.
--enable_info
ALTER TABLE t1 CHANGE b c INT;
--disable_info
--echo
--echo # Test renaming the column in the referencing table
--echo
# mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error ER_ERROR_ON_RENAME
ALTER TABLE t2 CHANGE a c INT;
--echo # Ensure that online column rename works.
--enable_info
ALTER TABLE t2 CHANGE b c INT;
--disable_info
--echo
--echo # Test with self-referential constraints
--echo
# mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error ER_ERROR_ON_RENAME
ALTER TABLE t3 CHANGE a d INT;
# mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error ER_ERROR_ON_RENAME
ALTER TABLE t3 CHANGE b d INT;
--echo # Ensure that online column rename works.
--enable_info
ALTER TABLE t3 CHANGE c d INT;
--disable_info
--echo
--echo # Cleanup.
--echo
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;

View File

@ -1,4 +1,4 @@
-- source include/have_real_innodb_plugin.inc -- source include/have_innodb_plugin.inc
--echo # --echo #
--echo # Bug#21704: Renaming column does not update FK definition. --echo # Bug#21704: Renaming column does not update FK definition.

View File

@ -1,7 +1,7 @@
# #
# XtraDB doesn't have this problem # XtraDB doesn't have this problem
# #
-- source include/have_real_innodb_plugin.inc -- source include/have_innodb_plugin.inc
let $file_format=`select @@innodb_file_format`; let $file_format=`select @@innodb_file_format`;
let $file_format_check=`select @@innodb_file_format_check`; let $file_format_check=`select @@innodb_file_format_check`;

View File

@ -0,0 +1,13 @@
percona_suppress_log_warning_1592: Feature not merged into MariaDB
percona_log_slow_slave_statements: Feature not merged into MariaDB
percona_log_slow_slave_statements-and-use_global_long_query_time: Feature not merged into MariaDB
percona_slow_query_log-control_global_slow: Feature not merged into MariaDB
percona_slow_query_log-microseconds_in_slow_query_log: Feature not merged into MariaDB
percona_query_cache_with_comments: Feature not merged into MariaDB
percona_query_cache_with_comments_prepared_statements: Feature not merged into MariaDB
percona_show_temp_tables: Feature not merged into MariaDB
percona_slow_query_log-use_global_long_query_time: Feature not merged into MariaDB
percona_query_cache_with_comments_disable: Feature not merged into MariaDB
percona_slow_query_log-log_slow_verbosity: InnoDB filtering information not fully merged into MariaDB

View File

@ -0,0 +1,28 @@
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
# Establish connection con3 (user=root)
# Drop test table
drop table if exists t;
# Create test table
create table t(a INT PRIMARY KEY, b INT) engine=InnoDB;
# Insert two rows to test table
insert into t values(2,1);
insert into t values(1,2);
# Switch to connection con1
BEGIN;
SELECT b FROM t WHERE a=1 FOR UPDATE;
b
2
# Switch to connection con2
BEGIN;
SELECT b FROM t WHERE a=2 FOR UPDATE;
b
1
# Switch to connection con1
SELECT b FROM t WHERE a=2 FOR UPDATE;
# Switch to connection con2
SELECT b FROM t WHERE a=1 FOR UPDATE;
# Switch to connection con3
1
# Drop test table
drop table t;

View File

@ -0,0 +1,49 @@
--source include/have_innodb.inc
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
--echo # Establish connection con3 (user=root)
connect (con3,localhost,root,,);
--echo # Drop test table
--disable_warnings
drop table if exists t;
--enable_warnings
disable_abort_on_error;
--echo # Create test table
create table t(a INT PRIMARY KEY, b INT) engine=InnoDB;
--echo # Insert two rows to test table
insert into t values(2,1);
insert into t values(1,2);
#--echo # Save current deadlock count
let $current = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_deadlocks'`;
--echo # Switch to connection con1
connection con1;
BEGIN; SELECT b FROM t WHERE a=1 FOR UPDATE;
#show engine innodb status;
--echo # Switch to connection con2
connection con2;
BEGIN; SELECT b FROM t WHERE a=2 FOR UPDATE;
--echo # Switch to connection con1
connection con1;
SEND SELECT b FROM t WHERE a=2 FOR UPDATE;
--echo # Switch to connection con2
connection con2;
SEND SELECT b FROM t WHERE a=1 FOR UPDATE;
SLEEP 0.2;
--echo # Switch to connection con3
connection con3;
let $result = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_deadlocks'`;
let $diff = `SELECT $result - $current`;
echo $diff;
--echo # Drop test table
drop table t;

View File

@ -0,0 +1 @@
--innodb_doublewrite_file=ib_doublewrite

View File

@ -0,0 +1,4 @@
show variables like 'innodb_doublewrite%';
Variable_name Value
innodb_doublewrite ON
innodb_doublewrite_file ib_doublewrite

View File

@ -0,0 +1,2 @@
--source include/have_innodb.inc
show variables like 'innodb_doublewrite%';

View File

@ -0,0 +1 @@
--slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=1

View File

@ -0,0 +1 @@
--slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=1

View File

@ -0,0 +1,103 @@
# Activate master-slave replication
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
# Make table t for test
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT);
# Start slave replication
START SLAVE;
INSERT INTO t VALUES (1);
# Read information about master binlog
# Sync(1) slave thread
# Read and change log_slow_slave_statements to ON on slave
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements OFF
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
INSERT INTO t VALUES (2);
# Read information about master binlog
# Sync slave(2) thread
# Restart slave
STOP SLAVE;
START SLAVE;
INSERT INTO t VALUES (3);
# Read information about master binlog
# Sync(3) slave thread
show variables like 'long_query_time';
Variable_name Value
long_query_time 1.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 1.000000
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time OFF
set global long_query_time=0;
show variables like 'long_query_time';
Variable_name Value
long_query_time 1.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time OFF
INSERT INTO t VALUES (4);
# Read information about master binlog
# Sync slave(4) thread
show variables like 'long_query_time';
Variable_name Value
long_query_time 1.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time OFF
set global use_global_long_query_time=1;
show variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time ON
INSERT INTO t VALUES (5);
# Read information about master binlog
# Sync slave(5) thread
show variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time ON
set global long_query_time=1;
set global use_global_long_query_time=0;
# Analyse master slow_query_log
0
0
0
0
0
# Analyse slave slow_query_log
0
0
0
0
1
set global log_slow_slave_statements=OFF;
DROP TABLE t;
# Read information about master binlog
# Sync slave(6) thread

View File

@ -0,0 +1,139 @@
-- echo # Activate master-slave replication
-- source include/master-slave.inc
connection master;
-- echo # Make table t for test
-- disable_warnings
DROP TABLE IF EXISTS t;
-- enable_warnings
CREATE TABLE t(id INT);
-- echo # Start slave replication
-- disable_warnings
connection slave;
START SLAVE;
-- source include/wait_for_slave_to_start.inc
-- enable_warnings
#-- echo # Make insert(1) on master
connection master;
INSERT INTO t VALUES (1);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync(1) slave thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-- echo # Read and change log_slow_slave_statements to ON on slave
show variables like 'log_slow_slave_statements';
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
#-- echo # Make insert(2) on master
connection master;
INSERT INTO t VALUES (2);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync slave(2) thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-- echo # Restart slave
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc
START SLAVE;
-- source include/wait_for_slave_to_start.inc
#-- echo # Make insert(3) on master
connection master;
INSERT INTO t VALUES (3);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync(3) slave thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'use_global_long_query_time';
set global long_query_time=0;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'use_global_long_query_time';
#-- echo # Make insert(4) on master
connection master;
INSERT INTO t VALUES (4);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync slave(4) thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'use_global_long_query_time';
set global use_global_long_query_time=1;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'use_global_long_query_time';
#-- echo # Make insert(5) on master
connection master;
let $MASTER_DATADIR= `select @@datadir`;
INSERT INTO t VALUES (5);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync slave(5) thread
connection slave;
let $SLAVE_DATADIR= `select @@datadir`;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'use_global_long_query_time';
set global long_query_time=1;
set global use_global_long_query_time=0;
-- echo # Analyse master slow_query_log
let $i=5;
let $k=1;
let $cmd=cat ./$MASTER_DATADIR/percona_log_slow_slave_statements-master.log | grep;
while($i)
{
let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l;
exec $current_cmd;
dec $i;
inc $k;
}
-- echo # Analyse slave slow_query_log
let $i=5;
let $k=1;
let $cmd=cat $SLAVE_DATADIR/percona_log_slow_slave_statements-slave.log | grep;
while($i)
{
let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l;
exec $current_cmd;
dec $i;
inc $k;
}
set global log_slow_slave_statements=OFF;
connection master;
DROP TABLE t;
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync slave(6) thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;

View File

@ -0,0 +1 @@
--slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=0

View File

@ -0,0 +1 @@
--slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=0

View File

@ -0,0 +1,86 @@
# Activate master-slave replication
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
# Make table t for test
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT);
# Start slave replication
START SLAVE;
INSERT INTO t VALUES (1);
# Read information about master binlog
# Sync(1) slave thread
# Read and change log_slow_slave_statements to ON on slave
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements OFF
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
INSERT INTO t VALUES (2);
# Read information about master binlog
# Sync slave(2) thread
# Restart slave
STOP SLAVE;
START SLAVE;
INSERT INTO t VALUES (3);
# Read information about master binlog
# Sync(3) slave thread
# Read and change log_slow_slave_statements to OFF on slave
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
set global log_slow_slave_statements=OFF;
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements OFF
INSERT INTO t VALUES (4);
# Read information about master binlog
# Sync slave(4) thread
# Restart slave
STOP SLAVE;
START SLAVE;
INSERT INTO t VALUES (5);
# Read information about master binlog
# Sync slave(5) thread
# Read and change log_slow_slave_statements to ON on slave
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements OFF
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
INSERT INTO t VALUES (6);
# Read information about master binlog
# Sync slave(6) thread
# Restart slave
STOP SLAVE;
START SLAVE;
INSERT INTO t VALUES (7);
# Read information about master binlog
# Sync slave(7) thread
# Analyse master slow_query_log
1
1
1
1
1
1
1
# Analyse slave slow_query_log
0
0
1
0
0
0
1
set global log_slow_slave_statements=OFF;
DROP TABLE t;
# Read information about master binlog
# Sync slave(8) thread

View File

@ -0,0 +1,160 @@
-- echo # Activate master-slave replication
-- source include/master-slave.inc
connection master;
-- echo # Make table t for test
-- disable_warnings
DROP TABLE IF EXISTS t;
-- enable_warnings
CREATE TABLE t(id INT);
-- echo # Start slave replication
-- disable_warnings
connection slave;
START SLAVE;
-- source include/wait_for_slave_to_start.inc
-- enable_warnings
#-- echo # Make insert(1) on master
connection master;
INSERT INTO t VALUES (1);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync(1) slave thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-- echo # Read and change log_slow_slave_statements to ON on slave
show variables like 'log_slow_slave_statements';
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
#-- echo # Make insert(2) on master
connection master;
INSERT INTO t VALUES (2);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync slave(2) thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-- echo # Restart slave
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc
START SLAVE;
-- source include/wait_for_slave_to_start.inc
#-- echo # Make insert(3) on master
connection master;
INSERT INTO t VALUES (3);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync(3) slave thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-- echo # Read and change log_slow_slave_statements to OFF on slave
show variables like 'log_slow_slave_statements';
set global log_slow_slave_statements=OFF;
show variables like 'log_slow_slave_statements';
#-- echo # Make insert(4) on master
connection master;
INSERT INTO t VALUES (4);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync slave(4) thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-- echo # Restart slave
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc
START SLAVE;
-- source include/wait_for_slave_to_start.inc
#-- echo # Make insert(5) on master
connection master;
INSERT INTO t VALUES (5);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync slave(5) thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-- echo # Read and change log_slow_slave_statements to ON on slave
show variables like 'log_slow_slave_statements';
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
#-- echo # Make insert(6) on master
connection master;
INSERT INTO t VALUES (6);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync slave(6) thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-- echo # Restart slave
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc
START SLAVE;
-- source include/wait_for_slave_to_start.inc
#-- echo # Make insert(7) on master
connection master;
let $MASTER_DATADIR= `select @@datadir`;
INSERT INTO t VALUES (7);
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync slave(7) thread
connection slave;
let $SLAVE_DATADIR= `select @@datadir`;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-- echo # Analyse master slow_query_log
let $i=7;
let $k=1;
let $cmd=cat $MASTER_DATADIR/percona_log_slow_slave_statements-master.log | grep -c;
while($i)
{
let $current_cmd = $cmd "INSERT INTO t VALUES ($k)";
exec $current_cmd;
dec $i;
inc $k;
}
-- echo # Analyse slave slow_query_log
let $i=7;
let $k=1;
let $cmd=cat $SLAVE_DATADIR/percona_log_slow_slave_statements-slave.log | grep -c;
while($i)
{
let $current_cmd = $cmd "INSERT INTO t VALUES ($k)";
exec $current_cmd;
dec $i;
inc $k;
}
set global log_slow_slave_statements=OFF;
connection master;
DROP TABLE t;
-- echo # Read information about master binlog
let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-- echo # Sync slave(8) thread
connection slave;
let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;

View File

@ -0,0 +1,88 @@
--source include/percona_query_cache_with_comments_clear.inc
let $query=/* with comment first */select * from t1;
eval $query;
--source include/percona_query_cache_with_comments_eval.inc
let $query=# with comment first
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=-- with comment first
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=/* with comment first and "quote" */select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=# with comment first and "quote"
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=-- with comment first and "quote"
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=
/* with comment and whitespaces first */select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=
# with comment and whitespaces first
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=
-- with comment and whitespaces first
select * from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $internal=* internal comment *;
let $query=select * /$internal/ from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select */$internal/ from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select */$internal/from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $internal=* internal comment with "quote" *;
let $query=select * /$internal/ from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select */$internal/ from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select */$internal/from t1;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1
;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 ;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 ;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1
/* comment in the end */;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1
/* comment in the end */
;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 #comment in the end;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 #comment in the end
;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 -- comment in the end;
--source include/percona_query_cache_with_comments_eval.inc
let $query=select * from t1 -- comment in the end
;
--source include/percona_query_cache_with_comments_eval.inc

View File

@ -0,0 +1,866 @@
set global query_cache_strip_comments=ON;
set GLOBAL query_cache_size=1355776;
drop table if exists t1;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
flush query cache;
flush query cache;
reset query cache;
flush status;
flush query cache;
flush query cache;
reset query cache;
flush status;
/* with comment first */select * from t1;
a
1
2
3
-----------------------------------------------------
/* with comment first */select * 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 0
/* with comment first */select * from t1;
a
1
2
3
/* with comment first */select * 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 2
-----------------------------------------------------
# with comment first
select * 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 2
# with comment first
select * from t1;
a
1
2
3
# with comment first
select * 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 4
-----------------------------------------------------
-- with comment first
select * 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 4
-- with comment first
select * from t1;
a
1
2
3
-- with comment first
select * 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 6
-----------------------------------------------------
/* with comment first and "quote" */select * 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 6
/* with comment first and "quote" */select * from t1;
a
1
2
3
/* with comment first and "quote" */select * 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 8
-----------------------------------------------------
# with comment first and "quote"
select * 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 8
# with comment first and "quote"
select * from t1;
a
1
2
3
# with comment first and "quote"
select * 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 10
-----------------------------------------------------
-- with comment first and "quote"
select * 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 10
-- with comment first and "quote"
select * from t1;
a
1
2
3
-- with comment first and "quote"
select * 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 12
-----------------------------------------------------
/* with comment and whitespaces first */select * 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 12
/* with comment and whitespaces first */select * from t1;
a
1
2
3
/* with comment and whitespaces first */select * 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 14
-----------------------------------------------------
# with comment and whitespaces first
select * 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 14
# with comment and whitespaces first
select * from t1;
a
1
2
3
# with comment and whitespaces first
select * 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 16
-----------------------------------------------------
-- with comment and whitespaces first
select * 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 16
-- with comment and whitespaces first
select * from t1;
a
1
2
3
-- with comment and whitespaces first
select * 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 18
-----------------------------------------------------
select * /* internal 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 18
select * /* internal comment */ from t1;
a
1
2
3
select * /* internal 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 20
-----------------------------------------------------
select */* internal 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 20
select */* internal comment */ from t1;
a
1
2
3
select */* internal 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 22
-----------------------------------------------------
select */* internal 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 22
select */* internal comment */from t1;
a
1
2
3
select */* internal 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 24
-----------------------------------------------------
select * /* internal comment with "quote" */ 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 24
select * /* internal comment with "quote" */ from t1;
a
1
2
3
select * /* internal comment with "quote" */ 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 26
-----------------------------------------------------
select */* internal comment with "quote" */ 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 26
select */* internal comment with "quote" */ from t1;
a
1
2
3
select */* internal comment with "quote" */ 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 28
-----------------------------------------------------
select */* internal comment with "quote" */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 28
select */* internal comment with "quote" */from t1;
a
1
2
3
select */* internal comment with "quote" */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 30
-----------------------------------------------------
select * 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 30
select * from t1
;
a
1
2
3
select * 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 32
-----------------------------------------------------
select * 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 32
select * from t1 ;
a
1
2
3
select * 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 34
-----------------------------------------------------
select * 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 34
select * from t1 ;
a
1
2
3
select * 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 36
-----------------------------------------------------
select * from t1
/* comment in the end */
-----------------------------------------------------
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 36
select * from t1
/* comment in the end */;
a
1
2
3
select * from t1
/* comment in the end */;
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 38
-----------------------------------------------------
select * 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 38
select * from t1
/* *\/ */;
a
1
2
3
select * 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 40
-----------------------------------------------------
select * from t1
/* comment in the end */
-----------------------------------------------------
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 40
select * from t1
/* comment in the end */
;
a
1
2
3
select * from t1
/* comment in the end */
;
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 42
-----------------------------------------------------
select * from t1 #comment in the end
-----------------------------------------------------
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 42
select * from t1 #comment in the end;
a
1
2
3
select * from t1 #comment in the end;
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 44
-----------------------------------------------------
select * from t1 #comment in the end
-----------------------------------------------------
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 44
select * from t1 #comment in the end
;
a
1
2
3
select * from t1 #comment in the end
;
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 46
-----------------------------------------------------
select * from t1 -- comment in the end
-----------------------------------------------------
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 46
select * from t1 -- comment in the end;
a
1
2
3
select * from t1 -- comment in the end;
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 48
-----------------------------------------------------
select * from t1 -- comment in the end
-----------------------------------------------------
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 48
select * from t1 -- comment in the end
;
a
1
2
3
select * from t1 -- comment in the end
;
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 50
-----------------------------------------------------
select ' \' ' 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 50
select ' \' ' from t1;
'
'
'
'
select ' \' ' 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 51
DROP TABLE t1;
SET GLOBAL query_cache_size=default;
set global query_cache_strip_comments=OFF;

View File

@ -0,0 +1,4 @@
set global query_cache_strip_comments=ON;
-- source include/percona_query_cache_with_comments_begin.inc
-- source include/percona_query_cache_with_comments.inc
-- source include/percona_query_cache_with_comments_end.inc

View File

@ -0,0 +1,21 @@
set GLOBAL query_cache_size=1355776;
drop table if exists t1;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
flush query cache;
flush query cache;
reset query cache;
flush status;
( select * from t1 );
a
1
2
3
/*!40101 SET @OLD_SQL_MODE := @@SQL_MODE, @@SQL_MODE := REPLACE(REPLACE(@@SQL_MODE, 'ANSI_QUOTES', ''), ',,', ','), @OLD_QUOTE := @@SQL_QUOTE_SHOW_CREATE, @@SQL_QUOTE_SHOW_CREATE := 1 */;
/* only comment */;
# only comment
;
-- only comment
;
DROP TABLE t1;
SET GLOBAL query_cache_size= default;

View File

@ -0,0 +1,22 @@
-- source include/have_query_cache.inc
set GLOBAL query_cache_size=1355776;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
flush query cache; # This crashed in some versions
flush query cache; # This crashed in some versions
reset query cache;
flush status;
( select * from t1 );
/*!40101 SET @OLD_SQL_MODE := @@SQL_MODE, @@SQL_MODE := REPLACE(REPLACE(@@SQL_MODE, 'ANSI_QUOTES', ''), ',,', ','), @OLD_QUOTE := @@SQL_QUOTE_SHOW_CREATE, @@SQL_QUOTE_SHOW_CREATE := 1 */;
/* only comment */;
let query=# only comment
;
eval $query;
let query=-- only comment
;
eval $query;
DROP TABLE t1;
SET GLOBAL query_cache_size= default;

View File

@ -0,0 +1,865 @@
set GLOBAL query_cache_size=1355776;
drop table if exists t1;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
flush query cache;
flush query cache;
reset query cache;
flush status;
flush query cache;
flush query cache;
reset query cache;
flush status;
/* with comment first */select * from t1;
a
1
2
3
-----------------------------------------------------
/* with comment first */select * 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 0
/* with comment first */select * from t1;
a
1
2
3
/* with comment first */select * 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 2
-----------------------------------------------------
# with comment first
select * 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 2
# with comment first
select * from t1;
a
1
2
3
# with comment first
select * from t1;
a
1
2
3
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 2
-----------------------------------------------------
-- with comment first
select * 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 2
-- with comment first
select * from t1;
a
1
2
3
-- with comment first
select * from t1;
a
1
2
3
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 2
-----------------------------------------------------
/* with comment first and "quote" */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 2
/* with comment first and "quote" */select * from t1;
a
1
2
3
/* with comment first and "quote" */select * from t1;
a
1
2
3
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 3
-----------------------------------------------------
# with comment first and "quote"
select * 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 3
# with comment first and "quote"
select * from t1;
a
1
2
3
# with comment first and "quote"
select * from t1;
a
1
2
3
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 3
-----------------------------------------------------
-- with comment first and "quote"
select * from t1
-----------------------------------------------------
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 3
-- with comment first and "quote"
select * from t1;
a
1
2
3
-- with comment first and "quote"
select * from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 6
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 6
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 3
-----------------------------------------------------
/* with comment and whitespaces first */select * from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 6
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 6
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 3
/* with comment and whitespaces first */select * from t1;
a
1
2
3
/* with comment and whitespaces first */select * from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 7
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 7
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
-----------------------------------------------------
# with comment and whitespaces first
select * from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 7
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 7
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
# with comment and whitespaces first
select * from t1;
a
1
2
3
# with comment and whitespaces first
select * from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 8
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 8
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
-----------------------------------------------------
-- with comment and whitespaces first
select * from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 8
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 8
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
-- with comment and whitespaces first
select * from t1;
a
1
2
3
-- with comment and whitespaces first
select * from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 9
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 9
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
-----------------------------------------------------
select * /* internal comment */ from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 9
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 9
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
select * /* internal comment */ from t1;
a
1
2
3
select * /* internal comment */ from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 10
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 10
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 5
-----------------------------------------------------
select */* internal comment */ from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 10
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 10
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 5
select */* internal comment */ from t1;
a
1
2
3
select */* internal comment */ from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 11
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 11
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 6
-----------------------------------------------------
select */* internal comment */from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 11
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 11
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 6
select */* internal comment */from t1;
a
1
2
3
select */* internal comment */from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 12
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 12
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 7
-----------------------------------------------------
select * /* internal comment with "quote" */ from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 12
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 12
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 7
select * /* internal comment with "quote" */ from t1;
a
1
2
3
select * /* internal comment with "quote" */ from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 13
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 13
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 8
-----------------------------------------------------
select */* internal comment with "quote" */ from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 13
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 13
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 8
select */* internal comment with "quote" */ from t1;
a
1
2
3
select */* internal comment with "quote" */ from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 14
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 14
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 9
-----------------------------------------------------
select */* internal comment with "quote" */from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 14
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 14
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 9
select */* internal comment with "quote" */from t1;
a
1
2
3
select */* internal comment with "quote" */from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 15
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 15
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 10
-----------------------------------------------------
select * from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 15
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 15
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 10
select * from t1
;
a
1
2
3
select * from t1
;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 16
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 16
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 11
-----------------------------------------------------
select * from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 16
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 16
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 11
select * from t1 ;
a
1
2
3
select * from t1 ;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 16
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 16
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 13
-----------------------------------------------------
select * from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 16
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 16
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 13
select * from t1 ;
a
1
2
3
select * from t1 ;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 16
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 16
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 15
-----------------------------------------------------
select * from t1
/* comment in the end */
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 16
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 16
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 15
select * from t1
/* comment in the end */;
a
1
2
3
select * from t1
/* comment in the end */;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 17
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 17
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 16
-----------------------------------------------------
select * from t1
/* *\/ */
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 17
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 17
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 16
select * from t1
/* *\/ */;
a
1
2
3
select * from t1
/* *\/ */;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 18
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 18
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 17
-----------------------------------------------------
select * from t1
/* comment in the end */
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 18
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 18
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 17
select * from t1
/* comment in the end */
;
a
1
2
3
select * from t1
/* comment in the end */
;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 18
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 18
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 19
-----------------------------------------------------
select * from t1 #comment in the end
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 18
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 18
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 19
select * from t1 #comment in the end;
a
1
2
3
select * from t1 #comment in the end;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 19
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 19
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 20
-----------------------------------------------------
select * from t1 #comment in the end
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 19
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 19
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 20
select * from t1 #comment in the end
;
a
1
2
3
select * from t1 #comment in the end
;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 19
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 19
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 22
-----------------------------------------------------
select * from t1 -- comment in the end
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 19
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 19
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 22
select * from t1 -- comment in the end;
a
1
2
3
select * from t1 -- comment in the end;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 20
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 20
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 23
-----------------------------------------------------
select * from t1 -- comment in the end
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 20
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 20
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 23
select * from t1 -- comment in the end
;
a
1
2
3
select * from t1 -- comment in the end
;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 20
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 20
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 25
-----------------------------------------------------
select ' \' ' from t1
-----------------------------------------------------
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 20
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 20
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 25
select ' \' ' from t1;
'
'
'
'
select ' \' ' 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
DROP TABLE t1;
SET GLOBAL query_cache_size=default;
set global query_cache_strip_comments=OFF;

View File

@ -0,0 +1,3 @@
-- source include/percona_query_cache_with_comments_begin.inc
-- source include/percona_query_cache_with_comments.inc
-- source include/percona_query_cache_with_comments_end.inc

View File

@ -0,0 +1,396 @@
set GLOBAL query_cache_size=1355776;
flush query cache;
flush query cache;
reset query cache;
flush status;
drop table if exists t1;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
set global query_cache_strip_comments=ON;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 0
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
prepare stmt from '/* with comment */ select * from t1';
execute stmt;
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 0
execute stmt;
a
1
2
3
execute stmt;
a
1
2
3
execute stmt;
a
1
2
3
execute stmt;
a
1
2
3
execute stmt;
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 5
prepare stmt from 'select * from t1';
execute stmt;
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 6
prepare stmt from 'select * /*internal comment*/from t1';
execute stmt;
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 7
prepare stmt from 'select * /*internal comment*/ from t1';
execute stmt;
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 8
prepare stmt from 'select * from t1 /* at the end */';
execute stmt;
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 9
prepare stmt from 'select * from t1 /* with "quote" */';
execute stmt;
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 10
prepare stmt from 'select * from t1 /* with \'quote\' */';
execute stmt;
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 11
prepare stmt from 'select * from t1 # 123
';
execute stmt;
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 12
prepare stmt from 'select * from t1 # 123 with "quote"
';
execute stmt;
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 13
prepare stmt from 'select * from t1 # 123 with \'quote\'
';
execute stmt;
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 14
prepare stmt from 'select * from t1
# 123
';
execute stmt;
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 15
prepare stmt from '#456
select * from t1
# 123
';
execute stmt;
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 16
prepare stmt from 'select * from t1 -- 123
';
execute stmt;
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 17
prepare stmt from 'select * from t1
-- 123
';
execute stmt;
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 18
prepare stmt from '-- comment in first
select * from t1
# 123
';
execute stmt;
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 19
prepare stmt from '(#456(
select * from t1
# 123(
)';
execute stmt;
a
1
2
3
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 19
prepare stmt from '/*test*/(-- comment in first(
select * from t1
-- 123 asdasd
/* test */)';
execute stmt;
a
1
2
3
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 20
prepare stmt from 'select "test",a from t1';
execute stmt;
test a
test 1
test 2
test 3
execute stmt;
test a
test 1
test 2
test 3
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 21
prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
execute stmt;
test /* internal 'comment' */ a
test /* internal 'comment' */ 1
test /* internal 'comment' */ 2
test /* internal 'comment' */ 3
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 21
prepare stmt from 'select "test #internal comment" ,a from t1';
execute stmt;
test #internal comment a
test #internal comment 1
test #internal comment 2
test #internal comment 3
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 21
prepare stmt from 'select "test #internal comment" #external comment
,a from t1';
execute stmt;
test #internal comment a
test #internal comment 1
test #internal comment 2
test #internal comment 3
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 22
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
set global query_cache_strip_comments=OFF;

View File

@ -0,0 +1,208 @@
-- source include/have_query_cache.inc
set GLOBAL query_cache_size=1355776;
# Reset query cache variables.
flush query cache; # This crashed in some versions
flush query cache; # This crashed in some versions
reset query cache;
flush status;
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# First simple test
#
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
set global query_cache_strip_comments=ON;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from '/* with comment */ select * from t1';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
execute stmt;
execute stmt;
execute stmt;
execute stmt;
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * from t1';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * /*internal comment*/from t1';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * /*internal comment*/ from t1';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * from t1 /* at the end */';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * from t1 /* with "quote" */';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * from t1 /* with \'quote\' */';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * from t1 # 123
';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * from t1 # 123 with "quote"
';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * from t1 # 123 with \'quote\'
';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * from t1
# 123
';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from '#456
select * from t1
# 123
';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * from t1 -- 123
';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select * from t1
-- 123
';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from '-- comment in first
select * from t1
# 123
';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from '(#456(
select * from t1
# 123(
)';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from '/*test*/(-- comment in first(
select * from t1
-- 123 asdasd
/* test */)';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select "test",a from t1';
execute stmt;
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select "test #internal comment" ,a from t1';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
prepare stmt from 'select "test #internal comment" #external comment
,a from t1';
execute stmt;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
set global query_cache_strip_comments=OFF;

View File

@ -0,0 +1,58 @@
drop table if exists t1,t2,t3;
drop database if exists showtemp;
create database if not exists showtemp;
use test;
create temporary table t1(id int);
create temporary table t2(id int);
create temporary table showtemp.t3(id int);
insert into t1 values(10),(20),(30),(40);
insert into showtemp.t3 values(999);
show temporary tables;
Temp_tables_in_test
t2
t1
show temporary tables from test;
Temp_tables_in_test
t2
t1
show temporary tables in showtemp;
Temp_tables_in_showtemp
t3
select table_schema, table_name, engine, table_rows from Information_schema.temporary_tables;
table_schema table_name engine table_rows
showtemp t3 MyISAM 1
test t2 MyISAM 0
test t1 MyISAM 4
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
table_schema table_name engine table_rows
showtemp t3 MyISAM 1
test t2 MyISAM 0
test t1 MyISAM 4
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='showtemp';
table_schema table_name engine table_rows
showtemp t3 MyISAM 1
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='temp';
table_schema table_name engine table_rows
drop table if exists showtemp.t2;
create temporary table t1(id int);
create temporary table showtemp.t2(id int);
show temporary tables;
Temp_tables_in_test
t1
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
table_schema table_name engine table_rows
showtemp t2 MyISAM 0
test t1 MyISAM 0
showtemp t3 MyISAM 1
test t2 MyISAM 0
test t1 MyISAM 4
drop table showtemp.t2;
drop table t1;
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
table_schema table_name engine table_rows
showtemp t3 MyISAM 1
test t2 MyISAM 0
test t1 MyISAM 4
drop table t1, t2;
drop table showtemp.t3;
drop database showtemp;

View File

@ -0,0 +1,65 @@
# Uses GRANT commands that usually disabled in embedded server
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# Test of SHOW [GLOBAL] TEMPORARY TABLES [FROM/IN] DB and
# Information_schema.temporary_tables and global_temporary_tables
#
connect(stcon1,localhost,root,,test);
connect(stcon2,localhost,root,,test);
connection stcon1;
--disable_warnings
drop table if exists t1,t2,t3;
drop database if exists showtemp;
create database if not exists showtemp;
--enable_warnings
use test;
create temporary table t1(id int);
create temporary table t2(id int);
create temporary table showtemp.t3(id int);
insert into t1 values(10),(20),(30),(40);
insert into showtemp.t3 values(999);
show temporary tables;
# "Session" is not same value always. mysql-test cannot test it always.
#show global temporary tables;
show temporary tables from test;
show temporary tables in showtemp;
select table_schema, table_name, engine, table_rows from Information_schema.temporary_tables;
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='showtemp';
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='temp';
connection stcon2;
--disable_warnings
drop table if exists showtemp.t2;
--enable_warnings
create temporary table t1(id int);
create temporary table showtemp.t2(id int);
show temporary tables;
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
drop table showtemp.t2;
drop table t1;
disconnect stcon2;
connection stcon1;
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
drop table t1, t2;
drop table showtemp.t3;
drop database showtemp;
connection default;
disconnect stcon1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1 @@
--slow-query-log-file=percona_slow_query_log-control_global_slow.log --long-query-time=1

View File

@ -0,0 +1,12 @@
SELECT sleep(2);
sleep(2)
0
set global log_slow_verbosity=innodb;
set global use_global_log_slow_control="log_slow_verbosity,long_query_time";
SELECT sleep(2);
sleep(2)
0
set global use_global_log_slow_control=none;
set global log_slow_verbosity=microtime;
cat MYSQLD_DATADIR/percona_slow_query_log-control_global_slow.log | grep -c "No InnoDB statistics available for this query"
1

View File

@ -0,0 +1,12 @@
source include/have_innodb.inc;
SELECT sleep(2);
set global log_slow_verbosity=innodb;
set global use_global_log_slow_control="log_slow_verbosity,long_query_time";
SELECT sleep(2);
set global use_global_log_slow_control=none;
set global log_slow_verbosity=microtime;
let $MYSQLD_DATADIR= `select @@datadir`;
let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-control_global_slow.log | grep -c "No InnoDB statistics available for this query";
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
exec echo '$cmd';
exec $cmd;

View File

@ -0,0 +1 @@
--slow-query-log-file=percona_slow_query_log-log_slow_filter.log --long-query-time=1

View File

@ -0,0 +1,25 @@
SET GLOBAL SLOW_QUERY_LOG=OFF;
drop table if exists t;
# Create test table
create table t(id INT PRIMARY KEY) engine=InnoDB;
# Insert two rows to test table
insert into t values(1);
insert into t values(2);
insert into t values(3);
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(2);
sleep(2)
0
set log_slow_filter=full_join;
SELECT sleep(2) union select t2.id from t as t1,t as t2;
sleep(2)
0
1
2
3
SELECT sleep(2);
sleep(2)
0
drop table if exists t;
cat MYSQLD_DATADIR/percona_slow_query_log-log_slow_filter.log | grep -c Query_time
2

View File

@ -0,0 +1,33 @@
source include/have_innodb.inc;
SET GLOBAL SLOW_QUERY_LOG=OFF;
--disable_warnings
drop table if exists t;
--enable_warnings
--echo # Create test table
create table t(id INT PRIMARY KEY) engine=InnoDB;
--echo # Insert two rows to test table
insert into t values(1);
insert into t values(2);
insert into t values(3);
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(2);
set log_slow_filter=full_join;
SELECT sleep(2) union select t2.id from t as t1,t as t2;
SELECT sleep(2);
--disable_warnings
drop table if exists t;
--enable_warnings
let $MYSQLD_DATADIR= `select @@datadir`;
let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-log_slow_filter.log | grep -c Query_time;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
exec echo '$cmd';
exec $cmd;

View File

@ -0,0 +1 @@
--slow-query-log-file=percona_slow_query_log-log_slow_verbosity.log --long-query-time=1

View File

@ -0,0 +1,9 @@
SELECT sleep(2);
sleep(2)
0
set log_slow_verbosity=innodb;
SELECT sleep(2);
sleep(2)
0
cat MYSQLD_DATADIR/percona_slow_query_log-log_slow_verbosity.log | grep -c "No InnoDB statistics available for this query"
1

View File

@ -0,0 +1,13 @@
source include/have_innodb.inc;
SELECT sleep(2);
set log_slow_verbosity=innodb;
SELECT sleep(2);
let $MYSQLD_DATADIR= `select @@datadir`;
let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-log_slow_verbosity.log | grep -c "No InnoDB statistics available for this query";
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
exec echo '$cmd';
exec $cmd;

View File

@ -0,0 +1 @@
--slow-query-log-file=percona_slow_query_log-long_query_time.log --long-query-time=2

View File

@ -0,0 +1,22 @@
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set long_query_time=4;
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set long_query_time=2;
cat MYSQLD_DATADIR/percona_slow_query_log-long_query_time.log | grep -c Query_time
3

View File

@ -0,0 +1,19 @@
source include/have_innodb.inc;
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set long_query_time=4;
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set long_query_time=2;
let $MYSQLD_DATADIR= `select @@datadir`;
let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-long_query_time.log | grep -c Query_time;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
exec echo '$cmd';
exec $cmd;

View File

@ -0,0 +1 @@
--slow-query-log-file=percona_slow_query_log-microseconds_in_slow_query_log.log --long-query-time=1

View File

@ -0,0 +1,12 @@
SELECT sleep(2);
sleep(2)
0
set global slow_query_log_microseconds_timestamp=ON;
SELECT sleep(2);
sleep(2)
0
set global slow_query_log_microseconds_timestamp=OFF;
cat MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+.[0-9]+'
1
cat MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+'
2

View File

@ -0,0 +1,20 @@
source include/have_innodb.inc;
SELECT sleep(2);
set global slow_query_log_microseconds_timestamp=ON;
SELECT sleep(2);
set global slow_query_log_microseconds_timestamp=OFF;
let $MYSQLD_DATADIR= `select @@datadir`;
let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+.[0-9]+';
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
exec echo "$cmd";
exec $cmd;
let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+';
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
exec echo "$cmd";
exec $cmd;

View File

@ -0,0 +1 @@
--slow-query-log-file=percona_slow_query_log-min_examined_row_limit.log --long-query-time=1

View File

@ -0,0 +1,25 @@
SET GLOBAL SLOW_QUERY_LOG=OFF;
drop table if exists t;
# Create test table
create table t(id INT PRIMARY KEY) engine=InnoDB;
# Insert two rows to test table
insert into t values(1);
insert into t values(2);
insert into t values(3);
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(2);
sleep(2)
0
set min_examined_row_limit=5;
SELECT sleep(2) union select t2.id from t as t1,t as t2;
sleep(2)
0
1
2
3
SELECT sleep(2);
sleep(2)
0
drop table if exists t;
cat MYSQLD_DATADIR/percona_slow_query_log-min_examined_row_limit.log | grep -c Query_time
2

View File

@ -0,0 +1,33 @@
source include/have_innodb.inc;
SET GLOBAL SLOW_QUERY_LOG=OFF;
--disable_warnings
drop table if exists t;
--enable_warnings
--echo # Create test table
create table t(id INT PRIMARY KEY) engine=InnoDB;
--echo # Insert two rows to test table
insert into t values(1);
insert into t values(2);
insert into t values(3);
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(2);
set min_examined_row_limit=5;
SELECT sleep(2) union select t2.id from t as t1,t as t2;
SELECT sleep(2);
--disable_warnings
drop table if exists t;
--enable_warnings
let $MYSQLD_DATADIR= `select @@datadir`;
let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-min_examined_row_limit.log | grep -c Query_time;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
exec echo '$cmd';
exec $cmd;

View File

@ -0,0 +1 @@
--slow-query-log-file=percona_slow_query_log-use_global_long_query_time.log --long-query-time=2

View File

@ -0,0 +1,24 @@
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set global long_query_time=4;
set global use_global_long_query_time=1;
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set global long_query_time=2;
set global use_global_long_query_time=0;
cat MYSQLD_DATADIR/percona_slow_query_log-use_global_long_query_time.log | grep -c Query_time
3

View File

@ -0,0 +1,21 @@
source include/have_innodb.inc;
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set global long_query_time=4;
set global use_global_long_query_time=1;
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set global long_query_time=2;
set global use_global_long_query_time=0;
let $MYSQLD_DATADIR= `select @@datadir`;
let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-use_global_long_query_time.log | grep -c Query_time;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
exec echo '$cmd';
exec $cmd;

View File

@ -0,0 +1 @@
--log-error

View File

@ -0,0 +1,28 @@
SET @old_log_warnings = @@log_warnings;
SET @old_suppress_log_warning_1592 = @@suppress_log_warning_1592;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 0;
SET GLOBAL LOG_WARNINGS = 0;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
Warnings:
Note 1592 Statement may not be safe to log in statement format.
SET GLOBAL LOG_WARNINGS = 1;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
Warnings:
Note 1592 Statement may not be safe to log in statement format.
SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 1;
SET GLOBAL LOG_WARNINGS = 0;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
Warnings:
Note 1592 Statement may not be safe to log in statement format.
SET GLOBAL LOG_WARNINGS = 1;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
Warnings:
Note 1592 Statement may not be safe to log in statement format.
DROP TABLE t1;
SET GLOBAL log_warnings = @old_log_warnings;
SET GLOBAL suppress_log_warning_1592 = @old_suppress_log_warning_1592;
# Count the number of times the "Unsafe" message was printed
# to the error log.
Occurrences: 1

View File

@ -0,0 +1,46 @@
-- source include/have_log_bin.inc
-- source include/have_binlog_format_statement.inc
SET @old_log_warnings = @@log_warnings;
SET @old_suppress_log_warning_1592 = @@suppress_log_warning_1592;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 0;
SET GLOBAL LOG_WARNINGS = 0;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
SET GLOBAL LOG_WARNINGS = 1;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 1;
SET GLOBAL LOG_WARNINGS = 0;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
SET GLOBAL LOG_WARNINGS = 1;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
DROP TABLE t1;
SET GLOBAL log_warnings = @old_log_warnings;
SET GLOBAL suppress_log_warning_1592 = @old_suppress_log_warning_1592;
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!`select LENGTH('$log_error_')`)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
}
# Assign env variable LOG_ERROR
let LOG_ERROR=$log_error_;
--echo # Count the number of times the "Unsafe" message was printed
--echo # to the error log.
perl;
use strict;
my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set";
open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
my $count = () = grep(/suppress_1592/g,<FILE>);
print "Occurrences: $count\n";
close(FILE);
EOF

View File

@ -0,0 +1,6 @@
select * from information_schema.XTRADB_ADMIN_COMMAND;
result_message
No XTRA_* command in the SQL statement. Please add /*!XTRA_xxxx*/ to the SQL.
select * from information_schema.XTRADB_ADMIN_COMMAND /*!XTRA_HELLO*/;
result_message
Hello!

View File

@ -0,0 +1,3 @@
--source include/have_innodb.inc
select * from information_schema.XTRADB_ADMIN_COMMAND;
select * from information_schema.XTRADB_ADMIN_COMMAND /*!XTRA_HELLO*/;

View File

@ -0,0 +1,4 @@
SET @old_innodb_file_format=@@innodb_file_format;
SET @old_innodb_file_per_table=@@innodb_file_per_table;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=ON;

View File

@ -1,4 +1,4 @@
--source include/have_innodb.inc -- source include/have_innodb.inc
SET @old_innodb_file_format=@@innodb_file_format; SET @old_innodb_file_format=@@innodb_file_format;
SET @old_innodb_file_per_table=@@innodb_file_per_table; SET @old_innodb_file_per_table=@@innodb_file_per_table;
@ -6,9 +6,10 @@ let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
SET GLOBAL innodb_file_format='Barracuda'; SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=ON; SET GLOBAL innodb_file_per_table=ON;
--disable_warnings -- disable_query_log
-- disable_result_log
DROP TABLE IF EXISTS `test1`; DROP TABLE IF EXISTS `test1`;
--enable_warnings
CREATE TABLE IF NOT EXISTS `test1` ( CREATE TABLE IF NOT EXISTS `test1` (
`a` int primary key auto_increment, `a` int primary key auto_increment,
`b` int default 0, `b` int default 0,
@ -32,11 +33,7 @@ REPEAT
UNTIL @x >= p1 END REPEAT; UNTIL @x >= p1 END REPEAT;
END| END|
delimiter ;| delimiter ;|
--disable_query_log
--disable_result_log
call insert_many(100000); call insert_many(100000);
--enable_query_log
--enable_result_log
DROP PROCEDURE insert_many; DROP PROCEDURE insert_many;
# The bug is hangup at the following statement # The bug is hangup at the following statement

View File

@ -93,8 +93,9 @@ start slave;
drop table if exists t1; drop table if exists t1;
Warnings: Warnings:
Note 1051 Unknown table 't1' Note 1051 Unknown table 't1'
flush logs;
stop slave; stop slave;
flush logs;
flush logs;
reset slave; reset slave;
start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */; start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */;
show tables /* t1 must exist */; show tables /* t1 must exist */;

View File

@ -196,13 +196,18 @@ sync_with_master;
connection master; connection master;
drop table if exists t1; # there is create table t1 in bug47142_master-bin.000001 drop table if exists t1; # there is create table t1 in bug47142_master-bin.000001
sync_slave_with_master;
connection slave;
stop slave;
connection master;
flush logs; flush logs;
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/master-bin.000001 --remove_file $MYSQLD_DATADIR/master-bin.000001
--copy_file $MYSQL_TEST_DIR/std_data/bug47142_master-bin.000001 $MYSQLD_DATADIR/master-bin.000001 --copy_file $MYSQL_TEST_DIR/std_data/bug47142_master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
flush logs;
connection slave; connection slave;
stop slave;
reset slave; reset slave;
start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */; start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */;
--source include/wait_for_slave_sql_to_stop.inc --source include/wait_for_slave_sql_to_stop.inc

View File

@ -1,550 +0,0 @@
-- source include/have_innodb.inc
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak');
commit;
--error ER_DUP_KEYNAME
alter table t1 add index b (b), add index b (b);
--error ER_DUP_FIELDNAME
alter table t1 add index (b,b);
alter table t1 add index d2 (d);
show create table t1;
explain select * from t1 force index(d2) order by d;
select * from t1 force index (d2) order by d;
--error ER_DUP_ENTRY
alter table t1 add unique index (b);
show create table t1;
alter table t1 add index (b);
show create table t1;
# Check how existing tables interfere with temporary tables.
CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB;
call mtr.add_suppression(" table `test`\\.`t1#[12]` already exists in InnoDB internal");
--error 156
alter table t1 add unique index (c), add index (d);
rename table `t1#1` to `t1#2`;
--error 156
alter table t1 add unique index (c), add index (d);
drop table `t1#2`;
alter table t1 add unique index (c), add index (d);
show create table t1;
explain select * from t1 force index(c) order by c;
alter table t1 add primary key (a), drop index c;
show create table t1;
--error ER_MULTIPLE_PRI_KEY
alter table t1 add primary key (c);
--error ER_DUP_ENTRY
alter table t1 drop primary key, add primary key (b);
create unique index c on t1 (c);
show create table t1;
explain select * from t1 force index(c) order by c;
select * from t1 force index(c) order by c;
alter table t1 drop index b, add index (b);
show create table t1;
insert into t1 values(6,1,'ggg','ggg');
select * from t1;
select * from t1 force index(b) order by b;
select * from t1 force index(c) order by c;
select * from t1 force index(d) order by d;
explain select * from t1 force index(b) order by b;
explain select * from t1 force index(c) order by c;
explain select * from t1 force index(d) order by d;
show create table t1;
drop table t1;
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ad','ad'),(4,4,'afe','afe');
commit;
alter table t1 add index (c(2));
show create table t1;
alter table t1 add unique index (d(10));
show create table t1;
insert into t1 values(5,1,'ggg','ggg');
select * from t1;
select * from t1 force index(c) order by c;
select * from t1 force index(d) order by d;
explain select * from t1 order by b;
explain select * from t1 force index(c) order by c;
explain select * from t1 force index(d) order by d;
show create table t1;
alter table t1 drop index d;
insert into t1 values(8,9,'fff','fff');
select * from t1;
select * from t1 force index(c) order by c;
explain select * from t1 order by b;
explain select * from t1 force index(c) order by c;
explain select * from t1 order by d;
show create table t1;
drop table t1;
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe');
commit;
alter table t1 add unique index (b,c);
insert into t1 values(8,9,'fff','fff');
select * from t1;
select * from t1 force index(b) order by b;
explain select * from t1 force index(b) order by b;
show create table t1;
alter table t1 add index (b,c);
insert into t1 values(11,11,'kkk','kkk');
select * from t1;
select * from t1 force index(b) order by b;
explain select * from t1 force index(b) order by b;
show create table t1;
alter table t1 add unique index (c,d);
insert into t1 values(13,13,'yyy','aaa');
select * from t1;
select * from t1 force index(b) order by b;
select * from t1 force index(c) order by c;
explain select * from t1 force index(b) order by b;
explain select * from t1 force index(c) order by c;
show create table t1;
drop table t1;
create table t1(a int not null, b int not null, c int, primary key (a), key (b)) engine = innodb;
create table t3(a int not null, c int not null, d int, primary key (a), key (c)) engine = innodb;
create table t4(a int not null, d int not null, e int, primary key (a), key (d)) engine = innodb;
create table t2(a int not null, b int not null, c int not null, d int not null, e int,
foreign key (b) references t1(b) on delete cascade,
foreign key (c) references t3(c), foreign key (d) references t4(d))
engine = innodb;
--error ER_DROP_INDEX_FK
alter table t1 drop index b;
--error ER_DROP_INDEX_FK
alter table t3 drop index c;
--error ER_DROP_INDEX_FK
alter table t4 drop index d;
--error ER_DROP_INDEX_FK
alter table t2 drop index b;
--error ER_DROP_INDEX_FK
alter table t2 drop index b, drop index c, drop index d;
# Apparently, the following makes mysql_alter_table() drop index d.
create unique index dc on t2 (d,c);
create index dc on t1 (b,c);
# This should preserve the foreign key constraints.
alter table t2 add primary key (a);
insert into t1 values (1,1,1);
insert into t3 values (1,1,1);
insert into t4 values (1,1,1);
insert into t2 values (1,1,1,1,1);
commit;
alter table t4 add constraint dc foreign key (a) references t1(a);
show create table t4;
--replace_regex /'test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
# a foreign key 'test/dc' already exists
--error ER_CANT_CREATE_TABLE
alter table t3 add constraint dc foreign key (a) references t1(a);
show create table t3;
alter table t2 drop index b, add index (b);
show create table t2;
--error ER_ROW_IS_REFERENCED_2
delete from t1;
--error ER_CANT_DROP_FIELD_OR_KEY
drop index dc on t4;
# there is no foreign key dc on t3
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--replace_regex /\/test\/#sql2-[0-9a-f-]*'/\/#sql2-temporary'/
--error ER_ERROR_ON_RENAME
alter table t3 drop foreign key dc;
alter table t4 drop foreign key dc;
select * from t2;
delete from t1;
select * from t2;
drop table t2,t4,t3,t1;
-- let charset = utf8
-- source include/innodb-index.inc
create table t1(a int not null, b int) engine = innodb;
insert into t1 values (1,1),(1,1),(1,1),(1,1);
--error ER_DUP_ENTRY
alter table t1 add unique index (a);
--error ER_DUP_ENTRY
alter table t1 add unique index (b);
--error ER_DUP_ENTRY
alter table t1 add unique index (a), add unique index(b);
show create table t1;
drop table t1;
create table t1(a int not null, c int not null,b int, primary key(a), unique key(c), key(b)) engine = innodb;
alter table t1 drop index c, drop index b;
show create table t1;
drop table t1;
create table t1(a int not null, b int, primary key(a)) engine = innodb;
alter table t1 add index (b);
show create table t1;
drop table t1;
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
--error ER_DUP_ENTRY
alter table t1 add unique index (b), add unique index (c), add unique index (d);
--error ER_DUP_ENTRY
alter table t1 add unique index (c), add unique index (b), add index (d);
show create table t1;
drop table t1;
create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb;
insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1);
alter table t1 add unique index (b);
insert into t1 values (10,20,20),(11,19,19),(12,18,18),(13,17,17);
show create table t1;
check table t1;
explain select * from t1 force index(c) order by c;
explain select * from t1 order by a;
explain select * from t1 force index(b) order by b;
select * from t1 order by a;
select * from t1 force index(b) order by b;
select * from t1 force index(c) order by c;
drop table t1;
create table t1(a int not null, b int not null) engine=innodb;
insert into t1 values (1,1);
alter table t1 add primary key(b);
insert into t1 values (2,2);
show create table t1;
check table t1;
select * from t1;
explain select * from t1;
explain select * from t1 order by a;
explain select * from t1 order by b;
checksum table t1;
drop table t1;
create table t1(a int not null) engine=innodb;
insert into t1 values (1);
alter table t1 add primary key(a);
insert into t1 values (2);
show create table t1;
check table t1;
commit;
select * from t1;
explain select * from t1;
explain select * from t1 order by a;
drop table t1;
create table t2(d varchar(17) primary key) engine=innodb default charset=utf8;
create table t3(a int primary key) engine=innodb;
insert into t3 values(22),(44),(33),(55),(66);
insert into t2 values ('jejdkrun87'),('adfd72nh9k'),
('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik');
create table t1(a int, b blob, c text, d text not null)
engine=innodb default charset = utf8;
# r2667 The following test is disabled because MySQL behavior changed.
# r2667 The test was added with this comment:
# r2667
# r2667 ------------------------------------------------------------------------
# r2667 r1699 | marko | 2007-08-10 19:53:19 +0300 (Fri, 10 Aug 2007) | 5 lines
# r2667
# r2667 branches/zip: Add changes that accidentally omitted from r1698:
# r2667
# r2667 innodb-index.test, innodb-index.result: Add a test for creating
# r2667 a PRIMARY KEY on a column that contains a NULL value.
# r2667 ------------------------------------------------------------------------
# r2667
# r2667 but in BZR-r2667:
# r2667 http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1/revision/davi%40mysql.com-20080617141221-8yre8ys9j4uw3xx5?start_revid=joerg%40mysql.com-20080630105418-7qoe5ehomgrcdb89
# r2667 MySQL changed the behavior to do full table copy when creating PRIMARY INDEX
# r2667 on a non-NULL column instead of calling ::add_index() which would fail (and
# r2667 this is what we were testing here). Before r2667 the code execution path was
# r2667 like this (when adding PRIMARY INDEX on a non-NULL column with ALTER TABLE):
# r2667
# r2667 mysql_alter_table()
# r2667 compare_tables() // would return ALTER_TABLE_INDEX_CHANGED
# r2667 ::add_index() // would fail with "primary index cannot contain NULL"
# r2667
# r2667 after r2667 the code execution path is the following:
# r2667
# r2667 mysql_alter_table()
# r2667 compare_tables() // returns ALTER_TABLE_DATA_CHANGED
# r2667 full copy is done, without calling ::add_index()
# r2667
# r2667 To enable, remove "# r2667: " below.
# r2667
# r2667: insert into t1 values (null,null,null,'null');
insert into t1
select a,left(repeat(d,100*a),65535),repeat(d,20*a),d from t2,t3;
drop table t2, t3;
select count(*) from t1 where a=44;
select a,
length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1;
# r2667: --error ER_PRIMARY_CANT_HAVE_NULL
# r2667: alter table t1 add primary key (a), add key (b(20));
# r2667: delete from t1 where d='null';
--error ER_DUP_ENTRY
alter table t1 add primary key (a), add key (b(20));
delete from t1 where a%2;
check table t1;
alter table t1 add primary key (a,b(255),c(255)), add key (b(767));
select count(*) from t1 where a=44;
select a,
length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1;
show create table t1;
check table t1;
explain select * from t1 where b like 'adfd%';
#
# Test locking
#
create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
insert into t2 select a,left(b,255) from t1;
drop table t1;
rename table t2 to t1;
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
set innodb_lock_wait_timeout=1;
begin;
# Obtain an IX lock on the table
select a from t1 limit 1 for update;
connection b;
set innodb_lock_wait_timeout=1;
# This would require an S lock on the table, conflicting with the IX lock.
--error ER_LOCK_WAIT_TIMEOUT
create index t1ba on t1 (b,a);
connection a;
commit;
begin;
# Obtain an IS lock on the table
select a from t1 limit 1 lock in share mode;
connection b;
# This will require an S lock on the table. No conflict with the IS lock.
create index t1ba on t1 (b,a);
# This would require an X lock on the table, conflicting with the IS lock.
--error ER_LOCK_WAIT_TIMEOUT
drop index t1ba on t1;
connection a;
commit;
explain select a from t1 order by b;
--send
select a,sleep(2+a/100) from t1 order by b limit 3;
# The following DROP INDEX will succeed, altough the SELECT above has
# opened a read view. However, during the execution of the SELECT,
# MySQL should hold a table lock that should block the execution
# of the DROP INDEX below.
connection b;
select sleep(1);
drop index t1ba on t1;
# After the index was dropped, subsequent SELECTs will use the same
# read view, but they should not be accessing the dropped index any more.
connection a;
reap;
explain select a from t1 order by b;
select a from t1 order by b limit 3;
commit;
connection default;
disconnect a;
disconnect b;
drop table t1;
let $per_table=`select @@innodb_file_per_table`;
let $format=`select @@innodb_file_format`;
set global innodb_file_per_table=on;
set global innodb_file_format='Barracuda';
# Test creating a table that could lead to undo log overflow.
# In the undo log, we write a 768-byte prefix (REC_MAX_INDEX_COL_LEN)
# of each externally stored column that appears as a column prefix in an index.
# For this test case, it would suffice to write 1 byte, though.
create table t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob,
q blob,r blob,s blob,t blob,u blob)
engine=innodb row_format=dynamic;
create index t1a on t1 (a(1));
create index t1b on t1 (b(1));
create index t1c on t1 (c(1));
create index t1d on t1 (d(1));
create index t1e on t1 (e(1));
create index t1f on t1 (f(1));
create index t1g on t1 (g(1));
create index t1h on t1 (h(1));
create index t1i on t1 (i(1));
create index t1j on t1 (j(1));
create index t1k on t1 (k(1));
create index t1l on t1 (l(1));
create index t1m on t1 (m(1));
create index t1n on t1 (n(1));
create index t1o on t1 (o(1));
create index t1p on t1 (p(1));
create index t1q on t1 (q(1));
create index t1r on t1 (r(1));
create index t1s on t1 (s(1));
create index t1t on t1 (t(1));
--error 139
create index t1u on t1 (u(1));
--error 139
create index t1ut on t1 (u(1), t(1));
create index t1st on t1 (s(1), t(1));
show create table t1;
--error 139
create index t1u on t1 (u(1));
alter table t1 row_format=compact;
create index t1u on t1 (u(1));
drop table t1;
eval set global innodb_file_per_table=$per_table;
eval set global innodb_file_format=$format;
eval set global innodb_file_format_check=$format;
#
# Test to check whether CREATE INDEX handles implicit foreign key
# constraint modifications (Issue #70, Bug #38786)
#
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
CREATE TABLE t1(
c1 BIGINT(12) NOT NULL,
PRIMARY KEY (c1)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE t2(
c1 BIGINT(16) NOT NULL,
c2 BIGINT(12) NOT NULL,
c3 BIGINT(12) NOT NULL,
PRIMARY KEY (c1)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3) REFERENCES t1(c1);
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
SHOW CREATE TABLE t2;
CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
SHOW CREATE TABLE t2;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
--error ER_NO_REFERENCED_ROW_2
INSERT INTO t2 VALUES(0,0,0);
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(0,0,0);
DROP TABLE t2;
CREATE TABLE t2(
c1 BIGINT(16) NOT NULL,
c2 BIGINT(12) NOT NULL,
c3 BIGINT(12) NOT NULL,
PRIMARY KEY (c1,c2,c3)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3) REFERENCES t1(c1);
SHOW CREATE TABLE t2;
CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
SHOW CREATE TABLE t2;
--error ER_NO_REFERENCED_ROW_2
INSERT INTO t2 VALUES(0,0,1);
INSERT INTO t2 VALUES(0,0,0);
--error ER_ROW_IS_REFERENCED_2
DELETE FROM t1;
DELETE FROM t2;
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1(
c1 BIGINT(12) NOT NULL,
c2 INT(4) NOT NULL,
PRIMARY KEY (c2,c1)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE t2(
c1 BIGINT(16) NOT NULL,
c2 BIGINT(12) NOT NULL,
c3 BIGINT(12) NOT NULL,
PRIMARY KEY (c1)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1);
--replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
--replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL;
--replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
CREATE INDEX i_t2_c2_c1 ON t2(c2, c1);
SHOW CREATE TABLE t2;
CREATE INDEX i_t2_c3_c1_c2 ON t2(c3, c1, c2);
SHOW CREATE TABLE t2;
CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
SHOW CREATE TABLE t2;
DROP TABLE t2;
DROP TABLE t1;
call mtr.add_suppression("InnoDB: insufficient history for index");
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
connection b;
BEGIN;
SELECT * FROM t1;
connection a;
CREATE INDEX t1a ON t1(a);
connection b;
SELECT * FROM t1;
--error ER_TABLE_DEF_CHANGED
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
SELECT * FROM t1;
COMMIT;
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
connection default;
disconnect a;
disconnect b;
DROP TABLE t1;
#
# restore environment to the state it was before this test execution
#
-- disable_query_log
eval SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig;

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