+extern struct st_mysql_plugin i_s_innodb_admin_command;
#endif /* i_s_h */
+--- /dev/null
++++ b/mysql-test/r/percona_xtradb_admin_command.result
+@@ -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!
+--- /dev/null
++++ b/mysql-test/t/percona_xtradb_admin_command.test
+@@ -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*/;
MYSQL_SYSVAR(checksums),
MYSQL_SYSVAR(fast_checksum),
MYSQL_SYSVAR(commit_concurrency),
+--- /dev/null
++++ b/mysql-test/r/percona_innodb_buffer_pool_shm.result
+@@ -0,0 +1,4 @@
++show variables like 'innodb_buffer_pool_shm%';
++Variable_name Value
++innodb_buffer_pool_shm_checksum ON
++innodb_buffer_pool_shm_key 123456
+--- /dev/null
++++ b/mysql-test/t/percona_innodb_buffer_pool_shm-master.opt
+@@ -0,0 +1 @@
++--innodb_buffer_pool_shm_key=123456
+--- /dev/null
++++ b/mysql-test/t/percona_innodb_buffer_pool_shm.test
+@@ -0,0 +1,2 @@
++--source include/have_innodb.inc
++show variables like 'innodb_buffer_pool_shm%';
#ifdef UNIV_DEBUG
export_vars.innodb_buffer_pool_pages_latched
= buf_get_latched_pages_number();
+--- /dev/null
++++ b/mysql-test/r/percona_innodb_deadlock_count.result
+@@ -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;
++# Switch to connection con2
++BEGIN;
++SELECT b FROM t WHERE a=2 FOR UPDATE;
++# 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 con1
++ROLLBACK;
++# Switch to connection con2
++ROLLBACK;
++# Switch to connection con3
++Deadlocks: 1
++# Drop test table
++drop table t;
+--- /dev/null
++++ b/mysql-test/t/percona_innodb_deadlock_count.test
+@@ -0,0 +1,61 @@
++--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
++
++--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'`;
++
++--disable_result_log
++
++--echo # Switch to connection con1
++connection con1;
++BEGIN; SELECT b FROM t WHERE a=1 FOR UPDATE;
++
++--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;
++
++--echo # Switch to connection con1
++connection con1;
++--error 0, ER_LOCK_DEADLOCK
++reap;
++ROLLBACK;
++
++--echo # Switch to connection con2
++connection con2;
++--error 0, ER_LOCK_DEADLOCK
++reap;
++ROLLBACK;
++
++--echo # Switch to connection con3
++connection con3;
++let $result = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_deadlocks'`;
++
++--enable_result_log
++
++let $diff = `SELECT $result - $current`;
++echo Deadlocks: $diff;
++--echo # Drop test table
++drop table t;
/*********************************************************************
Creates the rollback segments */
UNIV_INTERN
+--- /dev/null
++++ b/mysql-test/r/percona_innodb_doublewrite_file.result
+@@ -0,0 +1,4 @@
++show variables like 'innodb_doublewrite%';
++Variable_name Value
++innodb_doublewrite ON
++innodb_doublewrite_file ib_doublewrite
+--- /dev/null
++++ b/mysql-test/t/percona_innodb_doublewrite_file-master.opt
+@@ -0,0 +1 @@
++--innodb_doublewrite_file=ib_doublewrite
+--- /dev/null
++++ b/mysql-test/t/percona_innodb_doublewrite_file.test
+@@ -0,0 +1,2 @@
++--source include/have_innodb.inc
++show variables like 'innodb_doublewrite%';
extern struct st_mysql_plugin i_s_innodb_rseg;
#endif /* i_s_h */
+--- /dev/null
++++ b/mysql-test/r/percona_innodb_use_sys_stats_table.result
+@@ -0,0 +1,3 @@
++show variables like 'innodb_use_sys_stats%';
++Variable_name Value
++innodb_use_sys_stats_table ON
+--- /dev/null
++++ b/mysql-test/t/percona_innodb_use_sys_stats_table-master.opt
+@@ -0,0 +1 @@
++--innodb_use_sys_stats_table
+--- /dev/null
++++ b/mysql-test/t/percona_innodb_use_sys_stats_table.test
+@@ -0,0 +1,2 @@
++--source include/have_innodb.inc
++show variables like 'innodb_use_sys_stats%';
close_connection(thd, ER_OUT_OF_RESOURCES);
errmsg= 0;
goto errorconn;
+--- /dev/null
++++ b/mysql-test/r/percona_log_connection_error.result
+@@ -0,0 +1,16 @@
++SET @old_max_connections = @@max_connections;
++SET @old_log_warnings = @@log_warnings;
++SET GLOBAL max_connections=2;
++SET GLOBAL LOG_WARNINGS = 0;
++connect(localhost,root,,test,port,socket);
++ERROR HY000: Too many connections
++SET GLOBAL LOG_WARNINGS = 1;
++connect(localhost,root,,test,port,socket);
++ERROR HY000: Too many connections
++SET GLOBAL LOG_WARNINGS = 0;
++connect(localhost,root,,test,port,socket);
++ERROR HY000: Too many connections
++SET GLOBAL max_connections = @old_max_connections;
++SET GLOBAL log_warnings = @old_log_warnings;
++[log_grep.inc] file: percona.log_connection_error.err pattern: Too many connections
++[log_grep.inc] lines: 1
+--- /dev/null
++++ b/mysql-test/t/percona_log_connection_error-master.opt
+@@ -0,0 +1 @@
++--log-error
+--- /dev/null
++++ b/mysql-test/t/percona_log_connection_error.test
+@@ -0,0 +1,54 @@
++--source include/not_embedded.inc
++
++connect (main,localhost,root,,);
++connection main;
++SET @old_max_connections = @@max_connections;
++SET @old_log_warnings = @@log_warnings;
++SET GLOBAL max_connections=2;
++let $port=`SELECT Variable_value FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE Variable_name LIKE 'port'`;
++let $socket=`SELECT Variable_value FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE Variable_name LIKE 'socket'`;
++
++SET GLOBAL LOG_WARNINGS = 0;
++--connect (conn0,localhost,root,,)
++connection conn0;
++replace_result $port port $socket socket;
++--error 1040
++--connect(conn1,localhost,root,,)
++disconnect conn0;
++SLEEP 0.1; # tsarev: hack, but i don't know (and didn't find) how right
++
++connection main;
++SET GLOBAL LOG_WARNINGS = 1;
++--connect (conn1,localhost,root,,)
++replace_result $port port $socket socket;
++--error 1040
++--connect (conn0,localhost,root,,)
++disconnect conn1;
++SLEEP 0.1; # tsarev: hack, but i don't know (and didn't find) how right
++
++connection main;
++SET GLOBAL LOG_WARNINGS = 0;
++--connect (conn0,localhost,root,,)
++replace_result $port port $socket socket;
++--error 1040
++--connect(conn1,localhost,root,,)
++disconnect conn0;
++SLEEP 0.1; # tsarev: hack, but i don't know (and didn't find) how right
++
++connection main;
++SET GLOBAL max_connections = @old_max_connections;
++SET GLOBAL log_warnings = @old_log_warnings;
++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;
++}
++
++--let log_error=$log_error_
++--let log_file=percona.log_connection_error.err
++--let log_file_full_path=$log_error
++--let grep_pattern= Too many connections
++--source include/log_grep.inc
++
static Sys_var_ulong Sys_preload_buff_size(
"preload_buffer_size",
"The size of the buffer that is allocated when preloading indexes",
+--- /dev/null
++++ b/mysql-test/r/percona_log_warnings_suppress.result
+@@ -0,0 +1,31 @@
++SET @old_log_warnings = @@log_warnings;
++SET @old_log_warnings_suppress = @@log_warnings_suppress;
++DROP TABLE IF EXISTS t1;
++CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
++SET GLOBAL log_warnings_suppress='';
++SET GLOBAL LOG_WARNINGS=0;
++SHOW GLOBAL VARIABLES LIKE 'log_warnings_suppress';
++Variable_name Value
++log_warnings_suppress
++INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
++Warnings:
++Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
++SET GLOBAL LOG_WARNINGS=1;
++INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
++Warnings:
++Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
++SET GLOBAL log_warnings_suppress='1592';
++SET GLOBAL LOG_WARNINGS=0;
++INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
++Warnings:
++Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
++SET GLOBAL LOG_WARNINGS=1;
++INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
++Warnings:
++Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
++DROP TABLE t1;
++SET GLOBAL log_warnings = @old_log_warnings;
++SET GLOBAL log_warnings_suppress = @old_log_warnings_suppress;
++# Count the number of times the "Unsafe" message was printed
++# to the error log.
++Occurrences: 1
+--- /dev/null
++++ b/mysql-test/t/percona_log_warnings_suppress-master.opt
+@@ -0,0 +1 @@
++--log-error
+--- /dev/null
++++ b/mysql-test/t/percona_log_warnings_suppress.test
+@@ -0,0 +1,47 @@
++-- source include/have_log_bin.inc
++-- source include/have_binlog_format_statement.inc
++
++SET @old_log_warnings = @@log_warnings;
++SET @old_log_warnings_suppress = @@log_warnings_suppress;
++
++--disable_warnings
++DROP TABLE IF EXISTS t1;
++--enable_warnings
++CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
++SET GLOBAL log_warnings_suppress='';
++SET GLOBAL LOG_WARNINGS=0;
++SHOW GLOBAL VARIABLES LIKE 'log_warnings_suppress';
++INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
++SET GLOBAL LOG_WARNINGS=1;
++INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
++SET GLOBAL log_warnings_suppress='1592';
++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 log_warnings_suppress = @old_log_warnings_suppress;
++
++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
+
DBUG_RETURN(my_errno);
} /* heap_update */
+--- /dev/null
++++ b/mysql-test/r/percona_heap_blob.result
+@@ -0,0 +1,952 @@
++SET @old_default_storage_engine=@@default_storage_engine;
++SET default_storage_engine=MEMORY;
++drop table if exists t1,t2,t3,t4,t5,t6,t7;
++CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
++show columns from t1;
++Field Type Null Key Default Extra
++a blob YES NULL
++b text YES NULL
++c tinyblob YES NULL
++d mediumtext YES NULL
++e longtext YES NULL
++CREATE TABLE t2 (a char(255), b varbinary(70000), c varchar(70000000));
++Warnings:
++Note 1246 Converting column 'b' from VARBINARY to BLOB
++Note 1246 Converting column 'c' from VARCHAR to TEXT
++CREATE TABLE t4 (c varchar(65530) character set utf8 not null);
++Warnings:
++Note 1246 Converting column 'c' from VARCHAR to TEXT
++show columns from t2;
++Field Type Null Key Default Extra
++a char(255) YES NULL
++b mediumblob YES NULL
++c longtext YES NULL
++create table t3 (a long, b long byte);
++show create TABLE t3;
++Table Create Table
++t3 CREATE TABLE `t3` (
++ `a` mediumtext,
++ `b` mediumblob
++) ENGINE=MEMORY DEFAULT CHARSET=latin1
++show create TABLE t4;
++Table Create Table
++t4 CREATE TABLE `t4` (
++ `c` mediumtext CHARACTER SET utf8 NOT NULL
++) ENGINE=MEMORY DEFAULT CHARSET=latin1
++drop table t1,t2,t3,t4;
++CREATE TABLE t1 (a char(257) default "hello");
++ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
++CREATE TABLE t2 (a char(256));
++ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
++CREATE TABLE t1 (a varchar(70000) default "hello");
++ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead
++CREATE TABLE t2 (a blob default "hello");
++ERROR 42000: BLOB/TEXT column 'a' can't have a default value
++drop table if exists t1,t2;
++create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
++insert into t1 values (null,"a","A");
++insert into t1 values (null,"bbb","BBB");
++insert into t1 values (null,"ccc","CCC");
++select last_insert_id();
++last_insert_id()
++3
++select * from t1,t1 as t2;
++nr b str nr b str
++1 a A 1 a A
++2 bbb BBB 1 a A
++3 ccc CCC 1 a A
++1 a A 2 bbb BBB
++2 bbb BBB 2 bbb BBB
++3 ccc CCC 2 bbb BBB
++1 a A 3 ccc CCC
++2 bbb BBB 3 ccc CCC
++3 ccc CCC 3 ccc CCC
++drop table t1;
++create table t1 (a text);
++insert into t1 values ('where');
++update t1 set a='Where';
++select * from t1;
++a
++Where
++drop table t1;
++create table t1 (t text,c char(10),b blob, d varbinary(10));
++insert into t1 values (NULL,NULL,NULL,NULL);
++insert into t1 values ("","","","");
++insert into t1 values ("hello","hello","hello","hello");
++insert into t1 values ("HELLO","HELLO","HELLO","HELLO");
++insert into t1 values ("HELLO MY","HELLO MY","HELLO MY","HELLO MY");
++insert into t1 values ("a","a","a","a");
++insert into t1 values (1,1,1,1);
++insert into t1 values (NULL,NULL,NULL,NULL);
++update t1 set c="",b=null where c="1";
++lock tables t1 READ;
++show full fields from t1;
++Field Type Collation Null Key Default Extra Privileges Comment
++t text latin1_swedish_ci YES NULL #
++c char(10) latin1_swedish_ci YES NULL #
++b blob NULL YES NULL #
++d varbinary(10) NULL YES NULL #
++lock tables t1 WRITE;
++show full fields from t1;
++Field Type Collation Null Key Default Extra Privileges Comment
++t text latin1_swedish_ci YES NULL #
++c char(10) latin1_swedish_ci YES NULL #
++b blob NULL YES NULL #
++d varbinary(10) NULL YES NULL #
++unlock tables;
++select t from t1 where t like "hello";
++t
++hello
++HELLO
++select c from t1 where c like "hello";
++c
++hello
++HELLO
++select b from t1 where b like "hello";
++b
++hello
++select d from t1 where d like "hello";
++d
++hello
++select c from t1 having c like "hello";
++c
++hello
++HELLO
++select d from t1 having d like "hello";
++d
++hello
++select t from t1 where t like "%HELLO%";
++t
++hello
++HELLO
++HELLO MY
++select c from t1 where c like "%HELLO%";
++c
++hello
++HELLO
++HELLO MY
++select b from t1 where b like "%HELLO%";
++b
++HELLO
++HELLO MY
++select d from t1 where d like "%HELLO%";
++d
++HELLO
++HELLO MY
++select c from t1 having c like "%HELLO%";
++c
++hello
++HELLO
++HELLO MY
++select d from t1 having d like "%HELLO%";
++d
++HELLO
++HELLO MY
++select d from t1 having d like "%HE%LLO%";
++d
++HELLO
++HELLO MY
++select t from t1 order by t;
++t
++NULL
++NULL
++
++1
++a
++hello
++HELLO
++HELLO MY
++select c from t1 order by c;
++c
++NULL
++NULL
++
++
++a
++hello
++HELLO
++HELLO MY
++select b from t1 order by b;
++b
++NULL
++NULL
++NULL
++
++HELLO
++HELLO MY
++a
++hello
++select d from t1 order by d;
++d
++NULL
++NULL
++
++1
++HELLO
++HELLO MY
++a
++hello
++select distinct t from t1;
++t
++NULL
++
++hello
++HELLO MY
++a
++1
++select distinct b from t1;
++b
++NULL
++
++hello
++HELLO
++HELLO MY
++a
++select distinct t from t1 order by t;
++t
++NULL
++
++1
++a
++hello
++HELLO MY
++select distinct b from t1 order by b;
++b
++NULL
++
++HELLO
++HELLO MY
++a
++hello
++select t from t1 group by t;
++t
++NULL
++
++1
++a
++hello
++HELLO MY
++select b from t1 group by b;
++b
++NULL
++
++HELLO
++HELLO MY
++a
++hello
++set option sql_big_tables=1;
++select distinct t from t1;
++t
++NULL
++
++hello
++HELLO MY
++a
++1
++select distinct b from t1;
++b
++NULL
++
++hello
++HELLO
++HELLO MY
++a
++select distinct t from t1 order by t;
++t
++NULL
++
++1
++a
++hello
++HELLO MY
++select distinct b from t1 order by b;
++b
++NULL
++
++HELLO
++HELLO MY
++a
++hello
++select distinct c from t1;
++c
++NULL
++
++hello
++HELLO MY
++a
++select distinct d from t1;
++d
++NULL
++
++hello
++HELLO
++HELLO MY
++a
++1
++select distinct c from t1 order by c;
++c
++NULL
++
++a
++hello
++HELLO MY
++select distinct d from t1 order by d;
++d
++NULL
++
++1
++HELLO
++HELLO MY
++a
++hello
++select c from t1 group by c;
++c
++NULL
++
++a
++hello
++HELLO MY
++select d from t1 group by d;
++d
++NULL
++
++1
++HELLO
++HELLO MY
++a
++hello
++set option sql_big_tables=0;
++select distinct * from t1;
++t c b d
++NULL NULL NULL NULL
++
++hello hello hello hello
++HELLO HELLO HELLO HELLO
++HELLO MY HELLO MY HELLO MY HELLO MY
++a a a a
++1 NULL 1
++select t,count(*) from t1 group by t;
++t count(*)
++NULL 2
++ 1
++1 1
++a 1
++hello 2
++HELLO MY 1
++select b,count(*) from t1 group by b;
++b count(*)
++NULL 3
++ 1
++HELLO 1
++HELLO MY 1
++a 1
++hello 1
++select c,count(*) from t1 group by c;
++c count(*)
++NULL 2
++ 2
++a 1
++hello 2
++HELLO MY 1
++select d,count(*) from t1 group by d;
++d count(*)
++NULL 2
++ 1
++1 1
++HELLO 1
++HELLO MY 1
++a 1
++hello 1
++drop table t1;
++CREATE TABLE t1 (
++t1_id bigint(21) NOT NULL auto_increment,
++_field_72 varchar(128) DEFAULT '' NOT NULL,
++_field_95 varchar(32),
++_field_115 tinyint(4) DEFAULT '0' NOT NULL,
++_field_122 tinyint(4) DEFAULT '0' NOT NULL,
++_field_126 tinyint(4),
++_field_134 tinyint(4),
++PRIMARY KEY (t1_id),
++UNIQUE _field_72 (_field_72),
++KEY _field_115 (_field_115),
++KEY _field_122 (_field_122)
++);
++INSERT INTO t1 VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',0,1,NULL,NULL);
++INSERT INTO t1 VALUES (2,'hroberts','7415275a8c95952901e42b13a6b78566',0,1,NULL,NULL);
++INSERT INTO t1 VALUES (3,'guest','d41d8cd98f00b204e9800998ecf8427e',1,0,NULL,NULL);
++CREATE TABLE t2 (
++seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++PRIMARY KEY (seq_0_id,seq_1_id)
++);
++INSERT INTO t2 VALUES (1,1);
++INSERT INTO t2 VALUES (2,1);
++INSERT INTO t2 VALUES (2,2);
++CREATE TABLE t3 (
++t3_id bigint(21) NOT NULL auto_increment,
++_field_131 varchar(128),
++_field_133 tinyint(4) DEFAULT '0' NOT NULL,
++_field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
++_field_137 tinyint(4),
++_field_139 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
++_field_140 blob,
++_field_142 tinyint(4) DEFAULT '0' NOT NULL,
++_field_145 tinyint(4) DEFAULT '0' NOT NULL,
++_field_148 tinyint(4) DEFAULT '0' NOT NULL,
++PRIMARY KEY (t3_id),
++KEY _field_133 (_field_133),
++KEY _field_135 (_field_135),
++KEY _field_139 (_field_139),
++KEY _field_142 (_field_142),
++KEY _field_145 (_field_145),
++KEY _field_148 (_field_148)
++);
++INSERT INTO t3 VALUES (1,'test job 1',0,'0000-00-00 00:00:00',0,'1999-02-25 22:43:32','test\r\njob\r\n1',0,0,0);
++INSERT INTO t3 VALUES (2,'test job 2',0,'0000-00-00 00:00:00',0,'1999-02-26 21:08:04','',0,0,0);
++CREATE TABLE t4 (
++seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++PRIMARY KEY (seq_0_id,seq_1_id)
++);
++INSERT INTO t4 VALUES (1,1);
++INSERT INTO t4 VALUES (2,1);
++CREATE TABLE t5 (
++t5_id bigint(21) NOT NULL auto_increment,
++_field_149 tinyint(4),
++_field_156 varchar(128) DEFAULT '' NOT NULL,
++_field_157 varchar(128) DEFAULT '' NOT NULL,
++_field_158 varchar(128) DEFAULT '' NOT NULL,
++_field_159 varchar(128) DEFAULT '' NOT NULL,
++_field_160 varchar(128) DEFAULT '' NOT NULL,
++_field_161 varchar(128) DEFAULT '' NOT NULL,
++PRIMARY KEY (t5_id),
++KEY _field_156 (_field_156),
++KEY _field_157 (_field_157),
++KEY _field_158 (_field_158),
++KEY _field_159 (_field_159),
++KEY _field_160 (_field_160),
++KEY _field_161 (_field_161)
++);
++INSERT INTO t5 VALUES (1,0,'tomato','','','','','');
++INSERT INTO t5 VALUES (2,0,'cilantro','','','','','');
++CREATE TABLE t6 (
++seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++PRIMARY KEY (seq_0_id,seq_1_id)
++);
++INSERT INTO t6 VALUES (1,1);
++INSERT INTO t6 VALUES (1,2);
++INSERT INTO t6 VALUES (2,2);
++CREATE TABLE t7 (
++t7_id bigint(21) NOT NULL auto_increment,
++_field_143 tinyint(4),
++_field_165 varchar(32),
++_field_166 smallint(6) DEFAULT '0' NOT NULL,
++PRIMARY KEY (t7_id),
++KEY _field_166 (_field_166)
++);
++INSERT INTO t7 VALUES (1,0,'High',1);
++INSERT INTO t7 VALUES (2,0,'Medium',2);
++INSERT INTO t7 VALUES (3,0,'Low',3);
++select replace(t3._field_140, "\r","^M"),t3_id,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), replace(min(t3._field_140), "\r","^M"),t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156;
++replace(t3._field_140, "\r","^M") t3_id min(t3._field_131) min(t3._field_135) min(t3._field_139) min(t3._field_137) min(link_alias_142._field_165) min(link_alias_133._field_72) min(t3._field_145) min(link_alias_148._field_156) replace(min(t3._field_140), "\r","^M") t3_id
++test^M
++job^M
++1 1 test job 1 0000-00-00 00:00:00 1999-02-25 22:43:32 0 High admin 0 tomato test^M
++job^M
++1 1
++drop table t1,t2,t3,t4,t5,t6,t7;
++create table t1 (a blob);
++insert into t1 values ("empty"),("");
++select a,reverse(a) from t1;
++a reverse(a)
++empty ytpme
++
++drop table t1;
++create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default '');
++Warnings:
++Warning 1101 BLOB/TEXT column 'imagem' can't have a default value
++insert into t1 (id) values (1);
++select
++charset(load_file('../../std_data/words.dat')),
++collation(load_file('../../std_data/words.dat')),
++coercibility(load_file('../../std_data/words.dat'));
++charset(load_file('../../std_data/words.dat')) collation(load_file('../../std_data/words.dat')) coercibility(load_file('../../std_data/words.dat'))
++binary binary 4
++explain extended select
++charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')),
++collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')),
++coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat'));
++id select_type table type possible_keys key key_len ref rows filtered Extra
++1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
++Warnings:
++Note 1003 select charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`
++update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data/words.dat') where id=1;
++select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
++if(imagem is null, "ERROR", "OK") length(imagem)
++OK 581
++drop table t1;
++create table t1 select load_file('MYSQLTEST_VARDIR/std_data/words.dat') l;
++show full fields from t1;
++Field Type Collation Null Key Default Extra Privileges Comment
++l longblob NULL YES NULL #
++drop table t1;
++create table t1 (id integer primary key auto_increment, txt text not null);
++insert into t1 (txt) values ('Chevy ');
++select * from t1 where txt='Chevy';
++id txt
++1 Chevy
++select * from t1 where txt='Chevy ';
++id txt
++1 Chevy
++select * from t1 where txt='Chevy ' or txt='Chevy';
++id txt
++1 Chevy
++select * from t1 where txt='Chevy' or txt='Chevy ';
++id txt
++1 Chevy
++select * from t1 where id='1' or id='2';
++id txt
++1 Chevy
++insert into t1 (txt) values('Ford');
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
++id txt
++1 Chevy
++2 Ford
++select * from t1 where txt='Chevy' or txt='Chevy ';
++id txt
++1 Chevy
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
++id txt
++1 Chevy
++select * from t1 where txt in ('Chevy ','Chevy');
++id txt
++1 Chevy
++select * from t1 where txt in ('Chevy');
++id txt
++1 Chevy
++select * from t1 where txt between 'Chevy' and 'Chevy';
++id txt
++1 Chevy
++select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
++id txt
++1 Chevy
++select * from t1 where txt between 'Chevy' and 'Chevy ';
++id txt
++1 Chevy
++select * from t1 where txt < 'Chevy ';
++id txt
++select * from t1 where txt <= 'Chevy';
++id txt
++1 Chevy
++select * from t1 where txt > 'Chevy';
++id txt
++2 Ford
++select * from t1 where txt >= 'Chevy';
++id txt
++1 Chevy
++2 Ford
++drop table t1;
++create table t1 (id integer primary key auto_increment, txt text);
++insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
++select * from t1 where txt='Chevy' or txt is NULL;
++id txt
++1 Chevy
++2 Chevy
++3 NULL
++explain select * from t1 where txt='Chevy' or txt is NULL;
++id select_type table type possible_keys key key_len ref rows Extra
++1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
++select * from t1 where txt='Chevy ';
++id txt
++1 Chevy
++2 Chevy
++select * from t1 where txt='Chevy ' or txt='Chevy';
++id txt
++1 Chevy
++2 Chevy
++select * from t1 where txt='Chevy' or txt='Chevy ';
++id txt
++1 Chevy
++2 Chevy
++select * from t1 where id='1' or id='2';
++id txt
++1 Chevy
++2 Chevy
++insert into t1 (txt) values('Ford');
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
++id txt
++1 Chevy
++2 Chevy
++4 Ford
++select * from t1 where txt='Chevy' or txt='Chevy ';
++id txt
++1 Chevy
++2 Chevy
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
++id txt
++1 Chevy
++2 Chevy
++select * from t1 where txt in ('Chevy ','Chevy');
++id txt
++1 Chevy
++2 Chevy
++select * from t1 where txt in ('Chevy');
++id txt
++1 Chevy
++2 Chevy
++select * from t1 where txt between 'Chevy' and 'Chevy';
++id txt
++1 Chevy
++2 Chevy
++select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
++id txt
++1 Chevy
++2 Chevy
++select * from t1 where txt between 'Chevy' and 'Chevy ';
++id txt
++1 Chevy
++2 Chevy
++select * from t1 where txt < 'Chevy ';
++id txt
++select * from t1 where txt < 'Chevy ' or txt is NULL;
++id txt
++3 NULL
++select * from t1 where txt <= 'Chevy';
++id txt
++1 Chevy
++2 Chevy
++select * from t1 where txt > 'Chevy';
++id txt
++4 Ford
++select * from t1 where txt >= 'Chevy';
++id txt
++1 Chevy
++2 Chevy
++4 Ford
++alter table t1 modify column txt blob;
++explain select * from t1 where txt='Chevy' or txt is NULL;
++id select_type table type possible_keys key key_len ref rows Extra
++1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
++select * from t1 where txt='Chevy' or txt is NULL;
++id txt
++1 Chevy
++3 NULL
++explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
++id select_type table type possible_keys key key_len ref rows Extra
++1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where; Using filesort
++select * from t1 where txt='Chevy' or txt is NULL order by txt;
++id txt
++3 NULL
++1 Chevy
++drop table t1;
++CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i));
++INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
++select max(i) from t1 where c = '';
++max(i)
++4
++drop table t1;
++CREATE table t1 (a blob);
++insert into t1 values ('b'),('a\0'),('a'),('a '),('aa'),(NULL);
++select hex(a) from t1 order by a;
++hex(a)
++NULL
++61
++6100
++6120
++6161
++62
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++b
++NULL
++6100
++610000
++612000
++616100
++6200
++alter table t1 modify a varbinary(5);
++select hex(a) from t1 order by a;
++hex(a)
++NULL
++61
++6100
++6120
++6161
++62
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++b
++NULL
++6100
++610000
++612000
++616100
++6200
++alter table t1 modify a char(5);
++select hex(a) from t1 order by a;
++hex(a)
++NULL
++6100
++61
++61
++6161
++62
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++b
++NULL
++610000
++6100
++6100
++616100
++6200
++alter table t1 modify a binary(5);
++select hex(a) from t1 order by a;
++hex(a)
++NULL
++6100000000
++6100000000
++6100000000
++6161000000
++6200000000
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++b
++NULL
++610000000000
++610000000000
++610000000000
++616100000000
++620000000000
++drop table t1;
++create table t1 (a text default '');
++Warnings:
++Warning 1101 BLOB/TEXT column 'a' can't have a default value
++show create table t1;
++Table Create Table
++t1 CREATE TABLE `t1` (
++ `a` text
++) ENGINE=MEMORY DEFAULT CHARSET=latin1
++insert into t1 values (default);
++select * from t1;
++a
++NULL
++drop table t1;
++set @@sql_mode='TRADITIONAL';
++create table t1 (a text default '');
++ERROR 42000: BLOB/TEXT column 'a' can't have a default value
++set @@sql_mode='';
++CREATE TABLE t (c TEXT CHARSET ASCII);
++INSERT INTO t (c) VALUES (REPEAT('1',65537));
++Warnings:
++Warning 1265 Data truncated for column 'c' at row 1
++INSERT INTO t (c) VALUES (REPEAT('2',65536));
++Warnings:
++Warning 1265 Data truncated for column 'c' at row 1
++INSERT INTO t (c) VALUES (REPEAT('3',65535));
++SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
++LENGTH(c) CHAR_LENGTH(c)
++65535 65535
++65535 65535
++65535 65535
++DROP TABLE t;
++drop table if exists b15776;
++create table b15776 (data blob(2147483647));
++drop table b15776;
++create table b15776 (data blob(-1));
++ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1
++create table b15776 (data blob(2147483648));
++drop table b15776;
++create table b15776 (data blob(4294967294));
++drop table b15776;
++create table b15776 (data blob(4294967295));
++drop table b15776;
++create table b15776 (data blob(4294967296));
++ERROR 42000: Display width out of range for column 'data' (max = 4294967295)
++CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) );
++show columns from b15776;
++Field Type Null Key Default Extra
++a longblob YES NULL
++b longblob YES NULL
++c longblob YES NULL
++a1 longtext YES NULL
++b1 longtext YES NULL
++c1 longtext YES NULL
++drop table b15776;
++CREATE TABLE b15776 (a blob(4294967296));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a text(4294967296));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a int(0));
++INSERT INTO b15776 values (NULL), (1), (42), (654);
++SELECT * from b15776 ORDER BY a;
++a
++NULL
++1
++42
++654
++DROP TABLE b15776;
++CREATE TABLE b15776 (a int(-1));
++ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1
++CREATE TABLE b15776 (a int(255));
++DROP TABLE b15776;
++CREATE TABLE b15776 (a int(256));
++ERROR 42000: Display width out of range for column 'a' (max = 255)
++CREATE TABLE b15776 (data blob(-1));
++ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1
++CREATE TABLE b15776 (a char(2147483647));
++ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
++CREATE TABLE b15776 (a char(2147483648));
++ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
++CREATE TABLE b15776 (a char(4294967295));
++ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
++CREATE TABLE b15776 (a char(4294967296));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a year(4294967295));
++INSERT INTO b15776 VALUES (42);
++SELECT * FROM b15776;
++a
++2042
++DROP TABLE b15776;
++CREATE TABLE b15776 (a year(4294967296));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a year(0));
++DROP TABLE b15776;
++CREATE TABLE b15776 (a year(-2));
++ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1
++CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 select cast(null as char(4294967295));
++show columns from b15776;
++Field Type Null Key Default Extra
++cast(null as char(4294967295)) char(0) YES NULL
++drop table b15776;
++CREATE TABLE b15776 select cast(null as nchar(4294967295));
++show columns from b15776;
++Field Type Null Key Default Extra
++cast(null as nchar(4294967295)) char(0) YES NULL
++drop table b15776;
++CREATE TABLE b15776 select cast(null as binary(4294967295));
++show columns from b15776;
++Field Type Null Key Default Extra
++cast(null as binary(4294967295)) binary(0) YES NULL
++drop table b15776;
++explain select cast(1 as char(4294967295));
++id select_type table type possible_keys key key_len ref rows Extra
++1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
++explain select cast(1 as nchar(4294967295));
++id select_type table type possible_keys key key_len ref rows Extra
++1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
++explain select cast(1 as binary(4294967295));
++id select_type table type possible_keys key key_len ref rows Extra
++1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
++explain select cast(1 as char(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select cast(1 as nchar(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select cast(1 as binary(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select cast(1 as decimal(-1));
++ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1
++explain select cast(1 as decimal(64, 30));
++id select_type table type possible_keys key key_len ref rows Extra
++1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
++explain select cast(1 as decimal(64, 999999999999999999999999999999));
++Got one of the listed errors
++explain select cast(1 as decimal(4294967296));
++Got one of the listed errors
++explain select cast(1 as decimal(999999999999999999999999999999999999));
++Got one of the listed errors
++explain select convert(1, char(4294967295));
++id select_type table type possible_keys key key_len ref rows Extra
++1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
++explain select convert(1, char(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select convert(1, nchar(4294967295));
++id select_type table type possible_keys key key_len ref rows Extra
++1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
++explain select convert(1, nchar(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select convert(1, binary(4294967295));
++id select_type table type possible_keys key key_len ref rows Extra
++1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
++explain select convert(1, binary(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++End of 5.0 tests
++CREATE TABLE t1(id INT NOT NULL);
++CREATE TABLE t2(id INT NOT NULL, c TEXT NOT NULL);
++INSERT INTO t1 VALUES (1);
++INSERT INTO t2 VALUES (1, '');
++UPDATE t2 SET c = REPEAT('1', 70000);
++Warnings:
++Warning 1265 Data truncated for column 'c' at row 1
++SELECT LENGTH(c) FROM t2;
++LENGTH(c)
++65535
++UPDATE t1 LEFT JOIN t2 USING(id) SET t2.c = REPEAT('1', 70000) WHERE t1.id = 1;
++Warnings:
++Warning 1265 Data truncated for column 'c' at row 1
++SELECT LENGTH(c) FROM t2;
++LENGTH(c)
++65535
++DROP TABLE t1, t2;
++# Bug #52160: crash and inconsistent results when grouping
++# by a function and column
++CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
++CREATE TABLE t1(a CHAR(1));
++INSERT INTO t1 VALUES ('0'), ('0');
++SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
++COUNT(*)
++2
++DROP FUNCTION f1;
++DROP TABLE t1;
++SET default_storage_engine=@old_default_storage_engine;
++SET @old_max_heap_table_size = @@global.max_heap_table_size;
++SET @old_max_allowed_packet = @@global.max_allowed_packet;
++SET GLOBAL max_heap_table_size = 18 * 1024 * 1024;
++SET GLOBAL max_allowed_packet = 24 * 1024 * 1024;
++drop table if exists t1;
++CREATE TABLE t1 (data LONGBLOB) ENGINE=memory;
++INSERT INTO t1 (data) VALUES (NULL);
++UPDATE t1 set data=repeat('a',18*1024*1024);
++select length(data) from t1;
++length(data)
++18874368
++delete from t1 where left(data,1)='a';
++truncate table t1;
++INSERT INTO t1 (data) VALUES (repeat('a',1*1024*1024));
++INSERT INTO t1 (data) VALUES (repeat('b',16*1024*1024-1024));
++delete from t1 where left(data,1)='b';
++UPDATE t1 set data=repeat('c',17*1024*1024);
++delete from t1 where left(data,1)='c';
++INSERT INTO t1 set data=repeat('a',18*1024*1024);
++select length(data) from t1;
++length(data)
++18874368
++alter table t1 modify data blob;
++select length(data) from t1;
++length(data)
++0
++drop table t1;
++CREATE TABLE t1 (data BLOB) ENGINE=myisam;
++INSERT INTO t1 (data) VALUES (NULL);
++UPDATE t1 set data=repeat('a',18*1024*1024);
++Warnings:
++Warning 1265 Data truncated for column 'data' at row 1
++select length(data) from t1;
++length(data)
++65535
++drop table t1;
++SET GLOBAL max_allowed_packet = @old_max_allowed_packet;
++SET GLOBAL max_heap_table_size = @old_max_heap_table_size;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug783366.result
+@@ -0,0 +1,14 @@
++drop table if exists t1;
++CREATE TABLE t1 (
++f1 VARCHAR ( 128 ) ,
++f2 VARCHAR ( 32 ),
++PRIMARY KEY ( f2 ( 2 ) , f1 )
++)
++ENGINE=HEAP KEY_BLOCK_SIZE = 512;
++INSERT IGNORE INTO t1 VALUES ( 'te' , 'm') , ( NULL , 'think' );
++Warnings:
++Warning 1048 Column 'f1' cannot be null
++INSERT IGNORE INTO t1 VALUES ( 'te' , 'm') , ( NULL , 'think' );
++Warnings:
++Warning 1048 Column 'f1' cannot be null
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug783451.result
+@@ -0,0 +1,132 @@
++DROP TABLE IF EXISTS local_1_1;
++CREATE TABLE IF NOT EXISTS local_1_1 ( f1 VARCHAR ( 32 ) NOT NULL , f2 VARCHAR ( 128 ) NOT NULL DEFAULT 'cboepfaobilcchabvglgjdbynog' , f3 VARCHAR ( 32 ) NOT NULL , f4 VARBINARY ( 32 ) NOT NULL , f5 VARBINARY ( 1024 ) DEFAULT 'ycboepfao' , KEY ( f1 /* ( 2 ) */ , f2 /* ( 2 ) */ ) ) ENGINE=HEAP KEY_BLOCK_SIZE = 512;
++INSERT IGNORE INTO local_1_1 VALUES ( REPEAT( 'ervydbimvmbqmsowdbsa' , 1 ) , 'v' , NULL , NULL , REPEAT( 'mervydbimvmbqms' , 5 ) ) , ( 'p' , 6 , 'n' , REPEAT( 'imervydbimvmbqmsowdbs' , 4 ) , 'do' ) , ( NULL , NULL , REPEAT( 'himervydbimvmbqmsowdbsaybudvwaamvhempuublmia' , 6 ) , REPEAT('X', POW(2, 20) * 2) , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT('X', POW(2, 20) * 2) , REPEAT( 'Y' , 763 ) , NULL , REPEAT('X', POW(2, 20) * 2) , NULL ) , ( REPEAT('X', POW(2, 20) * 2) , 'time' , 'how' , 2 , REPEAT( 'Y' , 107 ) ) , ( REPEAT( 'hyshimervydbimvmbqmsowdbsaybud' , 5 ) , 2 , 8 , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( 'come' , NULL , 'i' , NULL , REPEAT('X', POW(2, 20) * 2) );
++Warnings:
++Warning 1048 Column 'f3' cannot be null
++Warning 1048 Column 'f4' cannot be null
++Warning 1265 Data truncated for column 'f4' at row 2
++Warning 1048 Column 'f1' cannot be null
++Warning 1048 Column 'f2' cannot be null
++Warning 1265 Data truncated for column 'f3' at row 3
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1048 Column 'f4' cannot be null
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1048 Column 'f1' cannot be null
++Warning 1265 Data truncated for column 'f2' at row 4
++Warning 1048 Column 'f3' cannot be null
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1048 Column 'f4' cannot be null
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1048 Column 'f1' cannot be null
++Warning 1265 Data truncated for column 'f1' at row 6
++Warning 1048 Column 'f4' cannot be null
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1048 Column 'f2' cannot be null
++Warning 1048 Column 'f4' cannot be null
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++INSERT IGNORE INTO local_1_1 VALUES ( 'ok' , NULL , REPEAT( 'Y' , 651 ) , 2 , 5 ) , ( REPEAT( 'zylcdzkfrqpihyshimervydbimvmbqmsowdbsaybu' , 3 ) , REPEAT( 'Y' , 282 ) , REPEAT( 'X' , 0 ) , REPEAT( 'Y' , 369 ) , 'g' ) , ( 'think' , REPEAT('X', POW(2, 20) * 2), NULL , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT( 'Y' , 468 ) , REPEAT( 'dfvbrzylcd' , 6 ) , REPEAT( 'Y' , 264 ) , NULL , 'c' ) , ( NULL , NULL , REPEAT( 'srdfvbrzylcdzkfrqpihyshimervydbimvmbqms' , 0 ) , REPEAT( 'Y' , 244 ) , 7 ) , ( REPEAT( 'Y' , 0 ) , 'how' , 'going' , 'q' , NULL );
++Warnings:
++Warning 1048 Column 'f2' cannot be null
++Warning 1265 Data truncated for column 'f3' at row 1
++Warning 1265 Data truncated for column 'f1' at row 2
++Warning 1265 Data truncated for column 'f2' at row 2
++Warning 1265 Data truncated for column 'f4' at row 2
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1048 Column 'f2' cannot be null
++Warning 1048 Column 'f3' cannot be null
++Warning 1048 Column 'f4' cannot be null
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1265 Data truncated for column 'f1' at row 4
++Warning 1265 Data truncated for column 'f3' at row 4
++Warning 1048 Column 'f4' cannot be null
++Warning 1048 Column 'f1' cannot be null
++Warning 1048 Column 'f2' cannot be null
++Warning 1265 Data truncated for column 'f4' at row 5
++INSERT IGNORE INTO local_1_1 VALUES ( REPEAT('X', POW(2, 20) * 2) , NULL , NULL , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT('X', POW(2, 20) * 2) , NULL , REPEAT('X', POW(2, 20) * 2) , 'this' , 'e' ) , ( NULL , 'think' , NULL , 'were' , NULL ) , ( 9 , 'l' , 'c' , 3 , REPEAT( 'geysrdfvbrzylcdzkfrqpihyshimervydbi' , 5 ) ) , ( NULL , NULL , NULL , 'h' , 'w' );
++Warnings:
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1048 Column 'f1' cannot be null
++Warning 1048 Column 'f2' cannot be null
++Warning 1048 Column 'f3' cannot be null
++Warning 1048 Column 'f4' cannot be null
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1048 Column 'f1' cannot be null
++Warning 1048 Column 'f2' cannot be null
++Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning 1048 Column 'f3' cannot be null
++Warning 1048 Column 'f1' cannot be null
++Warning 1048 Column 'f3' cannot be null
++Warning 1048 Column 'f1' cannot be null
++Warning 1048 Column 'f2' cannot be null
++Warning 1048 Column 'f3' cannot be null
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++UPDATE local_1_1 SET f5 = REPEAT ('X', 215566);
++Warnings:
++Warning 1265 Data truncated for column 'f5' at row 1
++Warning 1265 Data truncated for column 'f5' at row 2
++Warning 1265 Data truncated for column 'f5' at row 3
++Warning 1265 Data truncated for column 'f5' at row 4
++Warning 1265 Data truncated for column 'f5' at row 5
++Warning 1265 Data truncated for column 'f5' at row 6
++Warning 1265 Data truncated for column 'f5' at row 7
++Warning 1265 Data truncated for column 'f5' at row 8
++Warning 1265 Data truncated for column 'f5' at row 9
++Warning 1265 Data truncated for column 'f5' at row 10
++Warning 1265 Data truncated for column 'f5' at row 11
++Warning 1265 Data truncated for column 'f5' at row 12
++Warning 1265 Data truncated for column 'f5' at row 13
++Warning 1265 Data truncated for column 'f5' at row 14
++Warning 1265 Data truncated for column 'f5' at row 15
++Warning 1265 Data truncated for column 'f5' at row 16
++Warning 1265 Data truncated for column 'f5' at row 17
++Warning 1265 Data truncated for column 'f5' at row 18
++Warning 1265 Data truncated for column 'f5' at row 19
++Warning 1265 Data truncated for column 'f5' at row 20
++Warning 1265 Data truncated for column 'f5' at row 21
++Warning 1265 Data truncated for column 'f5' at row 22
++Warning 1265 Data truncated for column 'f5' at row 23
++Warning 1265 Data truncated for column 'f5' at row 24
++Warning 1265 Data truncated for column 'f5' at row 25
++Warning 1265 Data truncated for column 'f5' at row 26
++Warning 1265 Data truncated for column 'f5' at row 27
++Warning 1265 Data truncated for column 'f5' at row 28
++Warning 1265 Data truncated for column 'f5' at row 29
++Warning 1265 Data truncated for column 'f5' at row 30
++Warning 1265 Data truncated for column 'f5' at row 31
++Warning 1265 Data truncated for column 'f5' at row 32
++Warning 1265 Data truncated for column 'f5' at row 33
++Warning 1265 Data truncated for column 'f5' at row 34
++Warning 1265 Data truncated for column 'f5' at row 35
++Warning 1265 Data truncated for column 'f5' at row 36
++Warning 1265 Data truncated for column 'f5' at row 37
++Warning 1265 Data truncated for column 'f5' at row 38
++Warning 1265 Data truncated for column 'f5' at row 39
++Warning 1265 Data truncated for column 'f5' at row 40
++Warning 1265 Data truncated for column 'f5' at row 41
++Warning 1265 Data truncated for column 'f5' at row 42
++Warning 1265 Data truncated for column 'f5' at row 43
++Warning 1265 Data truncated for column 'f5' at row 44
++Warning 1265 Data truncated for column 'f5' at row 45
++Warning 1265 Data truncated for column 'f5' at row 46
++Warning 1265 Data truncated for column 'f5' at row 47
++Warning 1265 Data truncated for column 'f5' at row 48
++Warning 1265 Data truncated for column 'f5' at row 49
++Warning 1265 Data truncated for column 'f5' at row 50
++Warning 1265 Data truncated for column 'f5' at row 51
++Warning 1265 Data truncated for column 'f5' at row 52
++Warning 1265 Data truncated for column 'f5' at row 53
++Warning 1265 Data truncated for column 'f5' at row 54
++Warning 1265 Data truncated for column 'f5' at row 55
++Warning 1265 Data truncated for column 'f5' at row 56
++Warning 1265 Data truncated for column 'f5' at row 57
++Warning 1265 Data truncated for column 'f5' at row 58
++Warning 1265 Data truncated for column 'f5' at row 59
++Warning 1265 Data truncated for column 'f5' at row 60
++Warning 1265 Data truncated for column 'f5' at row 61
++Warning 1265 Data truncated for column 'f5' at row 62
++Warning 1265 Data truncated for column 'f5' at row 63
++Warning 1265 Data truncated for column 'f5' at row 64
++DROP TABLE local_1_1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug784464.result
+@@ -0,0 +1,58 @@
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Fixed 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=33 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++ERROR 42000: Incorrect usage/placement of 'key_block_size'
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=34 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Dynamic 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC KEY_BLOCK_SIZE=34
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=123 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Dynamic 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC KEY_BLOCK_SIZE=123
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=1000 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Fixed 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC KEY_BLOCK_SIZE=1000
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Fixed 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=33 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++ERROR 42000: Incorrect usage/placement of 'key_block_size'
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=34 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Dynamic 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC KEY_BLOCK_SIZE=34
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=121 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Dynamic 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC KEY_BLOCK_SIZE=121
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=1000 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Fixed 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC KEY_BLOCK_SIZE=1000
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug784464_32bit.result
+@@ -0,0 +1,12 @@
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=124 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Dynamic 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC KEY_BLOCK_SIZE=124
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=122 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Dynamic 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC KEY_BLOCK_SIZE=122
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug784464_64bit.result
+@@ -0,0 +1,12 @@
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=124 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Fixed 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC KEY_BLOCK_SIZE=124
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=122 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Fixed 0 X 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC KEY_BLOCK_SIZE=122
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug784468.result
+@@ -0,0 +1,15 @@
++CREATE TABLE t1 ( f1 VARCHAR(30)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Fixed 0 32 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC
++DROP TABLE t1;
++CREATE TABLE t1 ( f1 VARCHAR(31)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Fixed 0 33 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC
++DROP TABLE t1;
++CREATE TABLE t1 ( f1 VARCHAR(32)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
++t1 MEMORY 10 Fixed 0 34 0 X 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug788544.result
+@@ -0,0 +1,9 @@
++CREATE TABLE t1 (f2 VARCHAR (32), f4 LONGBLOB, f5 TEXT) ENGINE=HEAP;
++INSERT INTO t1 VALUES ('a', NULL, NULL),
++('b' , REPEAT('a' , 593338), REPEAT('a', 800));
++UPDATE t1 SET f2 = 'c' WHERE f4 = 'd';
++SELECT LENGTH(f2), LENGTH(f4), LENGTH(f5) FROM t1;
++LENGTH(f2) LENGTH(f4) LENGTH(f5)
++1 NULL NULL
++1 593338 800
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug788576.result
+@@ -0,0 +1,19 @@
++CREATE TABLE t1 (f1 VARCHAR (32), f2 VARCHAR (128), f3 VARBINARY (128),
++f4 VARBINARY (512), f5 VARBINARY (1024),
++KEY (f2(1))) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++INSERT IGNORE INTO t1 VALUES (2, NULL, 6, REPEAT('glugcgqk', 5), 'look'),
++(REPEAT( 'kglugcgqkin', 6), 'if', 'was', NULL, NULL),
++(NULL, NULL, NULL, NULL, 7);
++Warnings:
++Warning 1265 Data truncated for column 'f1' at row 2
++SELECT * FROM t1;
++f1 f2 f3 f4 f5
++2 NULL 6 glugcgqkglugcgqkglugcgqkglugcgqkglugcgqk look
++kglugcgqkinkglugcgqkinkglugcgqki if was NULL NULL
++NULL NULL NULL NULL 7
++DELETE FROM t1 WHERE f5 <=> NULL;
++SELECT * FROM t1;
++f1 f2 f3 f4 f5
++2 NULL 6 glugcgqkglugcgqkglugcgqkglugcgqkglugcgqk look
++NULL NULL NULL NULL 7
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug788722.result
+@@ -0,0 +1,18 @@
++CREATE TABLE IF NOT EXISTS local_1_1 (f1 VARCHAR (32) NOT NULL,
++f2 VARCHAR (128) NOT NULL,
++f3 BLOB NOT NULL,
++f4 TEXT,
++f5 BLOB (1024),
++PRIMARY KEY (f1),
++KEY (f1 , f2)
++) ENGINE=HEAP ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE = 2048;
++INSERT IGNORE INTO local_1_1 VALUES
++(REPEAT('egqeqfxwaejpqixuvvtentruyqadxiybjdfqjspfbyjdjczrrwjnagkzsoagatqookhsgtrvvbxacppljfzaseidqggxvuirm' , 5), NULL, NULL, NULL, REPEAT('hegqeqfxwaejpqixuvvtentruyqadxiy', 1)),
++('you', NULL, 0, REPEAT("X", 2048) , 0);
++Warnings:
++Warning 1265 Data truncated for column 'f1' at row 1
++Warning 1048 Column 'f2' cannot be null
++Warning 1048 Column 'f3' cannot be null
++Warning 1048 Column 'f2' cannot be null
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++DROP TABLE local_1_1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug789131.result
+@@ -0,0 +1,7 @@
++CREATE TABLE t1 (f1 VARCHAR (128), f2 VARCHAR (128), f3 VARBINARY (512),
++f4 TEXT (65525), f5 VARCHAR (128), KEY (f1(1))) ENGINE=HEAP;
++INSERT IGNORE INTO t1 VALUES
++( 'o' , "" , NULL , "" , 0 ) ,
++(NULL, "" , "" , "" , 'f' ) ;
++INSERT IGNORE INTO t1 SELECT * FROM t1;
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_var.result
+@@ -0,0 +1,194 @@
++drop table if exists t1;
++set @@session.max_heap_table_size=16*1024*1024;
++create table t1 (a int not null, b varchar(400), c int, primary key (a), key (c)) engine=heap comment="testing heaps" key_block_size=128;
++ERROR 42000: Incorrect usage/placement of 'key_block_size'
++create table t1 (a int not null, b int, c varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" key_block_size=4;
++ERROR 42000: Incorrect usage/placement of 'key_block_size'
++create table t1 (a int not null, b int, c varchar(400), d varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" key_block_size=24;
++show table status like "t1";
++Name t1
++Engine MEMORY
++Version 10
++Row_format Dynamic
++Rows 0
++Avg_row_length X
++Data_length X
++Max_data_length X
++Index_length X
++Data_free X
++Auto_increment X
++Create_time X
++Update_time X
++Check_time X
++Collation latin1_swedish_ci
++Checksum NULL
++Create_options KEY_BLOCK_SIZE=24
++Comment testing heaps
++insert into t1 values (1,1,'012',NULL), (2,2,'0123456789',NULL), (3,3,'012345678901234567890123456789',NULL), (4,4,NULL,'0123456789012345678901234567890123456789012345678901234567890123456789');
++select * from t1;
++a b c d
++1 1 012 NULL
++2 2 0123456789 NULL
++3 3 012345678901234567890123456789 NULL
++4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
++delete from t1 where a = 3;
++select * from t1;
++a b c d
++1 1 012 NULL
++2 2 0123456789 NULL
++4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
++insert into t1 values (5,5,NULL,'0123'), (6,6,NULL,'0123');
++select * from t1;
++a b c d
++1 1 012 NULL
++2 2 0123456789 NULL
++6 6 NULL 0123
++5 5 NULL 0123
++4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
++update t1 set c = '012345678901234567890123456789' where a = 2;
++select * from t1;
++a b c d
++1 1 012 NULL
++2 2 012345678901234567890123456789 NULL
++6 6 NULL 0123
++5 5 NULL 0123
++4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
++update t1 set c = '0123456789' where a = 2;
++select * from t1;
++a b c d
++1 1 012 NULL
++2 2 0123456789 NULL
++6 6 NULL 0123
++5 5 NULL 0123
++4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
++insert into t1 values (7,7,'0123',NULL), (8,8,'0123',NULL);
++select * from t1;
++a b c d
++1 1 012 NULL
++2 2 0123456789 NULL
++6 6 NULL 0123
++5 5 NULL 0123
++4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
++7 7 0123 NULL
++8 8 0123 NULL
++show table status like "t1";
++Name t1
++Engine MEMORY
++Version 10
++Row_format Dynamic
++Rows 7
++Avg_row_length X
++Data_length X
++Max_data_length X
++Index_length X
++Data_free X
++Auto_increment X
++Create_time X
++Update_time X
++Check_time X
++Collation latin1_swedish_ci
++Checksum NULL
++Create_options KEY_BLOCK_SIZE=24
++Comment testing heaps
++alter table t1 key_block_size = 0;
++show table status like "t1";
++Name t1
++Engine MEMORY
++Version 10
++Row_format Dynamic
++Rows 7
++Avg_row_length X
++Data_length X
++Max_data_length X
++Index_length X
++Data_free X
++Auto_increment X
++Create_time X
++Update_time X
++Check_time X
++Collation latin1_swedish_ci
++Checksum NULL
++Create_options
++Comment testing heaps
++alter table t1 row_format = dynamic;
++show table status like "t1";
++Name t1
++Engine MEMORY
++Version 10
++Row_format Dynamic
++Rows 7
++Avg_row_length X
++Data_length X
++Max_data_length X
++Index_length X
++Data_free X
++Auto_increment X
++Create_time X
++Update_time X
++Check_time X
++Collation latin1_swedish_ci
++Checksum NULL
++Create_options row_format=DYNAMIC KEY_BLOCK_SIZE=X
++Comment testing heaps
++alter table t1 key_block_size = 128, max_rows = 10001;
++show table status like "t1";
++Name t1
++Engine MEMORY
++Version 10
++Row_format Dynamic
++Rows 7
++Avg_row_length X
++Data_length X
++Max_data_length X
++Index_length X
++Data_free X
++Auto_increment X
++Create_time X
++Update_time X
++Check_time X
++Collation latin1_swedish_ci
++Checksum NULL
++Create_options max_rows=10001 row_format=DYNAMIC KEY_BLOCK_SIZE=128
++Comment testing heaps
++select * from t1;
++a b c d
++1 1 012 NULL
++2 2 0123456789 NULL
++6 6 NULL 0123
++5 5 NULL 0123
++4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
++7 7 0123 NULL
++8 8 0123 NULL
++delete from t1;
++select * from t1;
++a b c d
++call mtr.add_suppression("The table 't1' is full");
++select count(*) from t1;
++count(*)
++10001
++insert into t1 values (100000,100000,NULL,'0123'), (100000,100000,NULL,'0123');
++ERROR HY000: The table 't1' is full
++show table status like "t1";
++Name t1
++Engine MEMORY
++Version 10
++Row_format Dynamic
++Rows 10001
++Avg_row_length X
++Data_length X
++Max_data_length X
++Index_length X
++Data_free X
++Auto_increment X
++Create_time X
++Update_time X
++Check_time X
++Collation latin1_swedish_ci
++Checksum NULL
++Create_options max_rows=10001 row_format=DYNAMIC KEY_BLOCK_SIZE=128
++Comment testing heaps
++select count(*) from t1;
++count(*)
++10001
++set @@session.max_heap_table_size=default;
++drop table t1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_blob.test
+@@ -0,0 +1,642 @@
++########################################################################
++# Test blobs with the HEAP/MEMORY storage engine
++########################################################################
++
++########################################################################
++# Modified tests from type_blob.test
++########################################################################
++
++SET @old_default_storage_engine=@@default_storage_engine;
++SET default_storage_engine=MEMORY;
++
++#
++# Basic cleanup
++#
++--disable_warnings
++drop table if exists t1,t2,t3,t4,t5,t6,t7;
++--enable_warnings
++
++
++#
++# Check syntax for creating BLOB/TEXT
++#
++
++CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
++show columns from t1;
++# PS doesn't give errors on prepare yet
++CREATE TABLE t2 (a char(255), b varbinary(70000), c varchar(70000000));
++CREATE TABLE t4 (c varchar(65530) character set utf8 not null);
++show columns from t2;
++create table t3 (a long, b long byte);
++show create TABLE t3;
++show create TABLE t4;
++drop table t1,t2,t3,t4;
++
++#
++# Check errors with blob
++#
++
++--error 1074
++CREATE TABLE t1 (a char(257) default "hello");
++--error 1074
++CREATE TABLE t2 (a char(256));
++--error 1074
++CREATE TABLE t1 (a varchar(70000) default "hello");
++--error 1101
++CREATE TABLE t2 (a blob default "hello");
++
++# Safety to be able to continue with other tests if above fails
++--disable_warnings
++drop table if exists t1,t2;
++--enable_warnings
++
++#
++# test of full join with blob
++#
++
++create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
++insert into t1 values (null,"a","A");
++insert into t1 values (null,"bbb","BBB");
++insert into t1 values (null,"ccc","CCC");
++select last_insert_id();
++select * from t1,t1 as t2;
++
++drop table t1;
++
++#
++# Test of changing TEXT column
++#
++
++create table t1 (a text);
++insert into t1 values ('where');
++update t1 set a='Where';
++select * from t1;
++drop table t1;
++
++#
++# test of blob, text, char and varbinary
++#
++create table t1 (t text,c char(10),b blob, d varbinary(10));
++insert into t1 values (NULL,NULL,NULL,NULL);
++insert into t1 values ("","","","");
++insert into t1 values ("hello","hello","hello","hello");
++insert into t1 values ("HELLO","HELLO","HELLO","HELLO");
++insert into t1 values ("HELLO MY","HELLO MY","HELLO MY","HELLO MY");
++insert into t1 values ("a","a","a","a");
++insert into t1 values (1,1,1,1);
++insert into t1 values (NULL,NULL,NULL,NULL);
++update t1 set c="",b=null where c="1";
++
++lock tables t1 READ;
++# We mask out the Privileges column because it differs for embedded server
++--replace_column 8 #
++show full fields from t1;
++lock tables t1 WRITE;
++--replace_column 8 #
++show full fields from t1;
++unlock tables;
++
++select t from t1 where t like "hello";
++select c from t1 where c like "hello";
++select b from t1 where b like "hello";
++select d from t1 where d like "hello";
++select c from t1 having c like "hello";
++select d from t1 having d like "hello";
++select t from t1 where t like "%HELLO%";
++select c from t1 where c like "%HELLO%";
++select b from t1 where b like "%HELLO%";
++select d from t1 where d like "%HELLO%";
++select c from t1 having c like "%HELLO%";
++select d from t1 having d like "%HELLO%";
++select d from t1 having d like "%HE%LLO%";
++select t from t1 order by t;
++select c from t1 order by c;
++select b from t1 order by b;
++select d from t1 order by d;
++select distinct t from t1;
++select distinct b from t1;
++select distinct t from t1 order by t;
++select distinct b from t1 order by b;
++select t from t1 group by t;
++select b from t1 group by b;
++set option sql_big_tables=1;
++select distinct t from t1;
++select distinct b from t1;
++select distinct t from t1 order by t;
++select distinct b from t1 order by b;
++select distinct c from t1;
++select distinct d from t1;
++select distinct c from t1 order by c;
++select distinct d from t1 order by d;
++select c from t1 group by c;
++select d from t1 group by d;
++set option sql_big_tables=0;
++select distinct * from t1;
++select t,count(*) from t1 group by t;
++select b,count(*) from t1 group by b;
++select c,count(*) from t1 group by c;
++select d,count(*) from t1 group by d;
++drop table t1;
++
++
++#
++# Test of join with blobs and min
++#
++
++CREATE TABLE t1 (
++ t1_id bigint(21) NOT NULL auto_increment,
++ _field_72 varchar(128) DEFAULT '' NOT NULL,
++ _field_95 varchar(32),
++ _field_115 tinyint(4) DEFAULT '0' NOT NULL,
++ _field_122 tinyint(4) DEFAULT '0' NOT NULL,
++ _field_126 tinyint(4),
++ _field_134 tinyint(4),
++ PRIMARY KEY (t1_id),
++ UNIQUE _field_72 (_field_72),
++ KEY _field_115 (_field_115),
++ KEY _field_122 (_field_122)
++);
++
++
++INSERT INTO t1 VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',0,1,NULL,NULL);
++INSERT INTO t1 VALUES (2,'hroberts','7415275a8c95952901e42b13a6b78566',0,1,NULL,NULL);
++INSERT INTO t1 VALUES (3,'guest','d41d8cd98f00b204e9800998ecf8427e',1,0,NULL,NULL);
++
++
++CREATE TABLE t2 (
++ seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++ seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++ PRIMARY KEY (seq_0_id,seq_1_id)
++);
++
++
++INSERT INTO t2 VALUES (1,1);
++INSERT INTO t2 VALUES (2,1);
++INSERT INTO t2 VALUES (2,2);
++
++CREATE TABLE t3 (
++ t3_id bigint(21) NOT NULL auto_increment,
++ _field_131 varchar(128),
++ _field_133 tinyint(4) DEFAULT '0' NOT NULL,
++ _field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
++ _field_137 tinyint(4),
++ _field_139 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
++ _field_140 blob,
++ _field_142 tinyint(4) DEFAULT '0' NOT NULL,
++ _field_145 tinyint(4) DEFAULT '0' NOT NULL,
++ _field_148 tinyint(4) DEFAULT '0' NOT NULL,
++ PRIMARY KEY (t3_id),
++ KEY _field_133 (_field_133),
++ KEY _field_135 (_field_135),
++ KEY _field_139 (_field_139),
++ KEY _field_142 (_field_142),
++ KEY _field_145 (_field_145),
++ KEY _field_148 (_field_148)
++);
++
++
++INSERT INTO t3 VALUES (1,'test job 1',0,'0000-00-00 00:00:00',0,'1999-02-25 22:43:32','test\r\njob\r\n1',0,0,0);
++INSERT INTO t3 VALUES (2,'test job 2',0,'0000-00-00 00:00:00',0,'1999-02-26 21:08:04','',0,0,0);
++
++
++CREATE TABLE t4 (
++ seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++ seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++ PRIMARY KEY (seq_0_id,seq_1_id)
++);
++
++
++INSERT INTO t4 VALUES (1,1);
++INSERT INTO t4 VALUES (2,1);
++
++CREATE TABLE t5 (
++ t5_id bigint(21) NOT NULL auto_increment,
++ _field_149 tinyint(4),
++ _field_156 varchar(128) DEFAULT '' NOT NULL,
++ _field_157 varchar(128) DEFAULT '' NOT NULL,
++ _field_158 varchar(128) DEFAULT '' NOT NULL,
++ _field_159 varchar(128) DEFAULT '' NOT NULL,
++ _field_160 varchar(128) DEFAULT '' NOT NULL,
++ _field_161 varchar(128) DEFAULT '' NOT NULL,
++ PRIMARY KEY (t5_id),
++ KEY _field_156 (_field_156),
++ KEY _field_157 (_field_157),
++ KEY _field_158 (_field_158),
++ KEY _field_159 (_field_159),
++ KEY _field_160 (_field_160),
++ KEY _field_161 (_field_161)
++);
++
++
++INSERT INTO t5 VALUES (1,0,'tomato','','','','','');
++INSERT INTO t5 VALUES (2,0,'cilantro','','','','','');
++
++CREATE TABLE t6 (
++ seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++ seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++ PRIMARY KEY (seq_0_id,seq_1_id)
++);
++
++INSERT INTO t6 VALUES (1,1);
++INSERT INTO t6 VALUES (1,2);
++INSERT INTO t6 VALUES (2,2);
++
++CREATE TABLE t7 (
++ t7_id bigint(21) NOT NULL auto_increment,
++ _field_143 tinyint(4),
++ _field_165 varchar(32),
++ _field_166 smallint(6) DEFAULT '0' NOT NULL,
++ PRIMARY KEY (t7_id),
++ KEY _field_166 (_field_166)
++);
++
++
++INSERT INTO t7 VALUES (1,0,'High',1);
++INSERT INTO t7 VALUES (2,0,'Medium',2);
++INSERT INTO t7 VALUES (3,0,'Low',3);
++
++select replace(t3._field_140, "\r","^M"),t3_id,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), replace(min(t3._field_140), "\r","^M"),t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156;
++
++drop table t1,t2,t3,t4,t5,t6,t7;
++
++#
++# Test of reverse with empty blob
++#
++
++create table t1 (a blob);
++insert into t1 values ("empty"),("");
++select a,reverse(a) from t1;
++drop table t1;
++
++#
++# Bug when blob is updated
++#
++
++create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default '');
++insert into t1 (id) values (1);
++# We have to clean up the path in the results for safe comparison
++eval select
++ charset(load_file('../../std_data/words.dat')),
++ collation(load_file('../../std_data/words.dat')),
++ coercibility(load_file('../../std_data/words.dat'));
++--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
++eval explain extended select
++ charset(load_file('$MYSQLTEST_VARDIR/std_data/words.dat')),
++ collation(load_file('$MYSQLTEST_VARDIR/std_data/words.dat')),
++ coercibility(load_file('$MYSQLTEST_VARDIR/std_data/words.dat'));
++--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
++eval update t1 set imagem=load_file('$MYSQLTEST_VARDIR/std_data/words.dat') where id=1;
++select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
++drop table t1;
++--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
++eval create table t1 select load_file('$MYSQLTEST_VARDIR/std_data/words.dat') l;
++# We mask out the Privileges column because it differs for embedded server
++--replace_column 8 #
++show full fields from t1;
++drop table t1;
++
++#
++# Test blob's with end space (Bug #1651)
++# This is a bit changed since we now have true varchar
++#
++
++create table t1 (id integer primary key auto_increment, txt text not null);
++insert into t1 (txt) values ('Chevy ');
++select * from t1 where txt='Chevy';
++select * from t1 where txt='Chevy ';
++select * from t1 where txt='Chevy ' or txt='Chevy';
++select * from t1 where txt='Chevy' or txt='Chevy ';
++select * from t1 where id='1' or id='2';
++insert into t1 (txt) values('Ford');
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
++select * from t1 where txt='Chevy' or txt='Chevy ';
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
++select * from t1 where txt in ('Chevy ','Chevy');
++select * from t1 where txt in ('Chevy');
++select * from t1 where txt between 'Chevy' and 'Chevy';
++select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
++select * from t1 where txt between 'Chevy' and 'Chevy ';
++select * from t1 where txt < 'Chevy ';
++select * from t1 where txt <= 'Chevy';
++select * from t1 where txt > 'Chevy';
++select * from t1 where txt >= 'Chevy';
++drop table t1;
++
++create table t1 (id integer primary key auto_increment, txt text);
++insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
++select * from t1 where txt='Chevy' or txt is NULL;
++explain select * from t1 where txt='Chevy' or txt is NULL;
++select * from t1 where txt='Chevy ';
++select * from t1 where txt='Chevy ' or txt='Chevy';
++select * from t1 where txt='Chevy' or txt='Chevy ';
++select * from t1 where id='1' or id='2';
++insert into t1 (txt) values('Ford');
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
++select * from t1 where txt='Chevy' or txt='Chevy ';
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
++select * from t1 where txt in ('Chevy ','Chevy');
++select * from t1 where txt in ('Chevy');
++select * from t1 where txt between 'Chevy' and 'Chevy';
++select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
++select * from t1 where txt between 'Chevy' and 'Chevy ';
++select * from t1 where txt < 'Chevy ';
++select * from t1 where txt < 'Chevy ' or txt is NULL;
++select * from t1 where txt <= 'Chevy';
++select * from t1 where txt > 'Chevy';
++select * from t1 where txt >= 'Chevy';
++alter table t1 modify column txt blob;
++explain select * from t1 where txt='Chevy' or txt is NULL;
++select * from t1 where txt='Chevy' or txt is NULL;
++explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
++select * from t1 where txt='Chevy' or txt is NULL order by txt;
++drop table t1;
++
++CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i));
++INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
++select max(i) from t1 where c = '';
++drop table t1;
++
++# End of 4.1 tests
++
++#
++# Test that blob's and varbinary are sorted according to length
++#
++
++CREATE table t1 (a blob);
++insert into t1 values ('b'),('a\0'),('a'),('a '),('aa'),(NULL);
++select hex(a) from t1 order by a;
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++alter table t1 modify a varbinary(5);
++select hex(a) from t1 order by a;
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++alter table t1 modify a char(5);
++select hex(a) from t1 order by a;
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++alter table t1 modify a binary(5);
++select hex(a) from t1 order by a;
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++drop table t1;
++
++#
++# Bug #19489: Inconsistent support for DEFAULT in TEXT columns
++#
++create table t1 (a text default '');
++show create table t1;
++insert into t1 values (default);
++select * from t1;
++drop table t1;
++set @@sql_mode='TRADITIONAL';
++--error ER_BLOB_CANT_HAVE_DEFAULT
++create table t1 (a text default '');
++set @@sql_mode='';
++
++#
++# Bug #32282: TEXT silently truncates when value is exactly 65536 bytes
++#
++
++CREATE TABLE t (c TEXT CHARSET ASCII);
++INSERT INTO t (c) VALUES (REPEAT('1',65537));
++INSERT INTO t (c) VALUES (REPEAT('2',65536));
++INSERT INTO t (c) VALUES (REPEAT('3',65535));
++SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
++DROP TABLE t;
++# Bug#15776: 32-bit signed int used for length of blob
++# """LONGBLOB: A BLOB column with a maximum length of 4,294,967,295 or 4GB."""
++#
++# Conditions should be in this order:
++# A size is not in the allowed bounds.
++# If the type is char-ish AND size is within the max blob size:
++# raise ER_TOO_BIG_FIELDLENGTH (suggest using BLOB)
++# If size is too small:
++# raise ER_PARSE_ERROR
++# raise ER_TOO_BIG_DISPLAYWIDTH
++
++# BLOB and TEXT types
++--disable_warnings
++drop table if exists b15776;
++--enable_warnings
++create table b15776 (data blob(2147483647));
++drop table b15776;
++--error ER_PARSE_ERROR
++create table b15776 (data blob(-1));
++create table b15776 (data blob(2147483648));
++drop table b15776;
++create table b15776 (data blob(4294967294));
++drop table b15776;
++create table b15776 (data blob(4294967295));
++drop table b15776;
++--error ER_TOO_BIG_DISPLAYWIDTH
++create table b15776 (data blob(4294967296));
++
++CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) );
++show columns from b15776;
++drop table b15776;
++
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a blob(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a text(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++
++# Int types
++# "Another extension is supported by MySQL for optionally specifying the
++# display width of integer data types in parentheses following the base keyword
++# for the type (for example, INT(4)). This optional display width is used to
++# display integer values having a width less than the width specified for the
++# column by left-padding them with spaces." § Numeric Types
++CREATE TABLE b15776 (a int(0)); # 0 is special case, means default size
++INSERT INTO b15776 values (NULL), (1), (42), (654);
++SELECT * from b15776 ORDER BY a;
++DROP TABLE b15776;
++--error ER_PARSE_ERROR
++CREATE TABLE b15776 (a int(-1));
++CREATE TABLE b15776 (a int(255));
++DROP TABLE b15776;
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a int(256));
++--error ER_PARSE_ERROR
++CREATE TABLE b15776 (data blob(-1));
++
++# Char types
++# Recommend BLOB
++--error ER_TOO_BIG_FIELDLENGTH
++CREATE TABLE b15776 (a char(2147483647));
++--error ER_TOO_BIG_FIELDLENGTH
++CREATE TABLE b15776 (a char(2147483648));
++--error ER_TOO_BIG_FIELDLENGTH
++CREATE TABLE b15776 (a char(4294967295));
++# Even BLOB won't hold
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a char(4294967296));
++
++
++# Other numeric-ish types
++## For year, widths not "2" or "4" are silently rewritten to "4". But
++## When we complain about it, we say that the max is 255. We may be
++## talking about different things. It's confusing.
++CREATE TABLE b15776 (a year(4294967295));
++INSERT INTO b15776 VALUES (42);
++SELECT * FROM b15776;
++DROP TABLE b15776;
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a year(4294967296));
++CREATE TABLE b15776 (a year(0)); # 0 is special case, means default size
++DROP TABLE b15776;
++--error ER_PARSE_ERROR
++CREATE TABLE b15776 (a year(-2));
++
++
++# We've already tested the case, but this should visually show that
++# widths that are too large to be interpreted cause DISPLAYWIDTH errors.
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++
++## Do not select, too much memory needed.
++CREATE TABLE b15776 select cast(null as char(4294967295));
++show columns from b15776;
++drop table b15776;
++CREATE TABLE b15776 select cast(null as nchar(4294967295));
++show columns from b15776;
++drop table b15776;
++CREATE TABLE b15776 select cast(null as binary(4294967295));
++show columns from b15776;
++drop table b15776;
++
++explain select cast(1 as char(4294967295));
++explain select cast(1 as nchar(4294967295));
++explain select cast(1 as binary(4294967295));
++
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select cast(1 as char(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select cast(1 as nchar(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select cast(1 as binary(4294967296));
++
++--error ER_PARSE_ERROR
++explain select cast(1 as decimal(-1));
++explain select cast(1 as decimal(64, 30));
++# It's not as important which errors are raised for these, since the
++# limit is nowhere near 2**32. We may fix these eventually to take
++# 4294967295 and still reject it because it's greater than 64 or 30,
++# but that's not a high priority and the parser needn't worry about
++# such a weird case.
++--error ER_TOO_BIG_SCALE,ER_PARSE_ERROR
++explain select cast(1 as decimal(64, 999999999999999999999999999999));
++--error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR
++explain select cast(1 as decimal(4294967296));
++--error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR
++explain select cast(1 as decimal(999999999999999999999999999999999999));
++
++explain select convert(1, char(4294967295));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, char(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++explain select convert(1, nchar(4294967295));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, nchar(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++explain select convert(1, binary(4294967295));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, binary(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++
++--echo End of 5.0 tests
++
++#
++# Bug #33969: Updating a text field via a left join
++#
++
++CREATE TABLE t1(id INT NOT NULL);
++CREATE TABLE t2(id INT NOT NULL, c TEXT NOT NULL);
++
++INSERT INTO t1 VALUES (1);
++INSERT INTO t2 VALUES (1, '');
++
++UPDATE t2 SET c = REPEAT('1', 70000);
++SELECT LENGTH(c) FROM t2;
++
++UPDATE t1 LEFT JOIN t2 USING(id) SET t2.c = REPEAT('1', 70000) WHERE t1.id = 1;
++SELECT LENGTH(c) FROM t2;
++
++DROP TABLE t1, t2;
++
++--echo # Bug #52160: crash and inconsistent results when grouping
++--echo # by a function and column
++
++CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
++
++CREATE TABLE t1(a CHAR(1));
++INSERT INTO t1 VALUES ('0'), ('0');
++
++SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
++
++DROP FUNCTION f1;
++DROP TABLE t1;
++
++
++
++SET default_storage_engine=@old_default_storage_engine;
++
++
++########################################################################
++# Modified test from myisam-blob.test
++########################################################################
++
++SET @old_max_heap_table_size = @@global.max_heap_table_size;
++SET @old_max_allowed_packet = @@global.max_allowed_packet;
++SET GLOBAL max_heap_table_size = 18 * 1024 * 1024;
++SET GLOBAL max_allowed_packet = 24 * 1024 * 1024;
++
++connect(con1, localhost, root,,);
++connection con1;
++
++--disable_warnings
++drop table if exists t1;
++--enable_warnings
++
++# Bug #2159 (Problem with update of blob to > 16M)
++
++CREATE TABLE t1 (data LONGBLOB) ENGINE=memory;
++INSERT INTO t1 (data) VALUES (NULL);
++UPDATE t1 set data=repeat('a',18*1024*1024);
++select length(data) from t1;
++delete from t1 where left(data,1)='a';
++truncate table t1;
++INSERT INTO t1 (data) VALUES (repeat('a',1*1024*1024));
++INSERT INTO t1 (data) VALUES (repeat('b',16*1024*1024-1024));
++delete from t1 where left(data,1)='b';
++
++# now we have two blocks in the table, first is a 1M record and second is
++# a 16M delete block.
++
++UPDATE t1 set data=repeat('c',17*1024*1024);
++delete from t1 where left(data,1)='c';
++
++INSERT INTO t1 set data=repeat('a',18*1024*1024);
++select length(data) from t1;
++alter table t1 modify data blob;
++select length(data) from t1;
++drop table t1;
++
++CREATE TABLE t1 (data BLOB) ENGINE=myisam;
++INSERT INTO t1 (data) VALUES (NULL);
++UPDATE t1 set data=repeat('a',18*1024*1024);
++select length(data) from t1;
++drop table t1;
++
++disconnect con1;
++connection default;
++
++SET GLOBAL max_allowed_packet = @old_max_allowed_packet;
++SET GLOBAL max_heap_table_size = @old_max_heap_table_size;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug783366.test
+@@ -0,0 +1,19 @@
++#
++# Test for bug lp:783366
++#
++
++--disable_warnings
++drop table if exists t1;
++--enable_warnings
++
++CREATE TABLE t1 (
++ f1 VARCHAR ( 128 ) ,
++ f2 VARCHAR ( 32 ),
++ PRIMARY KEY ( f2 ( 2 ) , f1 )
++)
++ENGINE=HEAP KEY_BLOCK_SIZE = 512;
++INSERT IGNORE INTO t1 VALUES ( 'te' , 'm') , ( NULL , 'think' );
++INSERT IGNORE INTO t1 VALUES ( 'te' , 'm') , ( NULL , 'think' );
++
++DROP TABLE t1;
++
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug783451.test
+@@ -0,0 +1,16 @@
++# Testcase for the bug https://bugs.launchpad.net/percona-projects-qa/+bug/783451
++# With dynamic row format in HEAP and the UPDATE statement that significantly
++# increases the data size, the table scan in-progress desyncs its table position state.
++# Run with Valgrind if it does not crash for you.
++--disable_warnings
++DROP TABLE IF EXISTS local_1_1;
++--enable_warnings
++CREATE TABLE IF NOT EXISTS local_1_1 ( f1 VARCHAR ( 32 ) NOT NULL , f2 VARCHAR ( 128 ) NOT NULL DEFAULT 'cboepfaobilcchabvglgjdbynog' , f3 VARCHAR ( 32 ) NOT NULL , f4 VARBINARY ( 32 ) NOT NULL , f5 VARBINARY ( 1024 ) DEFAULT 'ycboepfao' , KEY ( f1 /* ( 2 ) */ , f2 /* ( 2 ) */ ) ) ENGINE=HEAP KEY_BLOCK_SIZE = 512;
++INSERT IGNORE INTO local_1_1 VALUES ( REPEAT( 'ervydbimvmbqmsowdbsa' , 1 ) , 'v' , NULL , NULL , REPEAT( 'mervydbimvmbqms' , 5 ) ) , ( 'p' , 6 , 'n' , REPEAT( 'imervydbimvmbqmsowdbs' , 4 ) , 'do' ) , ( NULL , NULL , REPEAT( 'himervydbimvmbqmsowdbsaybudvwaamvhempuublmia' , 6 ) , REPEAT('X', POW(2, 20) * 2) , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT('X', POW(2, 20) * 2) , REPEAT( 'Y' , 763 ) , NULL , REPEAT('X', POW(2, 20) * 2) , NULL ) , ( REPEAT('X', POW(2, 20) * 2) , 'time' , 'how' , 2 , REPEAT( 'Y' , 107 ) ) , ( REPEAT( 'hyshimervydbimvmbqmsowdbsaybud' , 5 ) , 2 , 8 , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( 'come' , NULL , 'i' , NULL , REPEAT('X', POW(2, 20) * 2) );
++INSERT IGNORE INTO local_1_1 VALUES ( 'ok' , NULL , REPEAT( 'Y' , 651 ) , 2 , 5 ) , ( REPEAT( 'zylcdzkfrqpihyshimervydbimvmbqmsowdbsaybu' , 3 ) , REPEAT( 'Y' , 282 ) , REPEAT( 'X' , 0 ) , REPEAT( 'Y' , 369 ) , 'g' ) , ( 'think' , REPEAT('X', POW(2, 20) * 2), NULL , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT( 'Y' , 468 ) , REPEAT( 'dfvbrzylcd' , 6 ) , REPEAT( 'Y' , 264 ) , NULL , 'c' ) , ( NULL , NULL , REPEAT( 'srdfvbrzylcdzkfrqpihyshimervydbimvmbqms' , 0 ) , REPEAT( 'Y' , 244 ) , 7 ) , ( REPEAT( 'Y' , 0 ) , 'how' , 'going' , 'q' , NULL );
++INSERT IGNORE INTO local_1_1 VALUES ( REPEAT('X', POW(2, 20) * 2) , NULL , NULL , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT('X', POW(2, 20) * 2) , NULL , REPEAT('X', POW(2, 20) * 2) , 'this' , 'e' ) , ( NULL , 'think' , NULL , 'were' , NULL ) , ( 9 , 'l' , 'c' , 3 , REPEAT( 'geysrdfvbrzylcdzkfrqpihyshimervydbi' , 5 ) ) , ( NULL , NULL , NULL , 'h' , 'w' );
++--enable_warnings
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++UPDATE local_1_1 SET f5 = REPEAT ('X', 215566);
++DROP TABLE local_1_1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug784464.test
+@@ -0,0 +1,64 @@
++#
++# Bug #784464: Silent conversion from Dynamic to Fixed row_format for certain
++# values of key_block_size.
++# Also see percona_heap_bug784464_32bit and percona_heap_bug784464_64bit tests.
++#
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++ PRIMARY KEY (f1)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++--error ER_CANT_USE_OPTION_HERE
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=33 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=34 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=123 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=1000 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++ PRIMARY KEY (f1)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++--error ER_CANT_USE_OPTION_HERE
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=33 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=34 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=121 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=1000 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug784464_32bit.test
+@@ -0,0 +1,15 @@
++# 32-bit platform specific parts of tests for LP bug #784464
++
++--source include/have_32bit.inc
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=124 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=122 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug784464_64bit.test
+@@ -0,0 +1,15 @@
++# 64-bit platform specific parts of tests for LP bug #784464
++
++--source include/have_64bit.inc
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=124 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++ PRIMARY KEY (f1)) KEY_BLOCK_SIZE=122 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug784468.test
+@@ -0,0 +1,19 @@
++#
++# Bug #784468: Tables with VARCHAR(<31) are created as row_format = Fixed
++#
++
++CREATE TABLE t1 ( f1 VARCHAR(30)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 ( f1 VARCHAR(31)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 ( f1 VARCHAR(32)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 8 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug788544.test
+@@ -0,0 +1,15 @@
++#
++# Bug #788544: Valgrind warnings/crash in mysql-55-eb-blobs in
++# hp_extract_record / hp_process_field_data_to_chunkset
++#
++
++CREATE TABLE t1 (f2 VARCHAR (32), f4 LONGBLOB, f5 TEXT) ENGINE=HEAP;
++
++INSERT INTO t1 VALUES ('a', NULL, NULL),
++ ('b' , REPEAT('a' , 593338), REPEAT('a', 800));
++
++UPDATE t1 SET f2 = 'c' WHERE f4 = 'd';
++
++SELECT LENGTH(f2), LENGTH(f4), LENGTH(f5) FROM t1;
++
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug788576.test
+@@ -0,0 +1,19 @@
++#
++# Bug #788576: Second crash in hp_movelink with mysql-55-eb
++#
++
++CREATE TABLE t1 (f1 VARCHAR (32), f2 VARCHAR (128), f3 VARBINARY (128),
++ f4 VARBINARY (512), f5 VARBINARY (1024),
++ KEY (f2(1))) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++
++INSERT IGNORE INTO t1 VALUES (2, NULL, 6, REPEAT('glugcgqk', 5), 'look'),
++ (REPEAT( 'kglugcgqkin', 6), 'if', 'was', NULL, NULL),
++ (NULL, NULL, NULL, NULL, 7);
++
++SELECT * FROM t1;
++
++DELETE FROM t1 WHERE f5 <=> NULL;
++
++SELECT * FROM t1;
++
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug788722.test
+@@ -0,0 +1,20 @@
++#
++# Bug #788722: Second valgrind warning around hp_extract_record in mysql-55-eb-blobs
++#
++
++CREATE TABLE IF NOT EXISTS local_1_1 (f1 VARCHAR (32) NOT NULL,
++ f2 VARCHAR (128) NOT NULL,
++ f3 BLOB NOT NULL,
++ f4 TEXT,
++ f5 BLOB (1024),
++ PRIMARY KEY (f1),
++ KEY (f1 , f2)
++) ENGINE=HEAP ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE = 2048;
++
++INSERT IGNORE INTO local_1_1 VALUES
++ (REPEAT('egqeqfxwaejpqixuvvtentruyqadxiybjdfqjspfbyjdjczrrwjnagkzsoagatqookhsgtrvvbxacppljfzaseidqggxvuirm' , 5), NULL, NULL, NULL, REPEAT('hegqeqfxwaejpqixuvvtentruyqadxiy', 1)),
++ ('you', NULL, 0, REPEAT("X", 2048) , 0);
++
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++
++DROP TABLE local_1_1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug789131.test
+@@ -0,0 +1,14 @@
++#
++# Bug #789131: Valgrind warning in MyISAM in mysql-55-eb-blobs
++#
++
++CREATE TABLE t1 (f1 VARCHAR (128), f2 VARCHAR (128), f3 VARBINARY (512),
++ f4 TEXT (65525), f5 VARCHAR (128), KEY (f1(1))) ENGINE=HEAP;
++
++INSERT IGNORE INTO t1 VALUES
++ ( 'o' , "" , NULL , "" , 0 ) ,
++ (NULL, "" , "" , "" , 'f' ) ;
++
++INSERT IGNORE INTO t1 SELECT * FROM t1;
++
++DROP TABLE t1;
+\ No newline at end of file
+--- /dev/null
++++ b/mysql-test/t/percona_heap_var.test
+@@ -0,0 +1,85 @@
++#
++# Test heap tables with variable-sized records.
++#
++
++--disable_warnings
++drop table if exists t1;
++--enable_warnings
++
++set @@session.max_heap_table_size=16*1024*1024;
++
++--error 1234
++create table t1 (a int not null, b varchar(400), c int, primary key (a), key (c)) engine=heap comment="testing heaps" key_block_size=128;
++
++--error 1234
++create table t1 (a int not null, b int, c varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" key_block_size=4;
++
++create table t1 (a int not null, b int, c varchar(400), d varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" key_block_size=24;
++
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--query_vertical show table status like "t1"
++
++insert into t1 values (1,1,'012',NULL), (2,2,'0123456789',NULL), (3,3,'012345678901234567890123456789',NULL), (4,4,NULL,'0123456789012345678901234567890123456789012345678901234567890123456789');
++select * from t1;
++
++delete from t1 where a = 3;
++select * from t1;
++
++insert into t1 values (5,5,NULL,'0123'), (6,6,NULL,'0123');
++select * from t1;
++
++update t1 set c = '012345678901234567890123456789' where a = 2;
++select * from t1;
++
++update t1 set c = '0123456789' where a = 2;
++select * from t1;
++
++insert into t1 values (7,7,'0123',NULL), (8,8,'0123',NULL);
++select * from t1;
++
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--query_vertical show table status like "t1"
++alter table t1 key_block_size = 0;
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--query_vertical show table status like "t1"
++alter table t1 row_format = dynamic;
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--replace_regex /KEY_BLOCK_SIZE=[[:digit:]]+/KEY_BLOCK_SIZE=X/
++--query_vertical show table status like "t1"
++alter table t1 key_block_size = 128, max_rows = 10001;
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--query_vertical show table status like "t1"
++
++select * from t1;
++
++delete from t1;
++select * from t1;
++
++let $1=10001;
++
++call mtr.add_suppression("The table 't1' is full");
++
++disable_query_log;
++
++while ($1)
++{
++
++ eval insert into t1 values ($1,$1,$1,$1);
++
++ dec $1;
++
++}
++enable_query_log;
++
++select count(*) from t1;
++
++--error 1114
++insert into t1 values (100000,100000,NULL,'0123'), (100000,100000,NULL,'0123');
++
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--query_vertical show table status like "t1"
++select count(*) from t1;
++
++set @@session.max_heap_table_size=default;
++
++drop table t1;
#!!! notice !!!
# Any small change to this file in the main branch
# should be done or reviewed by the maintainer!
---- /dev/null
-+++ b/patch_info/microsec_process.info
+--- /dev/null 1970-01-01 09:00:00.000000000 +0900
++++ b/patch_info/microsec_process.info 2010-12-02 20:41:41.616069579 +0900
@@ -0,0 +1,8 @@
+File=microsec_process.patch
+Name=Adds INFOMATION_SCHEMA.PROCESSLIST with TIME_MS column
+Comment=
+2010-01
+Ported to 5.1.42
---- a/sql/sql_show.cc
-+++ b/sql/sql_show.cc
+--- a/sql/sql_show.cc 2010-12-02 19:22:40.054024541 +0900
++++ b/sql/sql_show.cc 2010-12-02 20:41:41.622941425 +0900
@@ -1890,7 +1890,8 @@
TABLE *table= tables->table;
CHARSET_INFO *cs= system_charset_info;
if (schema_table_store_record(thd, table))
{
mysql_mutex_unlock(&LOCK_thread_count);
-@@ -7441,6 +7446,8 @@
+@@ -7409,6 +7414,8 @@
{"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE},
{"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info",
SKIP_OPEN_TABLE},
Summary(zh_CN.UTF-8): MySQL数据库服务器
Name: mysql
Version: 5.5.15
-Release: 2
+Release: 3
License: GPL + MySQL FLOSS Exception
Group: Applications/Databases
# Source0Download: http://dev.mysql.com/downloads/mysql/5.5.html#downloads
Patch133: query_cache_enhance.patch
Patch134: log_connection_error.patch
Patch135: mysql_syslog.patch
-Patch136: response_time_distribution.patch
-Patch137: error_pad.patch
+Patch136: error_pad.patch
+Patch137: response_time_distribution.patch
Patch138: remove_fcntl_excessive_calls.patch
Patch139: sql_no_fcache.patch
Patch140: show_slave_status_nolock.patch
Patch152: bug813587.patch
Patch153: valgrind_zlib_suppression.patch
Patch154: memory_dynamic_rows.patch
+Patch155: xtradb_bug317074.patch
# </percona>
URL: http://www.mysql.com/products/community/
BuildRequires: bison
%patch152 -p1
%patch153 -p1
%patch154 -p1
+%patch155 -p1
# </percona>
# to get these files rebuild
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
+--- /dev/null
++++ b/mysql-test/include/percona_processlist_row_stats_show.inc
+@@ -0,0 +1,7 @@
++--replace_column 1 ### 3 ### 6 ### 7 ###
++SHOW PROCESSLIST;
++
++--replace_column 1 ###
++SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
++
++SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
+--- /dev/null
++++ b/mysql-test/r/percona_processlist_row_stats.result
+@@ -0,0 +1,70 @@
++DROP TABLE IF EXISTS t1;
++DROP TABLE IF EXISTS t2;
++CREATE TABLE t2 (a INT);
++INSERT INTO t2 VALUES(10);
++INSERT INTO t2 VALUES(10);
++INSERT INTO t2 VALUES(20);
++INSERT INTO t2 VALUES(10);
++INSERT INTO t2 VALUES(20);
++SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped';
++CREATE TABLE t1 (a INT);
++SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
++SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
++SELECT a FROM t2 WHERE a > 15;
++SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
++SHOW PROCESSLIST;
++Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
++### root ### test Query ### ### SHOW PROCESSLIST 0 0 2
++### root ### test Query ### ### CREATE TABLE t1 (a INT) 0 0 1
++### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 2 5 6
++SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
++id info rows_sent rows_examined rows_read
++### SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id 0 0 1
++### CREATE TABLE t1 (a INT) 0 0 1
++### SELECT a FROM t2 WHERE a > 15 2 5 6
++SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
++a
++20
++20
++SET DEBUG_SYNC= 'sent_row SIGNAL thread1_ready WAIT_FOR threads_dumped';
++SELECT a FROM t2 WHERE a < 15;
++SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
++SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped';
++SELECT a FROM t2 WHERE a > 15;
++SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
++SHOW PROCESSLIST;
++Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
++### root ### test Query ### ### SHOW PROCESSLIST 0 0 4
++### root ### test Query ### ### SELECT a FROM t2 WHERE a < 15 1 0 1
++### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 1 0 3
++SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
++id info rows_sent rows_examined rows_read
++### SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id 0 0 1
++### SELECT a FROM t2 WHERE a < 15 1 0 1
++### SELECT a FROM t2 WHERE a > 15 1 0 3
++SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
++a
++10
++10
++10
++a
++20
++20
++SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread1_ready WAIT_FOR threads_dumped';
++UPDATE t2 SET a = 15 WHERE a = 20;
++SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
++SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
++UPDATE t2 SET a = 15 WHERE a = 10;
++SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
++SHOW PROCESSLIST;
++Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
++### root ### test Query ### ### SHOW PROCESSLIST 0 0 4
++### root ### test Query ### ### UPDATE t2 SET a = 15 WHERE a = 20 0 5 6
++### root ### test Query ### ### UPDATE t2 SET a = 15 WHERE a = 10 0 5 6
++SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
++id info rows_sent rows_examined rows_read
++### SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id 0 0 1
++### UPDATE t2 SET a = 15 WHERE a = 20 0 5 6
++### UPDATE t2 SET a = 15 WHERE a = 10 0 5 6
++SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
++DROP TABLES t1, t2;
+--- /dev/null
++++ b/mysql-test/t/percona_processlist_row_stats.test
+@@ -0,0 +1,79 @@
++# Testing of INFORMATION_SCHEMA.PROCESSLIST fields ROWS_SENT, ROWS_EXAMINED, ROWS_READ
++--source include/have_debug_sync.inc
++
++--disable_warnings
++DROP TABLE IF EXISTS t1;
++DROP TABLE IF EXISTS t2;
++--enable_warnings
++
++CREATE TABLE t2 (a INT);
++INSERT INTO t2 VALUES(10);
++INSERT INTO t2 VALUES(10);
++INSERT INTO t2 VALUES(20);
++INSERT INTO t2 VALUES(10);
++INSERT INTO t2 VALUES(20);
++
++--connect (conn1, localhost, root, ,)
++--connect (conn2, localhost, root, ,)
++
++--connection conn1
++SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped';
++send CREATE TABLE t1 (a INT);
++--connection default
++SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
++
++--connection conn2
++SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
++send SELECT a FROM t2 WHERE a > 15;
++--connection default
++SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
++
++--source include/percona_processlist_row_stats_show.inc
++
++--connection conn1
++reap;
++--connection conn2
++reap;
++
++--connection conn1
++SET DEBUG_SYNC= 'sent_row SIGNAL thread1_ready WAIT_FOR threads_dumped';
++send SELECT a FROM t2 WHERE a < 15;
++--connection default
++SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
++
++--connection conn2
++SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped';
++send SELECT a FROM t2 WHERE a > 15;
++--connection default
++SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
++
++--source include/percona_processlist_row_stats_show.inc
++
++--connection conn1
++reap;
++--connection conn2
++reap;
++
++--connection conn1
++SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread1_ready WAIT_FOR threads_dumped';
++send UPDATE t2 SET a = 15 WHERE a = 20;
++--connection default
++SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
++
++--connection conn2
++SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
++send UPDATE t2 SET a = 15 WHERE a = 10;
++--connection default
++SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
++
++--source include/percona_processlist_row_stats_show.inc
++
++--connection conn1
++reap;
++--connection conn2
++reap;
++
++--connection default
++disconnect conn1;
++disconnect conn2;
++DROP TABLES t1, t2;
static Sys_var_ulong Sys_query_cache_limit(
"query_cache_limit",
"Don't cache results that are bigger than this",
+--- /dev/null
++++ b/mysql-test/include/percona_query_cache_with_comments.inc
+@@ -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
+--- /dev/null
++++ b/mysql-test/include/percona_query_cache_with_comments_begin.inc
+@@ -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
+--- /dev/null
++++ b/mysql-test/include/percona_query_cache_with_comments_clear.inc
+@@ -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;
+--- /dev/null
++++ b/mysql-test/include/percona_query_cache_with_comments_end.inc
+@@ -0,0 +1,3 @@
++DROP TABLE t1;
++SET GLOBAL query_cache_size=default;
++set global query_cache_strip_comments=OFF;
+--- /dev/null
++++ b/mysql-test/include/percona_query_cache_with_comments_eval.inc
+@@ -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
+--- /dev/null
++++ b/mysql-test/include/percona_query_cache_with_comments_show.inc
+@@ -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;
++
++
+--- /dev/null
++++ b/mysql-test/r/percona_query_cache_with_comments.result
+@@ -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;
+--- /dev/null
++++ b/mysql-test/r/percona_query_cache_with_comments_crash.result
+@@ -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;
+--- /dev/null
++++ b/mysql-test/r/percona_query_cache_with_comments_disable.result
+@@ -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;
+--- /dev/null
++++ b/mysql-test/r/percona_query_cache_with_comments_prepared_statements.result
+@@ -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;
+--- /dev/null
++++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result
+@@ -0,0 +1,23 @@
++SET GLOBAL query_cache_size=1355776;
++flush query cache;
++flush query cache;
++reset query cache;
++flush status;
++DROP TABLE IF EXISTS t;
++CREATE TABLE t(id INT, number INT);
++INSERT INTO t VALUES (0,1);
++INSERT INTO t VALUES (1,2);
++INSERT INTO t VALUES (2,3);
++SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
++SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
++SELECT number from t where id > 0;
++SHOW PROCESSLIST;
++Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
++### root ### test Query ### NULL SHOW PROCESSLIST ### ### ###
++### root ### test Query ### Waiting on query cache mutex SELECT number from t where id > 0 ### ### ###
++SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
++id info state
++### SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id executing
++### SELECT number from t where id > 0 Waiting on query cache mutex
++DROP TABLE t;
++SET GLOBAL query_cache_size=0;
+--- /dev/null
++++ b/mysql-test/t/percona_query_cache_with_comments.test
+@@ -0,0 +1,5 @@
++--disable_ps_protocol
++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
+--- /dev/null
++++ b/mysql-test/t/percona_query_cache_with_comments_crash.test
+@@ -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;
+--- /dev/null
++++ b/mysql-test/t/percona_query_cache_with_comments_disable.test
+@@ -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
+--- /dev/null
++++ b/mysql-test/t/percona_query_cache_with_comments_prepared_statements.test
+@@ -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;
+--- /dev/null
++++ b/mysql-test/t/percona_status_wait_query_cache_mutex.test
+@@ -0,0 +1,31 @@
++--source include/have_query_cache.inc
++--source include/have_debug.inc
++--source include/have_debug_sync.inc
++SET GLOBAL query_cache_size=1355776;
++--source include/percona_query_cache_with_comments_clear.inc
++
++-- disable_warnings
++DROP TABLE IF EXISTS t;
++-- enable_warnings
++CREATE TABLE t(id INT, number INT);
++INSERT INTO t VALUES (0,1);
++INSERT INTO t VALUES (1,2);
++INSERT INTO t VALUES (2,3);
++
++--connect (conn,localhost,root,,)
++
++--connection conn
++SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
++SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
++SEND SELECT number from t where id > 0;
++
++--connection default
++--replace_column 1 ### 3 ### 6 ### 9 ### 10 ### 11 ###
++SHOW PROCESSLIST;
++
++--replace_column 1 ###
++SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
++
++--disconnect conn
++DROP TABLE t;
++SET GLOBAL query_cache_size=0;
#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
--- /dev/null
++++ b/mysql-test/include/have_response_time_distribution.inc
+@@ -0,0 +1,4 @@
++-- require r/have_response_time_distribution.require
++disable_query_log;
++show variables like 'have_response_time_distribution';
++enable_query_log;
+--- /dev/null
++++ b/mysql-test/include/query_response_time.inc
+@@ -0,0 +1,39 @@
++SET SESSION query_exec_time=0.1;
++
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++EVAL SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++
++SET SESSION query_exec_time=0.31; SELECT 1;
++SET SESSION query_exec_time=0.32; SELECT 1;
++SET SESSION query_exec_time=0.33; SELECT 1;
++SET SESSION query_exec_time=0.34; SELECT 1;
++SET SESSION query_exec_time=0.35; SELECT 1;
++SET SESSION query_exec_time=0.36; SELECT 1;
++SET SESSION query_exec_time=0.37; SELECT 1;
++SET SESSION query_exec_time=0.38; SELECT 1;
++SET SESSION query_exec_time=0.39; SELECT 1;
++SET SESSION query_exec_time=0.4; SELECT 1;
++SET SESSION query_exec_time=1.1; SELECT 1;
++SET SESSION query_exec_time=1.2; SELECT 1;
++SET SESSION query_exec_time=1.3; SELECT 1;
++SET SESSION query_exec_time=1.5; SELECT 1;
++SET SESSION query_exec_time=1.4; SELECT 1;
++SET SESSION query_exec_time=0.5; SELECT 1;
++SET SESSION query_exec_time=2.1; SELECT 1;
++SET SESSION query_exec_time=2.3; SELECT 1;
++SET SESSION query_exec_time=2.5; SELECT 1;
++SET SESSION query_exec_time=3.1; SELECT 1;
++SET SESSION query_exec_time=4.1; SELECT 1;
++SET SESSION query_exec_time=5.1; SELECT 1;
++
++SET SESSION query_exec_time=0.1;
++
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++SHOW QUERY_RESPONSE_TIME;
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++
++SET SESSION query_exec_time=default;
+--- /dev/null
++++ b/mysql-test/include/query_response_time-replication.inc
+@@ -0,0 +1,57 @@
++connection master;
++
++CREATE TABLE t(id INT);
++
++connection slave;
++SET GLOBAL query_exec_time = 0.1;
++--source include/restart_slave_sql.inc
++
++connection slave;
++
++SET SESSION query_exec_time=0.1;
++
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++--eval SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++
++connection master;
++
++SET SESSION query_exec_time = 0.31; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.32; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.33; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.34; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.35; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.36; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.37; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.38; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.39; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.4; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.1; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.2; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.3; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.5; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.4; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.5; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.1; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.3; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.5; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 3.1; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 4.1; INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 5.1; INSERT INTO t VALUES(1);
++
++sync_slave_with_master;
++
++connection slave;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++SHOW QUERY_RESPONSE_TIME;
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
++
++connection master;
++DROP TABLE t;
++
++sync_slave_with_master;
+--- /dev/null
++++ b/mysql-test/include/query_response_time-stored.inc
+@@ -0,0 +1,37 @@
++SET SESSION query_exec_time=0.1;
++
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++EVAL SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++
++CALL test_f(0.31);
++CALL test_f(0.32);
++CALL test_f(0.33);
++CALL test_f(0.34);
++CALL test_f(0.35);
++CALL test_f(0.36);
++CALL test_f(0.37);
++CALL test_f(0.38);
++CALL test_f(0.39);
++CALL test_f(0.4);
++CALL test_f(1.1);
++CALL test_f(1.2);
++CALL test_f(1.3);
++CALL test_f(1.5);
++CALL test_f(1.4);
++CALL test_f(0.5);
++CALL test_f(2.1);
++CALL test_f(2.3);
++CALL test_f(2.5);
++CALL test_f(3.1);
++CALL test_f(4.1);
++CALL test_f(5.1);
++
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++SHOW QUERY_RESPONSE_TIME;
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++
++SET SESSION query_exec_time=default;
+--- /dev/null
++++ b/mysql-test/r/percona_query_response_time-replication.result
+@@ -0,0 +1,727 @@
++SET GLOBAL query_exec_time=0.1;
++include/master-slave.inc
++[connection master]
++CREATE TABLE t(id INT);
++SET GLOBAL query_exec_time = 0.1;
++include/restart_slave.inc
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1;
++Warnings:
++Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time = 0.31;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.32;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.33;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.34;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.35;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.36;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.37;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.38;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.39;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.2;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 3.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 4.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 5.1;
++INSERT INTO t VALUES(1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 2
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 2 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 3 0.300000
++ 0.250000 0 0.000000
++ 0.500000 30 10.650000
++ 1.000000 3 1.500000
++ 2.000000 15 19.500000
++ 4.000000 12 30.000000
++ 8.000000 6 27.599997
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 2 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 4 0.400000
++ 0.250000 0 0.000000
++ 0.500000 30 10.650000
++ 1.000000 3 1.500000
++ 2.000000 15 19.500000
++ 4.000000 12 30.000000
++ 8.000000 6 27.599997
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
++DROP TABLE t;
++CREATE TABLE t(id INT);
++SET GLOBAL query_exec_time = 0.1;
++include/restart_slave.inc
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time = 0.31;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.32;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.33;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.34;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.35;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.36;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.37;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.38;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.39;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.2;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 3.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 4.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 5.1;
++INSERT INTO t VALUES(1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 2
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 2 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 3 0.300000
++ 0.250000 0 0.000000
++ 0.500000 30 10.650000
++ 1.000000 3 1.500000
++ 2.000000 15 19.500000
++ 4.000000 12 30.000000
++ 8.000000 6 27.599997
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 2 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 4 0.400000
++ 0.250000 0 0.000000
++ 0.500000 30 10.650000
++ 1.000000 3 1.500000
++ 2.000000 15 19.500000
++ 4.000000 12 30.000000
++ 8.000000 6 27.599997
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
++DROP TABLE t;
++CREATE TABLE t(id INT);
++SET GLOBAL query_exec_time = 0.1;
++include/restart_slave.inc
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time = 0.31;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.32;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.33;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.34;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.35;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.36;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.37;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.38;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.39;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.2;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 3.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 4.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 5.1;
++INSERT INTO t VALUES(1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 10
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 2 0.000000
++ 0.000010 0 0.000000
++ 0.000100 0 0.000000
++ 0.001000 0 0.000000
++ 0.010000 0 0.000000
++ 0.100000 0 0.000000
++ 1.000000 36 12.450000
++ 10.000000 33 77.099997
++ 100.000000 0 0.000000
++ 1000.000000 0 0.000000
++ 10000.000000 0 0.000000
++ 100000.000000 0 0.000000
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 2 0.000000
++ 0.000010 0 0.000000
++ 0.000100 0 0.000000
++ 0.001000 0 0.000000
++ 0.010000 0 0.000000
++ 0.100000 0 0.000000
++ 1.000000 37 12.550000
++ 10.000000 33 77.099997
++ 100.000000 0 0.000000
++ 1000.000000 0 0.000000
++ 10000.000000 0 0.000000
++ 100000.000000 0 0.000000
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
++DROP TABLE t;
++CREATE TABLE t(id INT);
++SET GLOBAL query_exec_time = 0.1;
++include/restart_slave.inc
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time = 0.31;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.32;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.33;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.34;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.35;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.36;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.37;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.38;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.39;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.2;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 3.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 4.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 5.1;
++INSERT INTO t VALUES(1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 7
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 2 0.000000
++ 0.000008 0 0.000000
++ 0.000059 0 0.000000
++ 0.000416 0 0.000000
++ 0.002915 0 0.000000
++ 0.020408 0 0.000000
++ 0.142857 3 0.300000
++ 1.000000 33 12.150000
++ 7.000000 33 77.099997
++ 49.000000 0 0.000000
++ 343.000000 0 0.000000
++ 2401.000000 0 0.000000
++ 16807.000000 0 0.000000
++ 117649.000000 0 0.000000
++ 823543.000000 0 0.000000
++ 5764801.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 2 0.000000
++ 0.000008 0 0.000000
++ 0.000059 0 0.000000
++ 0.000416 0 0.000000
++ 0.002915 0 0.000000
++ 0.020408 0 0.000000
++ 0.142857 4 0.400000
++ 1.000000 33 12.150000
++ 7.000000 33 77.099997
++ 49.000000 0 0.000000
++ 343.000000 0 0.000000
++ 2401.000000 0 0.000000
++ 16807.000000 0 0.000000
++ 117649.000000 0 0.000000
++ 823543.000000 0 0.000000
++ 5764801.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
++DROP TABLE t;
++CREATE TABLE t(id INT);
++SET GLOBAL query_exec_time = 0.1;
++include/restart_slave.inc
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time = 0.31;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.32;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.33;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.34;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.35;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.36;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.37;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.38;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.39;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.2;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 3.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 4.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 5.1;
++INSERT INTO t VALUES(1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 156
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000041 2 0.000000
++ 0.006410 0 0.000000
++ 1.000000 36 12.450000
++ 156.000000 33 77.099997
++ 24336.000000 0 0.000000
++ 3796416.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000041 2 0.000000
++ 0.006410 0 0.000000
++ 1.000000 37 12.550000
++ 156.000000 33 77.099997
++ 24336.000000 0 0.000000
++ 3796416.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
++DROP TABLE t;
++CREATE TABLE t(id INT);
++SET GLOBAL query_exec_time = 0.1;
++include/restart_slave.inc
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time = 0.31;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.32;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.33;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.34;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.35;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.36;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.37;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.38;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.39;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.2;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 3.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 4.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 5.1;
++INSERT INTO t VALUES(1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 1000
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 2 0.000000
++ 0.001000 0 0.000000
++ 1.000000 36 12.450000
++ 1000.000000 33 77.099997
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 2 0.000000
++ 0.001000 0 0.000000
++ 1.000000 37 12.550000
++ 1000.000000 33 77.099997
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
++DROP TABLE t;
++CREATE TABLE t(id INT);
++SET GLOBAL query_exec_time = 0.1;
++include/restart_slave.inc
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001;
++Warnings:
++Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time = 0.31;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.32;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.33;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.34;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.35;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.36;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.37;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.38;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.39;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.2;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 1.4;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 0.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.3;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 2.5;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 3.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 4.1;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time = 5.1;
++INSERT INTO t VALUES(1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 1000
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 2 0.000000
++ 0.001000 0 0.000000
++ 1.000000 36 12.450000
++ 1000.000000 33 77.099997
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 2 0.000000
++ 0.001000 0 0.000000
++ 1.000000 37 12.550000
++ 1000.000000 33 77.099997
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
++DROP TABLE t;
++include/rpl_end.inc
++SET GLOBAL query_exec_time=default;
++SET GLOBAL query_exec_time=default;
+--- /dev/null
++++ b/mysql-test/r/percona_query_response_time.result
+@@ -0,0 +1,1003 @@
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1;
++Warnings:
++Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time=0.31;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.32;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.33;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.34;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.35;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.36;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.37;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.38;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.39;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.2;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=3.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=4.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=5.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 2
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 25 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 2 0.200000
++ 0.250000 0 0.000000
++ 0.500000 10 3.550000
++ 1.000000 1 0.500000
++ 2.000000 5 6.500000
++ 4.000000 4 10.000000
++ 8.000000 2 9.199999
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 25 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 3 0.300000
++ 0.250000 0 0.000000
++ 0.500000 10 3.550000
++ 1.000000 1 0.500000
++ 2.000000 5 6.500000
++ 4.000000 4 10.000000
++ 8.000000 2 9.199999
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time=0.31;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.32;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.33;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.34;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.35;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.36;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.37;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.38;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.39;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.2;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=3.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=4.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=5.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 2
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 25 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 2 0.200000
++ 0.250000 0 0.000000
++ 0.500000 10 3.550000
++ 1.000000 1 0.500000
++ 2.000000 5 6.500000
++ 4.000000 4 10.000000
++ 8.000000 2 9.199999
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 25 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 3 0.300000
++ 0.250000 0 0.000000
++ 0.500000 10 3.550000
++ 1.000000 1 0.500000
++ 2.000000 5 6.500000
++ 4.000000 4 10.000000
++ 8.000000 2 9.199999
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time=0.31;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.32;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.33;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.34;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.35;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.36;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.37;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.38;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.39;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.2;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=3.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=4.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=5.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 10
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 25 0.000000
++ 0.000010 0 0.000000
++ 0.000100 0 0.000000
++ 0.001000 0 0.000000
++ 0.010000 0 0.000000
++ 0.100000 0 0.000000
++ 1.000000 13 4.250000
++ 10.000000 11 25.699999
++ 100.000000 0 0.000000
++ 1000.000000 0 0.000000
++ 10000.000000 0 0.000000
++ 100000.000000 0 0.000000
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 25 0.000000
++ 0.000010 0 0.000000
++ 0.000100 0 0.000000
++ 0.001000 0 0.000000
++ 0.010000 0 0.000000
++ 0.100000 0 0.000000
++ 1.000000 14 4.350000
++ 10.000000 11 25.699999
++ 100.000000 0 0.000000
++ 1000.000000 0 0.000000
++ 10000.000000 0 0.000000
++ 100000.000000 0 0.000000
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time=0.31;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.32;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.33;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.34;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.35;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.36;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.37;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.38;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.39;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.2;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=3.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=4.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=5.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 7
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 25 0.000000
++ 0.000008 0 0.000000
++ 0.000059 0 0.000000
++ 0.000416 0 0.000000
++ 0.002915 0 0.000000
++ 0.020408 0 0.000000
++ 0.142857 2 0.200000
++ 1.000000 11 4.050000
++ 7.000000 11 25.699999
++ 49.000000 0 0.000000
++ 343.000000 0 0.000000
++ 2401.000000 0 0.000000
++ 16807.000000 0 0.000000
++ 117649.000000 0 0.000000
++ 823543.000000 0 0.000000
++ 5764801.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 25 0.000000
++ 0.000008 0 0.000000
++ 0.000059 0 0.000000
++ 0.000416 0 0.000000
++ 0.002915 0 0.000000
++ 0.020408 0 0.000000
++ 0.142857 3 0.300000
++ 1.000000 11 4.050000
++ 7.000000 11 25.699999
++ 49.000000 0 0.000000
++ 343.000000 0 0.000000
++ 2401.000000 0 0.000000
++ 16807.000000 0 0.000000
++ 117649.000000 0 0.000000
++ 823543.000000 0 0.000000
++ 5764801.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time=0.31;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.32;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.33;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.34;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.35;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.36;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.37;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.38;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.39;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.2;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=3.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=4.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=5.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 156
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000041 25 0.000000
++ 0.006410 0 0.000000
++ 1.000000 13 4.250000
++ 156.000000 11 25.699999
++ 24336.000000 0 0.000000
++ 3796416.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000041 25 0.000000
++ 0.006410 0 0.000000
++ 1.000000 14 4.350000
++ 156.000000 11 25.699999
++ 24336.000000 0 0.000000
++ 3796416.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time=0.31;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.32;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.33;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.34;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.35;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.36;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.37;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.38;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.39;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.2;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=3.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=4.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=5.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 1000
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 25 0.000000
++ 0.001000 0 0.000000
++ 1.000000 13 4.250000
++ 1000.000000 11 25.699999
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 25 0.000000
++ 0.001000 0 0.000000
++ 1.000000 14 4.350000
++ 1000.000000 11 25.699999
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001;
++Warnings:
++Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++SET SESSION query_exec_time=0.31;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.32;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.33;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.34;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.35;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.36;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.37;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.38;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.39;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.2;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=1.4;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.3;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=2.5;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=3.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=4.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=5.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 1000
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 25 0.000000
++ 0.001000 0 0.000000
++ 1.000000 13 4.250000
++ 1000.000000 11 25.699999
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 25 0.000000
++ 0.001000 0 0.000000
++ 1.000000 14 4.350000
++ 1000.000000 11 25.699999
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
+--- /dev/null
++++ b/mysql-test/r/percona_query_response_time-stored.result
+@@ -0,0 +1,544 @@
++CREATE TABLE t(a INT);
++CREATE PROCEDURE test_f(t DECIMAL(3,2))
++BEGIN
++SET SESSION query_exec_time=t;
++INSERT INTO t VALUES(1);
++SET SESSION query_exec_time=0.1;
++DELETE FROM t;
++END^
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1;
++Warnings:
++Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++CALL test_f(0.31);
++CALL test_f(0.32);
++CALL test_f(0.33);
++CALL test_f(0.34);
++CALL test_f(0.35);
++CALL test_f(0.36);
++CALL test_f(0.37);
++CALL test_f(0.38);
++CALL test_f(0.39);
++CALL test_f(0.4);
++CALL test_f(1.1);
++CALL test_f(1.2);
++CALL test_f(1.3);
++CALL test_f(1.5);
++CALL test_f(1.4);
++CALL test_f(0.5);
++CALL test_f(2.1);
++CALL test_f(2.3);
++CALL test_f(2.5);
++CALL test_f(3.1);
++CALL test_f(4.1);
++CALL test_f(5.1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 2
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 46 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 46 4.600000
++ 0.250000 0 0.000000
++ 0.500000 10 3.550000
++ 1.000000 1 0.500000
++ 2.000000 5 6.500000
++ 4.000000 4 10.000000
++ 8.000000 2 9.199999
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 46 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 47 4.700000
++ 0.250000 0 0.000000
++ 0.500000 10 3.550000
++ 1.000000 1 0.500000
++ 2.000000 5 6.500000
++ 4.000000 4 10.000000
++ 8.000000 2 9.199999
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++CALL test_f(0.31);
++CALL test_f(0.32);
++CALL test_f(0.33);
++CALL test_f(0.34);
++CALL test_f(0.35);
++CALL test_f(0.36);
++CALL test_f(0.37);
++CALL test_f(0.38);
++CALL test_f(0.39);
++CALL test_f(0.4);
++CALL test_f(1.1);
++CALL test_f(1.2);
++CALL test_f(1.3);
++CALL test_f(1.5);
++CALL test_f(1.4);
++CALL test_f(0.5);
++CALL test_f(2.1);
++CALL test_f(2.3);
++CALL test_f(2.5);
++CALL test_f(3.1);
++CALL test_f(4.1);
++CALL test_f(5.1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 2
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 46 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 46 4.600000
++ 0.250000 0 0.000000
++ 0.500000 10 3.550000
++ 1.000000 1 0.500000
++ 2.000000 5 6.500000
++ 4.000000 4 10.000000
++ 8.000000 2 9.199999
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 46 0.000000
++ 0.000003 0 0.000000
++ 0.000007 0 0.000000
++ 0.000015 0 0.000000
++ 0.000030 0 0.000000
++ 0.000061 0 0.000000
++ 0.000122 0 0.000000
++ 0.000244 0 0.000000
++ 0.000488 0 0.000000
++ 0.000976 0 0.000000
++ 0.001953 0 0.000000
++ 0.003906 0 0.000000
++ 0.007812 0 0.000000
++ 0.015625 0 0.000000
++ 0.031250 0 0.000000
++ 0.062500 0 0.000000
++ 0.125000 47 4.700000
++ 0.250000 0 0.000000
++ 0.500000 10 3.550000
++ 1.000000 1 0.500000
++ 2.000000 5 6.500000
++ 4.000000 4 10.000000
++ 8.000000 2 9.199999
++ 16.000000 0 0.000000
++ 32.000000 0 0.000000
++ 64.000000 0 0.000000
++ 128.000000 0 0.000000
++ 256.000000 0 0.000000
++ 512.000000 0 0.000000
++ 1024.000000 0 0.000000
++ 2048.000000 0 0.000000
++ 4096.000000 0 0.000000
++ 8192.000000 0 0.000000
++ 16384.000000 0 0.000000
++ 32768.000000 0 0.000000
++ 65536.000000 0 0.000000
++ 131072.000000 0 0.000000
++ 262144.000000 0 0.000000
++ 524288.000000 0 0.000000
++ 1048576.00000 0 0.000000
++ 2097152.00000 0 0.000000
++ 4194304.00000 0 0.000000
++ 8388608.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++CALL test_f(0.31);
++CALL test_f(0.32);
++CALL test_f(0.33);
++CALL test_f(0.34);
++CALL test_f(0.35);
++CALL test_f(0.36);
++CALL test_f(0.37);
++CALL test_f(0.38);
++CALL test_f(0.39);
++CALL test_f(0.4);
++CALL test_f(1.1);
++CALL test_f(1.2);
++CALL test_f(1.3);
++CALL test_f(1.5);
++CALL test_f(1.4);
++CALL test_f(0.5);
++CALL test_f(2.1);
++CALL test_f(2.3);
++CALL test_f(2.5);
++CALL test_f(3.1);
++CALL test_f(4.1);
++CALL test_f(5.1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 10
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 46 0.000000
++ 0.000010 0 0.000000
++ 0.000100 0 0.000000
++ 0.001000 0 0.000000
++ 0.010000 0 0.000000
++ 0.100000 0 0.000000
++ 1.000000 57 8.650000
++ 10.000000 11 25.699999
++ 100.000000 0 0.000000
++ 1000.000000 0 0.000000
++ 10000.000000 0 0.000000
++ 100000.000000 0 0.000000
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 46 0.000000
++ 0.000010 0 0.000000
++ 0.000100 0 0.000000
++ 0.001000 0 0.000000
++ 0.010000 0 0.000000
++ 0.100000 0 0.000000
++ 1.000000 58 8.750000
++ 10.000000 11 25.699999
++ 100.000000 0 0.000000
++ 1000.000000 0 0.000000
++ 10000.000000 0 0.000000
++ 100000.000000 0 0.000000
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++CALL test_f(0.31);
++CALL test_f(0.32);
++CALL test_f(0.33);
++CALL test_f(0.34);
++CALL test_f(0.35);
++CALL test_f(0.36);
++CALL test_f(0.37);
++CALL test_f(0.38);
++CALL test_f(0.39);
++CALL test_f(0.4);
++CALL test_f(1.1);
++CALL test_f(1.2);
++CALL test_f(1.3);
++CALL test_f(1.5);
++CALL test_f(1.4);
++CALL test_f(0.5);
++CALL test_f(2.1);
++CALL test_f(2.3);
++CALL test_f(2.5);
++CALL test_f(3.1);
++CALL test_f(4.1);
++CALL test_f(5.1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 7
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 46 0.000000
++ 0.000008 0 0.000000
++ 0.000059 0 0.000000
++ 0.000416 0 0.000000
++ 0.002915 0 0.000000
++ 0.020408 0 0.000000
++ 0.142857 46 4.600000
++ 1.000000 11 4.050000
++ 7.000000 11 25.699999
++ 49.000000 0 0.000000
++ 343.000000 0 0.000000
++ 2401.000000 0 0.000000
++ 16807.000000 0 0.000000
++ 117649.000000 0 0.000000
++ 823543.000000 0 0.000000
++ 5764801.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 46 0.000000
++ 0.000008 0 0.000000
++ 0.000059 0 0.000000
++ 0.000416 0 0.000000
++ 0.002915 0 0.000000
++ 0.020408 0 0.000000
++ 0.142857 47 4.700000
++ 1.000000 11 4.050000
++ 7.000000 11 25.699999
++ 49.000000 0 0.000000
++ 343.000000 0 0.000000
++ 2401.000000 0 0.000000
++ 16807.000000 0 0.000000
++ 117649.000000 0 0.000000
++ 823543.000000 0 0.000000
++ 5764801.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++CALL test_f(0.31);
++CALL test_f(0.32);
++CALL test_f(0.33);
++CALL test_f(0.34);
++CALL test_f(0.35);
++CALL test_f(0.36);
++CALL test_f(0.37);
++CALL test_f(0.38);
++CALL test_f(0.39);
++CALL test_f(0.4);
++CALL test_f(1.1);
++CALL test_f(1.2);
++CALL test_f(1.3);
++CALL test_f(1.5);
++CALL test_f(1.4);
++CALL test_f(0.5);
++CALL test_f(2.1);
++CALL test_f(2.3);
++CALL test_f(2.5);
++CALL test_f(3.1);
++CALL test_f(4.1);
++CALL test_f(5.1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 156
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000041 46 0.000000
++ 0.006410 0 0.000000
++ 1.000000 57 8.650000
++ 156.000000 11 25.699999
++ 24336.000000 0 0.000000
++ 3796416.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000041 46 0.000000
++ 0.006410 0 0.000000
++ 1.000000 58 8.750000
++ 156.000000 11 25.699999
++ 24336.000000 0 0.000000
++ 3796416.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000;
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++CALL test_f(0.31);
++CALL test_f(0.32);
++CALL test_f(0.33);
++CALL test_f(0.34);
++CALL test_f(0.35);
++CALL test_f(0.36);
++CALL test_f(0.37);
++CALL test_f(0.38);
++CALL test_f(0.39);
++CALL test_f(0.4);
++CALL test_f(1.1);
++CALL test_f(1.2);
++CALL test_f(1.3);
++CALL test_f(1.5);
++CALL test_f(1.4);
++CALL test_f(0.5);
++CALL test_f(2.1);
++CALL test_f(2.3);
++CALL test_f(2.5);
++CALL test_f(3.1);
++CALL test_f(4.1);
++CALL test_f(5.1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 1000
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 46 0.000000
++ 0.001000 0 0.000000
++ 1.000000 57 8.650000
++ 1000.000000 11 25.699999
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 46 0.000000
++ 0.001000 0 0.000000
++ 1.000000 58 8.750000
++ 1000.000000 11 25.699999
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET SESSION query_exec_time=0.1;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001;
++Warnings:
++Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
++FLUSH QUERY_RESPONSE_TIME;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
++CALL test_f(0.31);
++CALL test_f(0.32);
++CALL test_f(0.33);
++CALL test_f(0.34);
++CALL test_f(0.35);
++CALL test_f(0.36);
++CALL test_f(0.37);
++CALL test_f(0.38);
++CALL test_f(0.39);
++CALL test_f(0.4);
++CALL test_f(1.1);
++CALL test_f(1.2);
++CALL test_f(1.3);
++CALL test_f(1.5);
++CALL test_f(1.4);
++CALL test_f(0.5);
++CALL test_f(2.1);
++CALL test_f(2.3);
++CALL test_f(2.5);
++CALL test_f(3.1);
++CALL test_f(4.1);
++CALL test_f(5.1);
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
++Variable_name Value
++query_response_time_range_base 1000
++SHOW QUERY_RESPONSE_TIME;
++
++ 0.000001 46 0.000000
++ 0.001000 0 0.000000
++ 1.000000 57 8.650000
++ 1000.000000 11 25.699999
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time count total
++ 0.000001 46 0.000000
++ 0.001000 0 0.000000
++ 1.000000 58 8.750000
++ 1000.000000 11 25.699999
++ 1000000.00000 0 0.000000
++TOO LONG 0 TOO LONG
++SET SESSION query_exec_time=default;
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
++DROP PROCEDURE test_f;
++DROP TABLE t;
+--- /dev/null
++++ b/mysql-test/t/percona_query_response_time-replication.test
+@@ -0,0 +1,28 @@
++SET GLOBAL query_exec_time=0.1;
++
++--source include/have_response_time_distribution.inc
++--source include/have_debug.inc
++--source include/have_binlog_format_statement.inc
++--source include/master-slave.inc
++
++--let base=1
++--source include/query_response_time-replication.inc
++--let base=2
++--source include/query_response_time-replication.inc
++--let base=10
++--source include/query_response_time-replication.inc
++--let base=7
++--source include/query_response_time-replication.inc
++--let base=156
++--source include/query_response_time-replication.inc
++--let base=1000
++--source include/query_response_time-replication.inc
++--let base=1001
++--source include/query_response_time-replication.inc
++
++--source include/rpl_end.inc
++
++SET GLOBAL query_exec_time=default;
++
++connection slave;
++SET GLOBAL query_exec_time=default;
+--- /dev/null
++++ b/mysql-test/t/percona_query_response_time-stored.test
+@@ -0,0 +1,36 @@
++--source include/have_response_time_distribution.inc
++--source include/have_debug.inc
++
++CREATE TABLE t(a INT);
++
++delimiter ^;
++CREATE PROCEDURE test_f(t DECIMAL(3,2))
++BEGIN
++ SET SESSION query_exec_time=t;
++ INSERT INTO t VALUES(1);
++ SET SESSION query_exec_time=0.1;
++ DELETE FROM t;
++END^
++delimiter ;^
++
++--let base=1
++--source include/query_response_time-stored.inc
++--let base=2
++--source include/query_response_time-stored.inc
++--let base=10
++--source include/query_response_time-stored.inc
++--let base=7
++--source include/query_response_time-stored.inc
++--let base=156
++--source include/query_response_time-stored.inc
++--let base=1000
++--source include/query_response_time-stored.inc
++--let base=1001
++--source include/query_response_time-stored.inc
++
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
++
++DROP PROCEDURE test_f;
++
++DROP TABLE t;
+--- /dev/null
++++ b/mysql-test/t/percona_query_response_time.test
+@@ -0,0 +1,20 @@
++--source include/have_response_time_distribution.inc
++--source include/have_debug.inc
++
++--let base=1
++--source include/query_response_time.inc
++--let base=2
++--source include/query_response_time.inc
++--let base=10
++--source include/query_response_time.inc
++--let base=7
++--source include/query_response_time.inc
++--let base=156
++--source include/query_response_time.inc
++--let base=1000
++--source include/query_response_time.inc
++--let base=1001
++--source include/query_response_time.inc
++
++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
++SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
+--- /dev/null
+++ b/patch_info/response-time-distribution.info
@@ -0,0 +1,9 @@
+File=response-time-distribution.patch
#include "transaction.h"
#include "sql_audit.h"
#include "sql_prepare.h"
-@@ -1482,22 +1483,74 @@
- Do not log administrative statements unless the appropriate option is
- set.
- */
-+ #ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
-+ if (opt_query_response_time_stats || thd->enable_slow_log)
-+#else // HAVE_RESPONSE_TIME_DISTRIBUTION
- if (thd->enable_slow_log)
-+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
- {
-- ulonglong end_utime_of_query= thd->current_utime();
-- thd_proc_info(thd, "logging slow query");
-+ ulonglong end_utime_of_query = thd->current_utime();
-+ ulonglong query_execution_time = end_utime_of_query - thd->utime_after_lock;
-+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
-+
-+#define DBUG_TEST_QRT(t,v) \
-+ DBUG_EXECUTE_IF(t, \
-+ { \
-+ query_execution_time= v; \
-+ DBUG_SET("-d,"t); \
-+ })
-+
-+ DBUG_EXECUTE_IF("query_exec_time_debug", query_execution_time= 0; );
-+
-+ DBUG_TEST_QRT("query_exec_time_0.31", 310000UL);
-+ DBUG_TEST_QRT("query_exec_time_0.32", 320000UL);
-+ DBUG_TEST_QRT("query_exec_time_0.33", 330000UL);
-+ DBUG_TEST_QRT("query_exec_time_0.34", 340000UL);
-+ DBUG_TEST_QRT("query_exec_time_0.35", 350000UL);
-+ DBUG_TEST_QRT("query_exec_time_0.36", 360000UL);
-+ DBUG_TEST_QRT("query_exec_time_0.37", 370000UL);
-+ DBUG_TEST_QRT("query_exec_time_0.38", 380000UL);
-+ DBUG_TEST_QRT("query_exec_time_0.39", 390000UL);
-+ DBUG_TEST_QRT("query_exec_time_0.4", 400000UL);
-+ DBUG_TEST_QRT("query_exec_time_0.5", 500000UL);
-+ DBUG_TEST_QRT("query_exec_time_1.1", 1100000UL);
-+ DBUG_TEST_QRT("query_exec_time_1.2", 1200000UL);
-+ DBUG_TEST_QRT("query_exec_time_1.3", 1300000UL);
-+ DBUG_TEST_QRT("query_exec_time_1.4", 1400000UL);
-+ DBUG_TEST_QRT("query_exec_time_1.5", 1500000UL);
-+ DBUG_TEST_QRT("query_exec_time_2.1", 2100000UL);
-+ DBUG_TEST_QRT("query_exec_time_2.3", 2300000UL);
-+ DBUG_TEST_QRT("query_exec_time_2.5", 2500000UL);
-+
-+ DBUG_EXECUTE_IF("query_exec_time_debug",
-+ if (query_execution_time == 0)
-+ opt_query_response_time_stats= 0;
-+ else
-+ opt_query_response_time_stats= 1;);
+@@ -1507,6 +1508,7 @@
-- if (((thd->server_status & SERVER_QUERY_WAS_SLOW) ||
-- ((thd->server_status &
-- (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
-- opt_log_queries_not_using_indexes &&
-- !(sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND))) &&
-- thd->examined_row_count >= thd->variables.min_examined_row_limit)
-+#undef DBUG_TEST_QRT
-+
-+ if(opt_query_response_time_stats)
-+ {
-+ query_response_time_collect(query_execution_time);
-+ }
-+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
-+ if (thd->enable_slow_log)
- {
- thd_proc_info(thd, "logging slow query");
-- thd->status_var.long_query_count++;
-- slow_log_print(thd, thd->query(), thd->query_length(),
-- end_utime_of_query);
-+
-+ if (((thd->server_status & SERVER_QUERY_WAS_SLOW) ||
-+ ((thd->server_status &
-+ (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
-+ opt_log_queries_not_using_indexes &&
-+ !(sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND))) &&
-+ thd->examined_row_count >= thd->variables.min_examined_row_limit)
-+ {
-+ thd_proc_info(thd, "logging slow query");
-+ thd->status_var.long_query_count++;
-+ slow_log_print(thd, thd->query(), thd->query_length(),
-+ end_utime_of_query);
-+ }
- }
- }
- DBUG_VOID_RETURN;
-@@ -1616,6 +1669,7 @@
+ ulonglong end_utime_of_query= thd->current_utime();
+ ulonglong query_exec_time= get_query_exec_time(thd, end_utime_of_query);
++ query_response_time_collect(query_exec_time);
+
+ /*
+ Low long_query_time value most likely means user is debugging stuff and even
+@@ -1671,6 +1673,7 @@
case SCH_CHARSETS:
case SCH_ENGINES:
case SCH_COLLATIONS:
/*
This forward declaration is needed because including sql_base.h
causes further includes. [TODO] Eliminate this forward declaration
-@@ -1837,6 +1838,26 @@
+@@ -1860,6 +1861,26 @@
DEFAULT(FALSE));
#endif /* HAVE_QUERY_CACHE */
static Sys_var_mybool Sys_secure_auth(
"secure_auth",
"Disallow authentication for accounts that have old (pre-4.1) "
---- a/include/atomic/x86-gcc.h
-+++ b/include/atomic/x86-gcc.h
+--- /dev/null
++++ b/mysql-test/r/have_response_time_distribution.require
+@@ -0,0 +1,2 @@
++Variable_name Value
++have_response_time_distribution YES
+--- a/include/atomic/x86-gcc.h 2011-05-11 14:54:11.000000000 +0300
++++ b/include/atomic/x86-gcc.h 2011-07-21 16:20:24.563057000 +0300
@@ -108,27 +108,22 @@
v=tmp;
| QUERY_RESPONSE_TIME_SYM wild_and_where
{
#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
+--- /dev/null
++++ b/mysql-test/r/percona_show_slave_status_nolock.result
+@@ -0,0 +1,21 @@
++include/master-slave.inc
++[connection master]
++DROP TABLE IF EXISTS t;
++CREATE TABLE t(id INT);
++INSERT INTO t SELECT SLEEP(10);
++STOP SLAVE;
++Warnings:
++Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
++master count(*)
++master 1
++slave count(*)
++slave 0
++SHOW SLAVE STATUS NOLOCK;
++include/wait_for_slave_to_stop.inc
++START SLAVE;
++include/wait_for_slave_to_start.inc
++slave count(*)
++slave 1
++DROP TABLE t;
++STOP SLAVE;
++include/wait_for_slave_to_stop.inc
+--- /dev/null
++++ b/mysql-test/t/percona_show_slave_status_nolock.test
+@@ -0,0 +1,53 @@
++--source include/master-slave.inc
++--source include/have_binlog_format_statement.inc
++--disable_query_log
++call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement:");
++call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
++--enable_query_log
++connection master;
++ --disable_warnings
++ DROP TABLE IF EXISTS t;
++ --enable_warnings
++ CREATE TABLE t(id INT);
++ sync_slave_with_master;
++
++connection master;
++ send INSERT INTO t SELECT SLEEP(10);
++
++connection slave;
++ sleep 15;
++ send STOP SLAVE;
++
++connection master;
++ reap;
++
++ --disable_query_log
++ select "master",count(*) from t;
++ --enable_query_log
++
++connection slave1;
++ --disable_query_log
++ select "slave",count(*) from t;
++ --enable_query_log
++
++ --disable_result_log
++ SHOW SLAVE STATUS NOLOCK;
++ --enable_result_log
++
++connection slave;
++ reap;
++
++ --source include/wait_for_slave_to_stop.inc
++ START SLAVE;
++ --source include/wait_for_slave_to_start.inc
++
++ --disable_query_log
++ select "slave",count(*) from t;
++ --enable_query_log
++
++connection master;
++ DROP TABLE t;
++sync_slave_with_master;
++STOP SLAVE;
++--source include/wait_for_slave_to_stop.inc
++
+\ No newline at end of file
TABLE *derived_tables;
/*
During a MySQL session, one can lock tables in two modes: automatic
+--- /dev/null
++++ b/mysql-test/r/percona_show_temp_tables.result
+@@ -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;
+--- /dev/null
++++ b/mysql-test/t/percona_show_temp_tables.test
+@@ -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
enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
SLAVE_EXEC_MODE_IDEMPOTENT,
SLAVE_EXEC_MODE_LAST_BIT};
-@@ -508,6 +535,17 @@
+@@ -508,6 +535,21 @@
my_bool sysdate_is_now;
++#ifndef DBUG_OFF
++ ulonglong query_exec_time;
++ double query_exec_time_double;
++#endif
+ ulong log_slow_rate_limit;
+ ulonglong log_slow_filter;
+ ulonglong log_slow_verbosity;
double long_query_time_double;
} SV;
-@@ -1140,6 +1178,14 @@
+@@ -1140,6 +1182,14 @@
uint in_sub_stmt;
bool enable_slow_log;
bool last_insert_id_used;
SAVEPOINT *savepoints;
enum enum_check_fields count_cuted_fields;
};
-@@ -1588,6 +1634,26 @@
+@@ -1588,6 +1638,26 @@
thr_lock_type update_lock_default;
Delayed_insert *di;
}
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
-@@ -1430,7 +1430,6 @@
+@@ -114,6 +114,7 @@
+
+ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
+ static void sql_kill(THD *thd, ulong id, bool only_kill_query);
++static inline ulonglong get_query_exec_time(THD *thd, ulonglong cur_utime);
+
+ const char *any_db="*any*"; // Special symbol for check_access
+
+@@ -1430,6 +1431,60 @@
DBUG_RETURN(error);
}
--
++/**
++ Calculate execution time for the current query.
++
++ For debug builds, check the session value of query_exec_time
++ and if it is not zero, return it instead of the actual execution time.
++
++ SET queries are ignored so that statements changing query_exec_time are not
++ affected by themselves.
++
++ @param thd thread handle
++ @param lex current relative time in microseconds
++
++ @return time in microseconds from utime_after_lock
++*/
++
++static inline ulonglong get_query_exec_time(THD *thd, ulonglong cur_utime)
++{
++ ulonglong res;
++#ifndef DBUG_OFF
++ if (thd->variables.query_exec_time != 0)
++ res= thd->lex->sql_command != SQLCOM_SET_OPTION ?
++ thd->variables.query_exec_time : 0;
++ else
++#endif
++
++ res= cur_utime - thd->utime_after_lock;
++
++ if (res > thd->variables.long_query_time)
++ thd->server_status|= SERVER_QUERY_WAS_SLOW;
++ else
++ thd->server_status&= ~SERVER_QUERY_WAS_SLOW;
++
++ return res;
++}
++
++
++static inline void copy_global_to_session(THD *thd, ulong flag,
++ const ulong *val)
++{
++ my_ptrdiff_t offset = ((char *)val - (char *)&global_system_variables);
++ if (opt_slow_query_log_use_global_control & (1ULL << flag))
++ *(ulong *)((char *) &thd->variables + offset) = *val;
++}
++
++
++static inline void copy_global_to_session(THD *thd, ulong flag,
++ const ulonglong *val)
++{
++ my_ptrdiff_t offset = ((char *)val - (char *)&global_system_variables);
++ if (opt_slow_query_log_use_global_control & (1ULL << flag))
++ *(ulonglong *)((char *) &thd->variables + offset) = *val;
++}
++
++
+
void log_slow_statement(THD *thd)
{
- DBUG_ENTER("log_slow_statement");
-@@ -1443,6 +1442,42 @@
+@@ -1443,13 +1498,48 @@
if (unlikely(thd->in_sub_stmt))
DBUG_VOID_RETURN; // Don't set time for sub stmt
+ (thd->query_plan_flags & QPLAN_QC))))
+ DBUG_VOID_RETURN;
+
++ ulonglong end_utime_of_query= thd->current_utime();
++ ulonglong query_exec_time= get_query_exec_time(thd, end_utime_of_query);
++
+ /*
+ Low long_query_time value most likely means user is debugging stuff and even
+ though some thread's queries are not supposed to be logged b/c of the rate
+ to make an exception and write to slow log anyway.
+ */
+
-+ ulonglong end_utime_of_query= thd->current_utime();
-+#define USE_GLOBAL_UPDATE(variable_name,enum_value_name) \
-+ if (opt_slow_query_log_use_global_control & (ULL(1) << enum_value_name)) \
-+ { \
-+ thd->variables. variable_name= \
-+ global_system_variables. variable_name; \
-+ }
-+ USE_GLOBAL_UPDATE(log_slow_filter,SLOG_UG_LOG_SLOW_FILTER);
-+ USE_GLOBAL_UPDATE(log_slow_rate_limit,SLOG_UG_LOG_SLOW_RATE_LIMIT);
-+ USE_GLOBAL_UPDATE(log_slow_verbosity,SLOG_UG_LOG_SLOW_VERBOSITY);
-+ USE_GLOBAL_UPDATE(long_query_time,SLOG_UG_LONG_QUERY_TIME);
-+ USE_GLOBAL_UPDATE(long_query_time_double,SLOG_UG_LONG_QUERY_TIME);
-+ USE_GLOBAL_UPDATE(min_examined_row_limit,SLOG_UG_MIN_EXAMINED_ROW_LIMIT);
-+#undef USE_GLOBAL_UPDATE
++ system_variables const &g= global_system_variables;
++ copy_global_to_session(thd, SLOG_UG_LOG_SLOW_FILTER,
++ &g.log_slow_filter);
++ copy_global_to_session(thd, SLOG_UG_LOG_SLOW_RATE_LIMIT,
++ &g.log_slow_rate_limit);
++ copy_global_to_session(thd, SLOG_UG_LOG_SLOW_VERBOSITY,
++ &g.log_slow_verbosity);
++ copy_global_to_session(thd, SLOG_UG_LONG_QUERY_TIME,
++ &g.long_query_time);
++ copy_global_to_session(thd, SLOG_UG_MIN_EXAMINED_ROW_LIMIT,
++ &g.min_examined_row_limit);
+
+ /* Do not log this thread's queries due to rate limiting. */
+ if (thd->write_to_slow_log != TRUE
+ && (thd->variables.long_query_time >= 1000000
-+ || (ulong) (end_utime_of_query - thd->utime_after_lock) < 1000000))
++ || (ulong) query_exec_time < 1000000))
+ DBUG_VOID_RETURN;
+
+
/*
Do not log administrative statements unless the appropriate option is
set.
-@@ -1879,6 +1914,9 @@
+ */
+ if (thd->enable_slow_log)
+ {
+- ulonglong end_utime_of_query= thd->current_utime();
+ thd_proc_info(thd, "logging slow query");
+
+ if (((thd->server_status & SERVER_QUERY_WAS_SLOW) ||
+@@ -1879,6 +1969,9 @@
context.resolve_in_table_list_only(select_lex->
table_list.first);
/*
Reset warning count for each query that uses tables
A better approach would be to reset this for any commands
-@@ -5297,6 +5335,21 @@
+@@ -5297,6 +5390,21 @@
thd->rand_used= 0;
thd->sent_row_count= thd->examined_row_count= 0;
{
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
-@@ -2898,6 +2898,117 @@
+@@ -972,6 +972,29 @@
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
+ ON_UPDATE(update_cached_long_query_time));
+
++#ifndef DBUG_OFF
++static bool update_cached_query_exec_time(sys_var *self, THD *thd,
++ enum_var_type type)
++{
++ if (type == OPT_SESSION)
++ thd->variables.query_exec_time=
++ double2ulonglong(thd->variables.query_exec_time_double * 1e6);
++ else
++ global_system_variables.query_exec_time=
++ double2ulonglong(global_system_variables.query_exec_time_double * 1e6);
++ return false;
++}
++
++static Sys_var_double Sys_query_exec_time(
++ "query_exec_time",
++ "Pretend queries take this many seconds. When 0 (the default) use the "
++ "actual execution time. Used only for debugging.",
++ SESSION_VAR(query_exec_time_double),
++ NO_CMD_LINE, VALID_RANGE(0, LONG_TIMEOUT), DEFAULT(0),
++ NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
++ ON_UPDATE(update_cached_query_exec_time));
++#endif
++
+ static bool fix_low_prio_updates(sys_var *self, THD *thd, enum_var_type type)
+ {
+ if (type == OPT_SESSION)
+@@ -2898,6 +2921,117 @@
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_log_state));
};
# endif /* HAVE_PROFILING */
+--- /dev/null
++++ b/mysql-test/include/log_grep.inc
+@@ -0,0 +1,17 @@
++--disable_query_log
++--echo [log_grep.inc] file: $log_file pattern: $grep_pattern
++perl;
++ $log_file= $ENV{'log_file'};
++ $log_file_full_path= $ENV{'log_file_full_path'};
++ $grep_pattern= $ENV{'grep_pattern'};
++
++ open(FILE, "$log_file_full_path")
++ or die("Cannot open file $log_file_full_path: $!\n");
++
++ $lines = 0;
++ while(<FILE>) {
++ $lines++ if (/$grep_pattern/);
++ }
++ close(FILE);
++ print "[log_grep.inc] lines: $lines\n";
++EOF
+--- /dev/null
++++ b/mysql-test/include/log_start.inc
+@@ -0,0 +1,16 @@
++--disable_query_log
++--let log_file_full_path = $MYSQLTEST_VARDIR/$log_file
++SET @slow_query_log_old=@@slow_query_log;
++SET @slow_query_log_file_old= @@slow_query_log_file;
++SET GLOBAL slow_query_log=OFF;
++perl;
++ $log_file_full_path= $ENV{'log_file_full_path'};
++ unlink $log_file_full_path;
++ open(FILE, '>', $log_file_full_path)
++ or die "Cannot create log file $log_file_full_path, reason: $!";
++ close(FILE);
++EOF
++--echo [log_start.inc] $log_file
++EVAL SET GLOBAL slow_query_log_file="$log_file_full_path";
++SET GLOBAL slow_query_log=ON;
++--enable_query_log
+\ No newline at end of file
+--- /dev/null
++++ b/mysql-test/include/log_stop.inc
+@@ -0,0 +1,7 @@
++--disable_query_log
++FLUSH LOGS;
++SET GLOBAL slow_query_log=OFF;
++--echo [log_stop.inc] $log_file
++SET GLOBAL slow_query_log_file= @slow_query_log_file_old;
++SET GLOBAL slow_query_log= @slow_query_log_old;
++--enable_query_log
+--- /dev/null
++++ b/mysql-test/r/percona_bug643149.result
+@@ -0,0 +1,21 @@
++SET @old_slow_query_log_file=@@global.slow_query_log_file;
++SET GLOBAL slow_query_log=on;
++SET LOCAL log_slow_verbosity='profiling';
++SET LOCAL long_query_time=0;
++SET GLOBAL slow_query_log_file='MYSQLTEST_VARDIR/percona_bug643149_slow.log';;
++SELECT 1;
++1
++1
++# User@Host: root[root] @ localhost []
++# Thread_id: X Schema: test Last_errno: X Killed: X
++# Query_time: X.X Lock_time: X.X Rows_sent: X Rows_examined: X Rows_affected: X Rows_read: X
++# Bytes_sent: X Tmp_tables: X Tmp_disk_tables: X Tmp_table_sizes: X
++# Profile_starting: X.X Profile_starting_cpu: X.X Profile_Opening_tables: X.X Profile_Opening_tables_cpu: X.X Profile_query_end: X.X Profile_query_end_cpu: X.X Profile_closing_tables: X.X Profile_closing_tables_cpu: X.X Profile_freeing_items: X.X Profile_freeing_items_cpu: X.X Profile_logging_slow_query: X.X Profile_logging_slow_query_cpu: X.X
++# Profile_total: X.X Profile_total_cpu: X.X
++# User@Host: root[root] @ localhost []
++# Thread_id: X Schema: test Last_errno: X Killed: X
++# Query_time: X.X Lock_time: X.X Rows_sent: X Rows_examined: X Rows_affected: X Rows_read: X
++# Bytes_sent: X Tmp_tables: X Tmp_disk_tables: X Tmp_table_sizes: X
++# Profile_starting: X.X Profile_starting_cpu: X.X Profile_checking_permissions: X.X Profile_checking_permissions_cpu: X.X Profile_Opening_tables: X.X Profile_Opening_tables_cpu: X.X Profile_init: X.X Profile_init_cpu: X.X Profile_optimizing: X.X Profile_optimizing_cpu: X.X Profile_executing: X.X Profile_executing_cpu: X.X Profile_end: X.X Profile_end_cpu: X.X Profile_query_end: X.X Profile_query_end_cpu: X.X Profile_closing_tables: X.X Profile_closing_tables_cpu: X.X Profile_freeing_items: X.X Profile_freeing_items_cpu: X.X Profile_logging_slow_query: X.X Profile_logging_slow_query_cpu: X.X
++# Profile_total: X.X Profile_total_cpu: X.X
++SET GLOBAL slow_query_log_file=@old_slow_query_log_file;
+--- /dev/null
++++ b/mysql-test/r/percona_log_slow_filter-cl.result
+@@ -0,0 +1,6 @@
++SHOW VARIABLES LIKE 'log_slow_filter';
++Variable_name Value
++log_slow_filter full_join
++SHOW GLOBAL VARIABLES LIKE 'log_slow_filter';
++Variable_name Value
++log_slow_filter full_join
+--- /dev/null
++++ b/mysql-test/r/percona_log_slow_filter.result
+@@ -0,0 +1,15 @@
++CREATE TABLE t(id INT PRIMARY KEY);
++INSERT INTO t VALUES(1);
++INSERT INTO t VALUES(2);
++INSERT INTO t VALUES(3);
++SET long_query_time=1;
++SET log_slow_filter=full_join;
++[log_start.inc] percona.slow_extended.log_slow_filter
++SET query_exec_time = 1.1;
++SELECT * FROM t AS t1, t AS t2;
++SET query_exec_time = default;
++[log_stop.inc] percona.slow_extended.log_slow_filter
++SET log_slow_filter=default;
++SET long_query_time=default;
++[log_grep.inc] file: percona.slow_extended.log_slow_filter pattern: Query_time
++[log_grep.inc] lines: 1
+--- /dev/null
++++ b/mysql-test/r/percona_log_slow_slave_statements-cl.result
+@@ -0,0 +1,6 @@
++SHOW VARIABLES LIKE 'log_slow_slave_statements';
++Variable_name Value
++log_slow_slave_statements ON
++SHOW GLOBAL VARIABLES LIKE 'log_slow_slave_statements';
++Variable_name Value
++log_slow_slave_statements ON
+--- /dev/null
++++ b/mysql-test/r/percona_log_slow_slave_statements-innodb.result
+@@ -0,0 +1,18 @@
++include/master-slave.inc
++[connection master]
++DROP TABLE IF EXISTS t;
++CREATE TABLE t(id INT,data CHAR(30)) ENGINE=InnoDB;
++INSERT INTO t VALUES
++(1,"aaaaabbbbbcccccdddddeeeeefffff"),
++(2,"aaaaabbbbbcccccdddddeeeeefffff"),
++(3,"aaaaabbbbbcccccdddddeeeeefffff"),
++(4,"aaaaabbbbbcccccdddddeeeeefffff"),
++(5,"aaaaabbbbbcccccdddddeeeeefffff");
++INSERT INTO t SELECT t2.id,t2.data from t as t1, t as t2;
++INSERT INTO t SELECT t2.id,t2.data from t as t1, t as t2;
++[log_start.inc] percona.slow_extended.log_slow_slave_statements-innodb
++INSERT INTO t SELECT t.id,t.data from t;
++[log_stop.inc] percona.slow_extended.log_slow_slave_statements-innodb
++[log_grep.inc] file: percona.slow_extended.log_slow_slave_statements-innodb pattern: InnoDB_IO_r_ops
++[log_grep.inc] lines: 1
++include/rpl_end.inc
+--- /dev/null
++++ b/mysql-test/r/percona_log_slow_slave_statements.result
+@@ -0,0 +1,44 @@
++include/master-slave.inc
++[connection master]
++DROP TABLE IF EXISTS t;
++CREATE TABLE t(id INT);
++[log_start.inc] percona.slow_extended.log_slow_slave_statements
++LINE 1
++LOG_SLOW_SLAVE_STATAMENTS is OFF
++LOG_SLOW_SLAVE_STATEMENTS=ON
++LOG_SLOW_SLAVE_STATAMENTS is ON
++LINE 2
++include/restart_slave.inc
++LOG_SLOW_SLAVE_STATAMENTS is ON
++LINE 3
++LOG_SLOW_SLAVE_STATAMENTS is ON
++LOG_SLOW_SLAVE_STATEMENTS=OFF
++LOG_SLOW_SLAVE_STATAMENTS is OFF
++LINE 4
++include/restart_slave.inc
++LOG_SLOW_SLAVE_STATAMENTS is OFF
++LINE 5
++LOG_SLOW_SLAVE_STATAMENTS is OFF
++LOG_SLOW_SLAVE_STATEMENTS=ON
++LOG_SLOW_SLAVE_STATAMENTS is ON
++LINE 6
++include/restart_slave.inc
++LOG_SLOW_SLAVE_STATAMENTS is ON
++LINE 7
++[log_stop.inc] percona.slow_extended.log_slow_slave_statements
++SET GLOBAL log_slow_slave_statements=default;
++[log_grep.inc] file: percona.slow_extended.log_slow_slave_statements pattern: INSERT INTO t VALUES \(1\)
++[log_grep.inc] lines: 0
++[log_grep.inc] file: percona.slow_extended.log_slow_slave_statements pattern: INSERT INTO t VALUES \(2\)
++[log_grep.inc] lines: 0
++[log_grep.inc] file: percona.slow_extended.log_slow_slave_statements pattern: INSERT INTO t VALUES \(3\)
++[log_grep.inc] lines: 1
++[log_grep.inc] file: percona.slow_extended.log_slow_slave_statements pattern: INSERT INTO t VALUES \(4\)
++[log_grep.inc] lines: 0
++[log_grep.inc] file: percona.slow_extended.log_slow_slave_statements pattern: INSERT INTO t VALUES \(5\)
++[log_grep.inc] lines: 0
++[log_grep.inc] file: percona.slow_extended.log_slow_slave_statements pattern: INSERT INTO t VALUES \(6\)
++[log_grep.inc] lines: 0
++[log_grep.inc] file: percona.slow_extended.log_slow_slave_statements pattern: INSERT INTO t VALUES \(7\)
++[log_grep.inc] lines: 1
++include/rpl_end.inc
+--- /dev/null
++++ b/mysql-test/r/percona_log_slow_sp_statements-cl.result
+@@ -0,0 +1,6 @@
++SHOW VARIABLES LIKE 'log_slow_sp_statements';
++Variable_name Value
++log_slow_sp_statements ON
++SHOW GLOBAL VARIABLES LIKE 'log_slow_sp_statements';
++Variable_name Value
++log_slow_sp_statements ON
+--- /dev/null
++++ b/mysql-test/r/percona_log_slow_sp_statements.result
+@@ -0,0 +1,24 @@
++SET long_query_time=1;
++SET GLOBAL log_slow_sp_statements=ON;
++SET SESSION query_exec_time=0.1;
++[log_start.inc] percona.slow_extended.log_slow_sp_statements
++CREATE PROCEDURE test_f()
++BEGIN
++SET SESSION query_exec_time=1.1; SELECT 1;
++SET SESSION query_exec_time=2.1; SELECT 1;
++SET SESSION query_exec_time=3.1; SELECT 1;
++SET SESSION query_exec_time=0.1;
++END^
++CALL test_f();
++1
++1
++1
++1
++1
++1
++[log_stop.inc] percona.slow_extended.log_slow_sp_statements
++SET SESSION query_exec_time=default;
++SET GLOBAL log_slow_sp_statements=default;
++SET long_query_time=default;
++[log_grep.inc] file: percona.slow_extended.log_slow_sp_statements pattern: Query_time
++[log_grep.inc] lines: 3
+--- /dev/null
++++ b/mysql-test/r/percona_log_slow_verbosity-cl.result
+@@ -0,0 +1,6 @@
++SHOW VARIABLES LIKE 'log_slow_verbosity';
++Variable_name Value
++log_slow_verbosity microtime,query_plan,innodb
++SHOW GLOBAL VARIABLES LIKE 'log_slow_verbosity';
++Variable_name Value
++log_slow_verbosity microtime,query_plan,innodb
+--- /dev/null
++++ b/mysql-test/r/percona_log_slow_verbosity.result
+@@ -0,0 +1,16 @@
++SET SESSION long_query_time=1;
++[log_start.inc] percona.slow_extended.log_slow_verbosity
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SET SESSION log_slow_verbosity=innodb;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=default;
++[log_stop.inc] percona.slow_extended.log_slow_verbosity
++SET log_slow_verbosity=default;
++SET long_query_time=default;
++[log_grep.inc] file: percona.slow_extended.log_slow_verbosity pattern: No InnoDB statistics available for this query
++[log_grep.inc] lines: 1
+--- /dev/null
++++ b/mysql-test/r/percona_long_query_time.result
+@@ -0,0 +1,33 @@
++SET long_query_time=2;
++[log_start.inc] percona.slow_extended.long_query_time
++SET SESSION query_exec_time=1.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=3.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=5.1;
++SELECT 1;
++1
++1
++SET long_query_time=4;
++SET SESSION query_exec_time=1.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=3.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=5.1;
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=default;
++SET long_query_time=2;
++[log_stop.inc] percona.slow_extended.long_query_time
++SET long_query_time=default;
++[log_grep.inc] file: percona.slow_extended.long_query_time pattern: Query_time
++[log_grep.inc] lines: 3
+--- /dev/null
++++ b/mysql-test/r/percona_slow_query_log_timestamp_always-cl.result
+@@ -0,0 +1,6 @@
++SHOW VARIABLES LIKE 'slow_query_log_timestamp_always';
++Variable_name Value
++slow_query_log_timestamp_always ON
++SHOW GLOBAL VARIABLES LIKE 'slow_query_log_timestamp_always';
++Variable_name Value
++slow_query_log_timestamp_always ON
+--- /dev/null
++++ b/mysql-test/r/percona_slow_query_log_timestamp_always.result
+@@ -0,0 +1,41 @@
++SET long_query_time=2;
++SET GLOBAL slow_query_log_timestamp_always=ON;
++[log_start.inc] percona.slow_extended.slow_query_log_timestamp_always
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SELECT 1;
++1
++1
++SELECT 1;
++1
++1
++SET GLOBAL slow_query_log_timestamp_always=OFF;
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SELECT 1;
++1
++1
++SELECT 1;
++1
++1
++SET GLOBAL slow_query_log_timestamp_always=ON;
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SELECT 1;
++1
++1
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=default;
++[log_stop.inc] percona.slow_extended.slow_query_log_timestamp_always
++SET GLOBAL slow_query_log_timestamp_always=default;
++SET long_query_time=default;
++[log_grep.inc] file: percona.slow_extended.slow_query_log_timestamp_always pattern: # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+
++[log_grep.inc] lines: 6
+--- /dev/null
++++ b/mysql-test/r/percona_slow_query_log_timestamp_precision-cl.result
+@@ -0,0 +1,6 @@
++SHOW VARIABLES LIKE 'slow_query_log_timestamp_precision';
++Variable_name Value
++slow_query_log_timestamp_precision microsecond
++SHOW GLOBAL VARIABLES LIKE 'slow_query_log_timestamp_precision';
++Variable_name Value
++slow_query_log_timestamp_precision microsecond
+--- /dev/null
++++ b/mysql-test/r/percona_slow_query_log_timestamp_precision.result
+@@ -0,0 +1,18 @@
++SET long_query_time=2;
++[log_start.inc] percona.slow_extended.slow_query_log_timestamp_precision
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SET GLOBAL slow_query_log_timestamp_precision='microsecond';
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=default;
++[log_stop.inc] percona.slow_extended.slow_query_log_timestamp_precision
++SET GLOBAL slow_query_log_timestamp_precision=default;
++SET long_query_time=default;
++[log_grep.inc] file: percona.slow_extended.slow_query_log_timestamp_precision pattern: # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+.[0-9]+
++[log_grep.inc] lines: 1
++[log_grep.inc] file: percona.slow_extended.slow_query_log_timestamp_precision pattern: # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+
++[log_grep.inc] lines: 2
+--- /dev/null
++++ b/mysql-test/r/percona_slow_query_log_use_global_control.result
+@@ -0,0 +1,18 @@
++SET GLOBAL long_query_time=1;
++[log_start.inc] percona.slow_extended.slow_query_log_use_global_control
++SET SESSION query_exec_time=1.1;
++SELECT 1;
++1
++1
++SET GLOBAL log_slow_verbosity=innodb;
++SET GLOBAL slow_query_log_use_global_control="log_slow_verbosity,long_query_time";
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=default;
++[log_stop.inc] percona.slow_extended.slow_query_log_use_global_control
++SET GLOBAL slow_query_log_use_global_control=default;
++SET GLOBAL log_slow_verbosity=default;
++SET GLOBAL long_query_time=default;
++[log_grep.inc] file: percona.slow_extended.slow_query_log_use_global_control pattern: No InnoDB statistics available for this query
++[log_grep.inc] lines: 1
+--- /dev/null
++++ b/mysql-test/t/percona_bug643149.test
+@@ -0,0 +1,49 @@
++#
++# This test suffers from server
++# Bug#38124 "general_log_file" variable silently unset when using expression
++# In short:
++# SET GLOBAL general_log_file = @<whatever>
++# SET GLOBAL slow_query_log = @<whatever>
++# cause that the value of these server system variables is set to default
++# instead of the assigned values. There comes no error message or warning.
++# If this bug is fixed please
++# 1. try this test with "let $fixed_bug38124 = 0;"
++# 2. remove all workarounds if 1. was successful.
++--source include/have_profiling.inc
++let $fixed_bug38124 = 0;
++
++SET @old_slow_query_log_file=@@global.slow_query_log_file;
++SET GLOBAL slow_query_log=on;
++SET LOCAL log_slow_verbosity='profiling';
++SET LOCAL long_query_time=0;
++
++let slogfile=$MYSQLTEST_VARDIR/percona_bug643149_slow.log;
++--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
++--eval SET GLOBAL slow_query_log_file='$slogfile';
++
++SELECT 1;
++
++perl;
++ $slogfile= $ENV{'slogfile'};
++
++ open(FILE, "$slogfile") or
++ die("Unable to read slow query log file $slogfile: $!\n");
++ while(<FILE>) {
++ next if (!/^#/);
++ next if (/^# Time:/);
++ s/[0-9]+/X/g;
++ print;
++ }
++
++ close(FILE);
++EOF
++
++SET GLOBAL slow_query_log_file=@old_slow_query_log_file;
++
++if(!$fixed_bug38124)
++{
++ --disable_query_log
++ let $my_var = `SELECT @old_slow_query_log_file`;
++ eval SET @@global.slow_query_log_file = '$my_var';
++ --enable_query_log
++}
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_filter-cl-master.opt
+@@ -0,0 +1 @@
++--log_slow_filter=full_join
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_filter-cl.test
+@@ -0,0 +1,2 @@
++SHOW VARIABLES LIKE 'log_slow_filter';
++SHOW GLOBAL VARIABLES LIKE 'log_slow_filter';
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_filter.test
+@@ -0,0 +1,26 @@
++--source include/have_debug.inc
++
++CREATE TABLE t(id INT PRIMARY KEY);
++INSERT INTO t VALUES(1);
++INSERT INTO t VALUES(2);
++INSERT INTO t VALUES(3);
++
++SET long_query_time=1;
++SET log_slow_filter=full_join;
++--let log_file=percona.slow_extended.log_slow_filter
++--source include/log_start.inc
++
++SET query_exec_time = 1.1;
++--disable_result_log
++SELECT * FROM t AS t1, t AS t2;
++--enable_result_log
++SET query_exec_time = default;
++
++--source include/log_stop.inc
++SET log_slow_filter=default;
++SET long_query_time=default;
++
++--let grep_pattern = Query_time
++--source include/log_grep.inc
++
++DROP TABLE t;
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_slave_statements-cl-master.opt
+@@ -0,0 +1 @@
++--log_slow_slave_statements
+\ No newline at end of file
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_slave_statements-cl.test
+@@ -0,0 +1,3 @@
++SHOW VARIABLES LIKE 'log_slow_slave_statements';
++SHOW GLOBAL VARIABLES LIKE 'log_slow_slave_statements';
++
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_slave_statements-innodb-slave.opt
+@@ -0,0 +1 @@
++--long_query_time=0 --log_slow_slave_statements --log_slow_verbosity=innodb
+\ No newline at end of file
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_slave_statements-innodb.test
+@@ -0,0 +1,42 @@
++--source include/have_binlog_format_statement.inc
++--source include/master-slave.inc
++--source include/have_innodb.inc
++--let log_file=percona.slow_extended.log_slow_slave_statements-innodb
++
++connection master;
++-- disable_warnings
++DROP TABLE IF EXISTS t;
++-- enable_warnings
++
++CREATE TABLE t(id INT,data CHAR(30)) ENGINE=InnoDB;
++INSERT INTO t VALUES
++(1,"aaaaabbbbbcccccdddddeeeeefffff"),
++(2,"aaaaabbbbbcccccdddddeeeeefffff"),
++(3,"aaaaabbbbbcccccdddddeeeeefffff"),
++(4,"aaaaabbbbbcccccdddddeeeeefffff"),
++(5,"aaaaabbbbbcccccdddddeeeeefffff");
++INSERT INTO t SELECT t2.id,t2.data from t as t1, t as t2;
++INSERT INTO t SELECT t2.id,t2.data from t as t1, t as t2;
++sync_slave_with_master;
++
++connection slave;
++--source include/log_start.inc
++
++connection master;
++INSERT INTO t SELECT t.id,t.data from t;
++sync_slave_with_master;
++
++connection slave;
++--source include/log_stop.inc
++
++--enable_query_log
++--enable_result_log
++
++--let grep_pattern = InnoDB_IO_r_ops
++--source include/log_grep.inc
++
++connection master;
++DROP TABLE t;
++sync_slave_with_master;
++
++--source include/rpl_end.inc
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_slave_statements-slave.opt
+@@ -0,0 +1 @@
++--long_query_time=0
+\ No newline at end of file
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_slave_statements.test
+@@ -0,0 +1,117 @@
++-- source include/have_binlog_format_statement.inc
++-- source include/master-slave.inc
++--let log_file=percona.slow_extended.log_slow_slave_statements
++--let show=SELECT Variable_value FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE Variable_name LIKE 'log_slow_slave_statements';
++
++connection master;
++-- disable_warnings
++DROP TABLE IF EXISTS t;
++-- enable_warnings
++
++CREATE TABLE t(id INT);
++sync_slave_with_master;
++
++connection slave;
++--source include/log_start.inc
++
++--disable_query_log
++--disable_result_log
++
++--echo LINE 1
++connection master;
++INSERT INTO t VALUES (1);
++sync_slave_with_master;
++
++connection slave;
++--let value=`$show`
++--echo LOG_SLOW_SLAVE_STATAMENTS is $value
++--echo LOG_SLOW_SLAVE_STATEMENTS=ON
++SET GLOBAL log_slow_slave_statements=ON;
++--let value=`$show`
++--echo LOG_SLOW_SLAVE_STATAMENTS is $value
++
++--echo LINE 2
++connection master;
++INSERT INTO t VALUES (2);
++sync_slave_with_master;
++
++--source include/restart_slave_sql.inc
++
++connection slave;
++--let value=`$show`
++--echo LOG_SLOW_SLAVE_STATAMENTS is $value
++
++--echo LINE 3
++connection master;
++INSERT INTO t VALUES (3);
++sync_slave_with_master;
++
++connection slave;
++--let value=`$show`
++--echo LOG_SLOW_SLAVE_STATAMENTS is $value
++--echo LOG_SLOW_SLAVE_STATEMENTS=OFF
++SET GLOBAL log_slow_slave_statements=OFF;
++--let value=`$show`
++--echo LOG_SLOW_SLAVE_STATAMENTS is $value
++
++--echo LINE 4
++connection master;
++INSERT INTO t VALUES (4);
++sync_slave_with_master;
++
++--source include/restart_slave_sql.inc
++
++connection slave;
++--let value=`$show`
++--echo LOG_SLOW_SLAVE_STATAMENTS is $value
++
++--echo LINE 5
++connection master;
++INSERT INTO t VALUES (5);
++sync_slave_with_master;
++
++connection slave;
++--let value=`$show`
++--echo LOG_SLOW_SLAVE_STATAMENTS is $value
++--echo LOG_SLOW_SLAVE_STATEMENTS=ON
++SET GLOBAL log_slow_slave_statements=ON;
++--let value=`$show`
++--echo LOG_SLOW_SLAVE_STATAMENTS is $value
++
++--echo LINE 6
++connection master;
++INSERT INTO t VALUES (6);
++sync_slave_with_master;
++
++--source include/restart_slave_sql.inc
++
++connection slave;
++--let value=`$show`
++--echo LOG_SLOW_SLAVE_STATAMENTS is $value
++
++--echo LINE 7
++connection master;
++INSERT INTO t VALUES (7);
++sync_slave_with_master;
++
++--enable_query_log
++--enable_result_log
++
++connection slave;
++--source include/log_stop.inc
++SET GLOBAL log_slow_slave_statements=default;
++
++connection slave;
++--let i=1
++while($i < 8)
++{
++--let grep_pattern= INSERT INTO t VALUES \($i\)
++--source include/log_grep.inc
++ inc $i;
++}
++
++connection master;
++DROP TABLE t;
++sync_slave_with_master;
++
++--source include/rpl_end.inc
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_sp_statements-cl-master.opt
+@@ -0,0 +1 @@
++--log_slow_sp_statements
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_sp_statements-cl.test
+@@ -0,0 +1,2 @@
++SHOW VARIABLES LIKE 'log_slow_sp_statements';
++SHOW GLOBAL VARIABLES LIKE 'log_slow_sp_statements';
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_sp_statements.test
+@@ -0,0 +1,29 @@
++--source include/have_debug.inc
++
++SET long_query_time=1;
++SET GLOBAL log_slow_sp_statements=ON;
++SET SESSION query_exec_time=0.1;
++--let log_file=percona.slow_extended.log_slow_sp_statements
++--source include/log_start.inc
++
++delimiter ^;
++CREATE PROCEDURE test_f()
++BEGIN
++ SET SESSION query_exec_time=1.1; SELECT 1;
++ SET SESSION query_exec_time=2.1; SELECT 1;
++ SET SESSION query_exec_time=3.1; SELECT 1;
++ SET SESSION query_exec_time=0.1;
++END^
++delimiter ;^
++
++CALL test_f();
++
++--source include/log_stop.inc
++SET SESSION query_exec_time=default;
++SET GLOBAL log_slow_sp_statements=default;
++SET long_query_time=default;
++
++--let grep_pattern = Query_time
++--source include/log_grep.inc
++
++DROP PROCEDURE test_f;
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_verbosity-cl-master.opt
+@@ -0,0 +1 @@
++--log_slow_verbosity="full"
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_verbosity-cl.test
+@@ -0,0 +1,2 @@
++SHOW VARIABLES LIKE 'log_slow_verbosity';
++SHOW GLOBAL VARIABLES LIKE 'log_slow_verbosity';
+--- /dev/null
++++ b/mysql-test/t/percona_log_slow_verbosity.test
+@@ -0,0 +1,19 @@
++--source include/have_innodb.inc
++--source include/have_debug.inc
++
++SET SESSION long_query_time=1;
++--let log_file=percona.slow_extended.log_slow_verbosity
++--source include/log_start.inc
++
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++SET SESSION log_slow_verbosity=innodb;
++SELECT 1;
++SET SESSION query_exec_time=default;
++
++--source include/log_stop.inc
++SET log_slow_verbosity=default;
++SET long_query_time=default;
++
++--let grep_pattern = No InnoDB statistics available for this query
++--source include/log_grep.inc
+--- /dev/null
++++ b/mysql-test/t/percona_long_query_time.test
+@@ -0,0 +1,25 @@
++--source include/have_debug.inc
++
++SET long_query_time=2;
++--let log_file=percona.slow_extended.long_query_time
++--source include/log_start.inc
++
++SET SESSION query_exec_time=1.1; SELECT 1;
++SET SESSION query_exec_time=3.1; SELECT 1;
++SET SESSION query_exec_time=5.1; SELECT 1;
++
++SET long_query_time=4;
++
++SET SESSION query_exec_time=1.1; SELECT 1;
++SET SESSION query_exec_time=3.1; SELECT 1;
++SET SESSION query_exec_time=5.1; SELECT 1;
++
++SET SESSION query_exec_time=default;
++
++SET long_query_time=2;
++
++--source include/log_stop.inc
++SET long_query_time=default;
++
++--let grep_pattern = Query_time
++--source include/log_grep.inc
+--- /dev/null
++++ b/mysql-test/t/percona_slow_query_log_timestamp_always-cl-master.opt
+@@ -0,0 +1 @@
++--slow_query_log_timestamp_always
+\ No newline at end of file
+--- /dev/null
++++ b/mysql-test/t/percona_slow_query_log_timestamp_always-cl.test
+@@ -0,0 +1,2 @@
++SHOW VARIABLES LIKE 'slow_query_log_timestamp_always';
++SHOW GLOBAL VARIABLES LIKE 'slow_query_log_timestamp_always';
+--- /dev/null
++++ b/mysql-test/t/percona_slow_query_log_timestamp_always.test
+@@ -0,0 +1,34 @@
++--source include/have_debug.inc
++
++SET long_query_time=2;
++SET GLOBAL slow_query_log_timestamp_always=ON;
++--let log_file=percona.slow_extended.slow_query_log_timestamp_always
++--source include/log_start.inc
++
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++SELECT 1;
++SELECT 1;
++
++SET GLOBAL slow_query_log_timestamp_always=OFF;
++
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++SELECT 1;
++SELECT 1;
++
++SET GLOBAL slow_query_log_timestamp_always=ON;
++
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++SELECT 1;
++SELECT 1;
++
++SET SESSION query_exec_time=default;
++
++--source include/log_stop.inc
++SET GLOBAL slow_query_log_timestamp_always=default;
++SET long_query_time=default;
++
++--let grep_pattern = # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+
++--source include/log_grep.inc
+--- /dev/null
++++ b/mysql-test/t/percona_slow_query_log_timestamp_precision-cl-master.opt
+@@ -0,0 +1 @@
++--slow_query_log_timestamp_precision='microsecond'
+\ No newline at end of file
+--- /dev/null
++++ b/mysql-test/t/percona_slow_query_log_timestamp_precision-cl.test
+@@ -0,0 +1,2 @@
++SHOW VARIABLES LIKE 'slow_query_log_timestamp_precision';
++SHOW GLOBAL VARIABLES LIKE 'slow_query_log_timestamp_precision';
+--- /dev/null
++++ b/mysql-test/t/percona_slow_query_log_timestamp_precision-master.opt
+@@ -0,0 +1 @@
++--slow_query_log_timestamp_always
+\ No newline at end of file
+--- /dev/null
++++ b/mysql-test/t/percona_slow_query_log_timestamp_precision.test
+@@ -0,0 +1,25 @@
++--source include/have_debug.inc
++
++SET long_query_time=2;
++--let log_file=percona.slow_extended.slow_query_log_timestamp_precision
++--source include/log_start.inc
++
++SET SESSION query_exec_time=2.1;
++
++SELECT 1;
++
++SET GLOBAL slow_query_log_timestamp_precision='microsecond';
++
++SELECT 1;
++
++SET SESSION query_exec_time=default;
++
++--source include/log_stop.inc
++SET GLOBAL slow_query_log_timestamp_precision=default;
++SET long_query_time=default;
++
++--let grep_pattern = # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+.[0-9]+
++--source include/log_grep.inc
++
++--let grep_pattern = # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+
++--source include/log_grep.inc
+--- /dev/null
++++ b/mysql-test/t/percona_slow_query_log_use_global_control.test
+@@ -0,0 +1,28 @@
++--source include/have_debug.inc
++--source include/have_innodb.inc
++
++SET GLOBAL long_query_time=1;
++
++--let log_file=percona.slow_extended.slow_query_log_use_global_control
++--source include/log_start.inc
++
++SET SESSION query_exec_time=1.1;
++SELECT 1;
++
++SET GLOBAL log_slow_verbosity=innodb;
++SET GLOBAL slow_query_log_use_global_control="log_slow_verbosity,long_query_time";
++
++SELECT 1;
++
++SET SESSION query_exec_time=default;
++
++--source include/log_stop.inc
++
++
++SET GLOBAL slow_query_log_use_global_control=default;
++SET GLOBAL log_slow_verbosity=default;
++SET GLOBAL long_query_time=default;
++
++--let grep_pattern = No InnoDB statistics available for this query
++--source include/log_grep.inc
++
+--- /dev/null
++++ b/mysql-test/r/percona_slow_query_log_use_global_control-cl.result
+@@ -0,0 +1,6 @@
++SHOW VARIABLES LIKE 'slow_query_log_use_global_control';
++Variable_name Value
++slow_query_log_use_global_control log_slow_verbosity,long_query_time
++SHOW GLOBAL VARIABLES LIKE 'slow_query_log_use_global_control';
++Variable_name Value
++slow_query_log_use_global_control log_slow_verbosity,long_query_time
+--- /dev/null
++++ b/mysql-test/t/percona_slow_query_log_use_global_control-cl-master.opt
+@@ -0,0 +1 @@
++--slow_query_log_use_global_control="log_slow_verbosity,long_query_time"
+--- /dev/null
++++ b/mysql-test/t/percona_slow_query_log_use_global_control-cl.test
+@@ -0,0 +1,2 @@
++SHOW VARIABLES LIKE 'slow_query_log_use_global_control';
++SHOW GLOBAL VARIABLES LIKE 'slow_query_log_use_global_control';
+--- /dev/null
++++ b/mysql-test/r/percona_min_examined_row_limit.result
+@@ -0,0 +1,34 @@
++drop table if exists t;
++create table t(id INT PRIMARY KEY);
++insert into t values(1);
++insert into t values(2);
++insert into t values(3);
++SET GLOBAL long_query_time=2;
++SET GLOBAL slow_query_log_use_global_control='long_query_time,min_examined_row_limit';
++[log_start.inc] percona.slow_extended.min_examined_row_limit
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++1
++1
++SET GLOBAL min_examined_row_limit=5;
++select * from t as t1, t as t2;
++id id
++1 1
++2 1
++3 1
++1 2
++2 2
++3 2
++1 3
++2 3
++3 3
++SELECT 1;
++1
++1
++SET SESSION query_exec_time=default;
++[log_stop.inc] percona.slow_extended.min_examined_row_limit
++SET GLOBAL min_examined_row_limit=default;
++SET GLOBAL slow_query_log_use_global_control=default;
++SET GLOBAL long_query_time=default;
++[log_grep.inc] file: percona.slow_extended.min_examined_row_limit pattern: Query_time
++[log_grep.inc] lines: 1
+--- /dev/null
++++ b/mysql-test/t/percona_min_examined_row_limit.test
+@@ -0,0 +1,35 @@
++--source include/have_debug.inc
++
++--disable_warnings
++drop table if exists t;
++--enable_warnings
++
++create table t(id INT PRIMARY KEY);
++insert into t values(1);
++insert into t values(2);
++insert into t values(3);
++
++SET GLOBAL long_query_time=2;
++SET GLOBAL slow_query_log_use_global_control='long_query_time,min_examined_row_limit';
++--let log_file=percona.slow_extended.min_examined_row_limit
++--source include/log_start.inc
++
++SET SESSION query_exec_time=2.1;
++SELECT 1;
++
++SET GLOBAL min_examined_row_limit=5;
++
++select * from t as t1, t as t2;
++SELECT 1;
++
++SET SESSION query_exec_time=default;
++
++--source include/log_stop.inc
++SET GLOBAL min_examined_row_limit=default;
++SET GLOBAL slow_query_log_use_global_control=default;
++SET GLOBAL long_query_time=default;
++
++--let grep_pattern = Query_time
++--source include/log_grep.inc
++
++DROP TABLE t;
+--- a/sql/log_event.cc
++++ b/sql/log_event.cc
+@@ -2380,6 +2380,14 @@
+ start+= host.length;
+ }
+ }
++#ifndef DBUG_OFF
++ if (thd && thd->variables.query_exec_time > 0)
++ {
++ *start++= Q_QUERY_EXEC_TIME;
++ int8store(start, thd->variables.query_exec_time);
++ start+= 8;
++ }
++#endif
+ /*
+ NOTE: When adding new status vars, please don't forget to update
+ the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update the function
+@@ -2866,6 +2874,17 @@
+ data_written= master_data_written= uint4korr(pos);
+ pos+= 4;
+ break;
++#if !defined(DBUG_OFF) && !defined(MYSQL_CLIENT)
++ case Q_QUERY_EXEC_TIME:
++ {
++ THD *thd= current_thd;
++ CHECK_SPACE(pos, end, 8);
++ if (thd)
++ thd->variables.query_exec_time= uint8korr(pos);
++ pos+= 8;
++ break;
++ }
++#endif
+ case Q_INVOKER:
+ {
+ CHECK_SPACE(pos, end, 1);
+--- a/sql/log_event.h
++++ b/sql/log_event.h
+@@ -342,6 +342,10 @@
+
+ #define Q_INVOKER 11
+
++#ifndef DBUG_OFF
++#define Q_QUERY_EXEC_TIME 250
++#endif
++
+ /* Intvar event post-header */
+
+ /* Intvar event data */
+--- /dev/null
++++ b/mysql-test/suite/sys_vars/r/query_exec_time_basic.result
+@@ -0,0 +1,2 @@
++SET GLOBAL query_exec_time=default;
++SET SESSION query_exec_time=default;
+--- /dev/null
++++ b/mysql-test/suite/sys_vars/t/query_exec_time_basic.test
+@@ -0,0 +1,4 @@
++--source include/have_debug.inc
++
++SET GLOBAL query_exec_time=default;
++SET SESSION query_exec_time=default;
| SQL_CACHE_SYM
{
/*
+--- /dev/null
++++ b/mysql-test/r/percona_sql_no_fcache.result
+@@ -0,0 +1,12 @@
++drop table if exists t1;
++create table t (a int not null);
++insert into t values (1),(2),(3);
++SELECT SQL_NO_FCACHE SLEEP(0);
++SLEEP(0)
++0
++SELECT /*!40001 SQL_NO_CACHE */ /*!50084 SQL_NO_FCACHE */ * FROM t;
++a
++1
++2
++3
++DROP TABLE t;
+--- /dev/null
++++ b/mysql-test/t/percona_sql_no_fcache.test
+@@ -0,0 +1,11 @@
++--disable_warnings
++drop table if exists t1;
++--enable_warnings
++
++create table t (a int not null);
++insert into t values (1),(2),(3);
++
++SELECT SQL_NO_FCACHE SLEEP(0);
++SELECT /*!40001 SQL_NO_CACHE */ /*!50084 SQL_NO_FCACHE */ * FROM t;
++
++DROP TABLE t;
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
-@@ -1630,6 +1630,8 @@
+@@ -1634,6 +1634,8 @@
*/
enum enum_server_command command;
uint32 server_id;
uint32 file_id; // for LOAD DATA INFILE
/* remote (peer) port */
uint16 peer_port;
-@@ -2101,6 +2103,8 @@
+@@ -2105,6 +2107,8 @@
*/
enum_tx_isolation tx_isolation;
enum_check_fields count_cuted_fields;
DYNAMIC_ARRAY user_var_events; /* For user variables replication */
MEM_ROOT *user_var_events_alloc; /* Allocate above array elements here */
-@@ -2195,6 +2199,49 @@
+@@ -2199,6 +2203,49 @@
*/
LOG_INFO* current_linfo;
NET* slave_net; // network connection from slave -> m.
/* Used by the sys_var class to store temporary values */
union
{
-@@ -2275,6 +2322,11 @@
+@@ -2279,6 +2326,11 @@
alloc_root.
*/
void init_for_queries();
void change_user(void);
void cleanup(void);
void cleanup_after_query();
-@@ -2747,6 +2799,15 @@
+@@ -2751,6 +2803,15 @@
}
thd_scheduler scheduler;
public:
inline Internal_error_handler *get_internal_handler()
{ return m_internal_handler; }
-@@ -2947,6 +3008,10 @@
+@@ -2951,6 +3012,10 @@
LEX_STRING invoker_host;
};
};
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
-@@ -116,6 +116,9 @@
- static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
+@@ -117,6 +117,9 @@
static void sql_kill(THD *thd, ulong id, bool only_kill_query);
+ static inline ulonglong get_query_exec_time(THD *thd, ulonglong cur_utime);
+// Uses the THD to update the global stats by user name and client IP
+void update_global_user_stats(THD* thd, bool create_user, time_t now);
const char *any_db="*any*"; // Special symbol for check_access
const LEX_STRING command_name[]={
-@@ -700,6 +703,12 @@
+@@ -701,6 +704,12 @@
*/
thd->clear_error(); // Clear error message
thd->stmt_da->reset_diagnostics_area();
net_new_transaction(net);
-@@ -885,6 +894,10 @@
+@@ -886,6 +895,10 @@
(char *) thd->security_ctx->host_or_ip);
thd->command=command;
/*
Commands which always take a long time are logged into
the slow log only if opt_log_slow_admin_statements is set.
-@@ -1663,6 +1676,13 @@
+@@ -1667,6 +1680,13 @@
thd->profiling.discard_current_query();
#endif
break;
case SCH_OPEN_TABLES:
case SCH_VARIABLES:
case SCH_STATUS:
-@@ -1820,6 +1840,7 @@
+@@ -1824,6 +1844,7 @@
thd->security_ctx->priv_host)) &&
check_global_access(thd, SUPER_ACL))
{
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
DBUG_RETURN(TRUE);
}
-@@ -4802,6 +4823,7 @@
+@@ -4806,6 +4827,7 @@
case ACL_INTERNAL_ACCESS_DENIED:
if (! no_errors)
{
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
sctx->priv_user, sctx->priv_host, db);
}
-@@ -4852,6 +4874,7 @@
+@@ -4856,6 +4878,7 @@
DBUG_PRINT("error",("No possible access"));
if (!no_errors)
{
if (thd->password == 2)
my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0),
sctx->priv_user,
-@@ -4968,6 +4991,7 @@
+@@ -4972,6 +4995,7 @@
if (!thd->col_access && check_grant_db(thd, dst_db_name))
{
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
thd->security_ctx->priv_user,
thd->security_ctx->priv_host,
-@@ -5238,6 +5262,7 @@
+@@ -5242,6 +5266,7 @@
if ((thd->security_ctx->master_access & want_access))
return 0;
get_privilege_desc(command, sizeof(command), want_access);
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
return 1;
#else
-@@ -5619,6 +5644,32 @@
+@@ -5623,6 +5648,32 @@
lex_start(thd);
mysql_reset_thd_for_next_command(thd);
if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0)
{
LEX *lex= thd->lex;
-@@ -5687,6 +5738,52 @@
+@@ -5691,6 +5742,52 @@
DBUG_ASSERT(thd->change_list.is_empty());
}
#define REG_NEW_RECORD 2 /* Write a new record if not found */
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
-@@ -1609,6 +1609,17 @@
+@@ -1632,6 +1632,17 @@
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_read_only), ON_UPDATE(fix_read_only));
MYSQL_READ_ROW_DONE(error);
return error;
}
+--- /dev/null
++++ b/mysql-test/r/userstat_bug602047.result
+@@ -0,0 +1,15 @@
++DROP TABLE IF EXISTS t1;
++SET GLOBAL userstat=ON;
++CREATE TABLE t1 ( id int(10), PRIMARY KEY (id)) ENGINE=InnoDB;
++INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
++SELECT COUNT(*) FROM t1;
++COUNT(*)
++10
++SELECT ROWS_READ FROM information_schema.table_statistics WHERE TABLE_NAME='t1';
++ROWS_READ
++10
++SELECT ROWS_READ FROM information_schema.index_statistics WHERE TABLE_NAME='t1';
++ROWS_READ
++10
++SET GLOBAL userstat=OFF;
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/t/userstat_bug602047.test
+@@ -0,0 +1,11 @@
++--disable_warnings
++DROP TABLE IF EXISTS t1;
++--enable_warnings
++SET GLOBAL userstat=ON;
++CREATE TABLE t1 ( id int(10), PRIMARY KEY (id)) ENGINE=InnoDB;
++INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
++SELECT COUNT(*) FROM t1;
++SELECT ROWS_READ FROM information_schema.table_statistics WHERE TABLE_NAME='t1';
++SELECT ROWS_READ FROM information_schema.index_statistics WHERE TABLE_NAME='t1';
++SET GLOBAL userstat=OFF;
++DROP TABLE t1;
+\ No newline at end of file
--- /dev/null
+--- /dev/null
++++ b/mysql-test/r/percona_xtradb_bug317074.result
+@@ -0,0 +1,5 @@
++SET @old_innodb_file_format=@@innodb_file_format;
++SET @old_innodb_file_format_max=@@innodb_file_format_max;
++SET @old_innodb_file_per_table=@@innodb_file_per_table;
++SET GLOBAL innodb_file_format='Barracuda';
++SET GLOBAL innodb_file_per_table=ON;
+--- /dev/null
++++ b/mysql-test/t/percona_xtradb_bug317074.test
+@@ -0,0 +1,47 @@
++-- source include/have_innodb.inc
++
++SET @old_innodb_file_format=@@innodb_file_format;
++SET @old_innodb_file_format_max=@@innodb_file_format_max;
++SET @old_innodb_file_per_table=@@innodb_file_per_table;
++SET GLOBAL innodb_file_format='Barracuda';
++SET GLOBAL innodb_file_per_table=ON;
++
++-- disable_query_log
++-- disable_result_log
++
++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;
++
++delimiter |;
++CREATE PROCEDURE insert_many(p1 int)
++BEGIN
++SET @x = 0;
++SET @y = 0;
++start transaction;
++REPEAT
++ insert into test1 set b=1;
++ SET @x = @x + 1;
++ SET @y = @y + 1;
++ IF @y >= 1000 THEN
++ commit;
++ start transaction;
++ SET @y = 0;
++ END IF;
++UNTIL @x >= p1 END REPEAT;
++commit;
++END|
++delimiter ;|
++call insert_many(100000);
++DROP PROCEDURE insert_many;
++
++# The bug is hangup at the following statement
++ALTER TABLE test1 ENGINE=MyISAM;
++
++DROP TABLE test1;
++SET GLOBAL innodb_file_format=@old_innodb_file_format;
++SET GLOBAL innodb_file_format_max=@old_innodb_file_format_max;
++SET GLOBAL innodb_file_per_table=@old_innodb_file_per_table;