1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

merge with 5.3

sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
This commit is contained in:
Sergei Golubchik
2011-10-19 21:45:18 +02:00
1705 changed files with 166414 additions and 39720 deletions

View File

@@ -0,0 +1,16 @@
perl;
$file = $ENV{'grep_file'};
$pattern = $ENV{'grep_pattern'};
open(FILE, "$file")
or die("Cannot open file $file: $!\n");
$lines = 0;
while(<FILE>) {
$lines++ if (/$pattern/);
}
print "$lines\n";
close(FILE);
EOF

View File

@@ -0,0 +1 @@
--use_global_long_query_time --log_slow_verbosity="full"

View File

@@ -0,0 +1,18 @@
show variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time ON
show variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control long_query_time
show variables like 'log_slow_verbosity';
Variable_name Value
log_slow_verbosity microtime,query_plan,innodb
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time ON
show global variables like 'log_slow_verbosity';
Variable_name Value
log_slow_verbosity microtime,query_plan,innodb
show global variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control long_query_time

View File

@@ -0,0 +1,6 @@
show variables like 'use_global_long_query_time';
show variables like 'use_global_log_slow_control';
show variables like 'log_slow_verbosity';
show global variables like 'use_global_long_query_time';
show global variables like 'log_slow_verbosity';
show global variables like 'use_global_log_slow_control';

View File

@@ -0,0 +1 @@
--use_global_log_slow_control="long_query_time"

View File

@@ -0,0 +1,12 @@
show variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time ON
show variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control long_query_time
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time ON
show global variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control long_query_time

View File

@@ -0,0 +1,4 @@
show variables like 'use_global_long_query_time';
show variables like 'use_global_log_slow_control';
show global variables like 'use_global_long_query_time';
show global variables like 'use_global_log_slow_control';

View File

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

View File

@@ -0,0 +1,12 @@
SELECT sleep(2);
sleep(2)
0
set global log_slow_verbosity=innodb;
set global use_global_log_slow_control="log_slow_verbosity,long_query_time";
SELECT sleep(2);
sleep(2)
0
set global use_global_log_slow_control=none;
set global log_slow_verbosity=microtime;
FLUSH LOGS;
1

View File

@@ -0,0 +1,12 @@
source include/have_innodb.inc;
SELECT sleep(2);
set global log_slow_verbosity=innodb;
set global use_global_log_slow_control="log_slow_verbosity,long_query_time";
SELECT sleep(2);
set global use_global_log_slow_control=none;
set global log_slow_verbosity=microtime;
FLUSH LOGS;
--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-control_global_slow.log
--let grep_pattern = No InnoDB statistics available for this query
--source include/grep.inc

View File

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

View File

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

View File

@@ -0,0 +1,32 @@
source include/have_xtradb.inc;
--disable_warnings
drop table if exists t;
--enable_warnings
--echo # Create test table
create table t(id INT PRIMARY KEY) engine=InnoDB;
--echo # Insert two rows to test table
insert into t values(1);
insert into t values(2);
insert into t values(3);
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(2);
set log_slow_filter=full_join;
SELECT sleep(2) union select t2.id from t as t1,t as t2;
SELECT sleep(2);
SET GLOBAL SLOW_QUERY_LOG=OFF;
--disable_warnings
drop table if exists t;
--enable_warnings
FLUSH LOGS;
--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-log_slow_filter.log
--let grep_pattern = Query_time
--source grep.inc

View File

@@ -0,0 +1,3 @@
show global variables like 'log_slow_sp_statements';
Variable_name Value
log_slow_sp_statements ON

View File

@@ -0,0 +1 @@
show global variables like 'log_slow_sp_statements';

View File

@@ -0,0 +1,3 @@
show global variables like 'log_slow_timestamp_every';
Variable_name Value
log_slow_timestamp_every ON

View File

@@ -0,0 +1 @@
show global variables like 'log_slow_timestamp_every';

View File

@@ -0,0 +1 @@
--log_slow_verbosity="full"

View File

@@ -0,0 +1,9 @@
show global variables like 'log_slow_verbosity';
Variable_name Value
log_slow_verbosity microtime,query_plan,innodb
show variables like 'log_slow_verbosity';
Variable_name Value
log_slow_verbosity microtime,query_plan,innodb
select @@log_slow_verbosity;
@@log_slow_verbosity
microtime,query_plan,innodb

View File

@@ -0,0 +1,3 @@
show global variables like 'log_slow_verbosity';
show variables like 'log_slow_verbosity';
select @@log_slow_verbosity;

View File

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

View File

@@ -0,0 +1,9 @@
SELECT sleep(2);
sleep(2)
0
set log_slow_verbosity=innodb;
SELECT sleep(2);
sleep(2)
0
FLUSH LOGS;
1

View File

@@ -0,0 +1,12 @@
source include/have_xtradb.inc;
SELECT sleep(2);
set log_slow_verbosity=innodb;
SELECT sleep(2);
FLUSH LOGS;
--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-log_slow_verbosity.log
--let grep_pattern = No InnoDB statistics available for this query
--source grep.inc

View File

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

View File

@@ -0,0 +1,24 @@
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set long_query_time=4;
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set long_query_time=2;
SET GLOBAL SLOW_QUERY_LOG=OFF;
FLUSH LOGS;
3

View File

@@ -0,0 +1,23 @@
source include/have_xtradb.inc;
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set long_query_time=4;
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set long_query_time=2;
SET GLOBAL SLOW_QUERY_LOG=OFF;
FLUSH LOGS;
--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-long_query_time.log
--let grep_pattern = Query_time
--source grep.inc

View File

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

View File

@@ -0,0 +1,13 @@
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(2);
sleep(2)
0
set global slow_query_log_timestamp_precision='microsecond';
SELECT sleep(2);
sleep(2)
0
set global slow_query_log_timestamp_precision='second';
SET GLOBAL SLOW_QUERY_LOG=OFF;
FLUSH LOGS;
1
2

View File

@@ -0,0 +1,23 @@
source include/have_xtradb.inc;
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(2);
set global slow_query_log_timestamp_precision='microsecond';
SELECT sleep(2);
set global slow_query_log_timestamp_precision='second';
SET GLOBAL SLOW_QUERY_LOG=OFF;
FLUSH LOGS;
--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log
--let grep_pattern = # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+.[0-9]+
--source grep.inc
--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log
--let grep_pattern = # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+
--source grep.inc

View File

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

View File

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

View File

@@ -0,0 +1,32 @@
source include/have_xtradb.inc;
--disable_warnings
drop table if exists t;
--enable_warnings
--echo # Create test table
create table t(id INT PRIMARY KEY) engine=InnoDB;
--echo # Insert two rows to test table
insert into t values(1);
insert into t values(2);
insert into t values(3);
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(2);
set min_examined_row_limit=5;
SELECT sleep(2) union select t2.id from t as t1,t as t2;
SELECT sleep(2);
SET GLOBAL SLOW_QUERY_LOG=OFF;
--disable_warnings
drop table if exists t;
--enable_warnings
FLUSH LOGS;
--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-min_examined_row_limit.log
--let grep_pattern = Query_time
--source grep.inc

View File

@@ -0,0 +1 @@
--long_query_time=0 --log_slow_verbosity=innodb --log_slow_slave_statements

View File

@@ -0,0 +1 @@
--long_query_time=0 --log_slow_verbosity=innodb --log_slow_slave_statements

View File

@@ -0,0 +1,22 @@
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;
STOP SLAVE;
include/wait_for_slave_to_stop.inc
START SLAVE;
include/wait_for_slave_to_start.inc
INSERT INTO t SELECT t.id,t.data from t;
DROP TABLE IF EXISTS t;
FLUSH LOGS;
4
STOP SLAVE;
include/wait_for_slave_to_stop.inc

View File

@@ -0,0 +1,51 @@
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_xtradb.inc
-- source include/master-slave.inc
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;
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
--shutdown_server 10
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart
EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
START SLAVE;
-- source include/wait_for_slave_to_start.inc
connection master;
INSERT INTO t SELECT t.id,t.data from t;
sync_slave_with_master;
connection master;
DROP TABLE IF EXISTS t;
sync_slave_with_master;
connection slave;
FLUSH LOGS;
--let grep_file = $MYSQLTEST_VARDIR/mysqld.2/mysqld-slow.log
--let grep_pattern = InnoDB_IO_r_ops
--source grep.inc
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc

View File

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

View File

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

View File

@@ -0,0 +1,89 @@
include/master-slave.inc
[connection master]
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT);
START SLAVE;
include/wait_for_slave_to_start.inc
INSERT INTO t VALUES (1);
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements OFF
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
INSERT INTO t VALUES (2);
STOP SLAVE;
include/wait_for_slave_to_stop.inc
START SLAVE;
include/wait_for_slave_to_start.inc
INSERT INTO t VALUES (3);
show variables like 'long_query_time';
Variable_name Value
long_query_time 1.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 1.000000
show global variables like 'slow_query_log_use_global_control';
Variable_name Value
slow_query_log_use_global_control
set global long_query_time=0;
show variables like 'long_query_time';
Variable_name Value
long_query_time 1.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'slow_query_log_use_global_control';
Variable_name Value
slow_query_log_use_global_control
INSERT INTO t VALUES (4);
show variables like 'long_query_time';
Variable_name Value
long_query_time 1.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'slow_query_log_use_global_control';
Variable_name Value
slow_query_log_use_global_control
set global slow_query_log_use_global_control='long_query_time';
show variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'slow_query_log_use_global_control';
Variable_name Value
slow_query_log_use_global_control long_query_time
INSERT INTO t VALUES (5);
show variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'slow_query_log_use_global_control';
Variable_name Value
slow_query_log_use_global_control long_query_time
set global long_query_time=1;
set global slow_query_log_use_global_control='';
FLUSH LOGS;
# Analyse master slow_query_log
0
0
0
0
0
FLUSH LOGS;
# Analyse slave slow_query_log
0
0
0
0
1
set global log_slow_slave_statements=OFF;
DROP TABLE t;
STOP SLAVE;
include/wait_for_slave_to_stop.inc

View File

@@ -0,0 +1,107 @@
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc
connection master;
-- disable_warnings
DROP TABLE IF EXISTS t;
-- enable_warnings
CREATE TABLE t(id INT);
-- disable_warnings
connection slave;
START SLAVE;
-- source include/wait_for_slave_to_start.inc
-- enable_warnings
connection master;
INSERT INTO t VALUES (1);
sync_slave_with_master;
connection slave;
show variables like 'log_slow_slave_statements';
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
connection master;
INSERT INTO t VALUES (2);
sync_slave_with_master;
connection slave;
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc
START SLAVE;
-- source include/wait_for_slave_to_start.inc
connection master;
INSERT INTO t VALUES (3);
sync_slave_with_master;
connection slave;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'slow_query_log_use_global_control';
set global long_query_time=0;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'slow_query_log_use_global_control';
connection master;
INSERT INTO t VALUES (4);
sync_slave_with_master;
connection slave;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'slow_query_log_use_global_control';
set global slow_query_log_use_global_control='long_query_time';
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'slow_query_log_use_global_control';
#-- echo # Make insert(5) on master
connection master;
INSERT INTO t VALUES (5);
sync_slave_with_master;
connection slave;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'slow_query_log_use_global_control';
set global long_query_time=1;
set global slow_query_log_use_global_control='';
connection master;
FLUSH LOGS;
-- echo # Analyse master slow_query_log
let $i=5;
let $k=1;
while($i)
{
--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_log_slow_slave_statements-master.log
--let grep_pattern = INSERT INTO t VALUES \($k\)
--source grep.inc
dec $i;
inc $k;
}
connection slave;
FLUSH LOGS;
-- echo # Analyse slave slow_query_log
let $i=5;
let $k=1;
while($i)
{
--let grep_file = $MYSQLTEST_VARDIR/mysqld.2/data/percona_log_slow_slave_statements-slave.log
--let grep_pattern = INSERT INTO t VALUES \($k\)
--source grep.inc
dec $i;
inc $k;
}
set global log_slow_slave_statements=OFF;
connection master;
DROP TABLE t;
sync_slave_with_master;
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc

View File

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

View File

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

View File

@@ -0,0 +1,94 @@
include/master-slave.inc
[connection master]
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT);
START SLAVE;
include/wait_for_slave_to_start.inc
INSERT INTO t VALUES (1);
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements OFF
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
INSERT INTO t VALUES (2);
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
STOP SLAVE;
include/wait_for_slave_to_stop.inc
START SLAVE;
include/wait_for_slave_to_start.inc
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
INSERT INTO t VALUES (3);
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
set global log_slow_slave_statements=OFF;
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements OFF
INSERT INTO t VALUES (4);
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements OFF
STOP SLAVE;
include/wait_for_slave_to_stop.inc
START SLAVE;
include/wait_for_slave_to_start.inc
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements OFF
INSERT INTO t VALUES (5);
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements OFF
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
INSERT INTO t VALUES (6);
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
STOP SLAVE;
include/wait_for_slave_to_stop.inc
START SLAVE;
include/wait_for_slave_to_start.inc
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
INSERT INTO t VALUES (7);
FLUSH LOGS;
# Analyse master slow_query_log
1
1
1
1
1
1
1
FLUSH LOGS;
# Analyse slave slow_query_log
0
0
1
0
0
0
1
set global log_slow_slave_statements=OFF;
DROP TABLE t;
STOP SLAVE;
include/wait_for_slave_to_stop.inc

View File

@@ -0,0 +1,133 @@
-- source include/have_binlog_format_statement.inc
-- source include/master-slave.inc
connection master;
-- disable_warnings
DROP TABLE IF EXISTS t;
-- enable_warnings
CREATE TABLE t(id INT);
-- disable_warnings
connection slave;
START SLAVE;
-- source include/wait_for_slave_to_start.inc
-- enable_warnings
connection master;
INSERT INTO t VALUES (1);
sync_slave_with_master;
connection slave;
show variables like 'log_slow_slave_statements';
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
connection master;
INSERT INTO t VALUES (2);
sync_slave_with_master;
connection slave;
show variables like 'log_slow_slave_statements';
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc
START SLAVE;
-- source include/wait_for_slave_to_start.inc
connection slave;
show variables like 'log_slow_slave_statements';
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
connection master;
INSERT INTO t VALUES (3);
sync_slave_with_master;
connection slave;
show variables like 'log_slow_slave_statements';
set global log_slow_slave_statements=OFF;
show variables like 'log_slow_slave_statements';
connection master;
INSERT INTO t VALUES (4);
sync_slave_with_master;
connection slave;
show variables like 'log_slow_slave_statements';
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc
START SLAVE;
-- source include/wait_for_slave_to_start.inc
connection slave;
show variables like 'log_slow_slave_statements';
connection master;
INSERT INTO t VALUES (5);
sync_slave_with_master;
connection slave;
show variables like 'log_slow_slave_statements';
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
connection master;
INSERT INTO t VALUES (6);
sync_slave_with_master;
connection slave;
show variables like 'log_slow_slave_statements';
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc
START SLAVE;
-- source include/wait_for_slave_to_start.inc
connection slave;
show variables like 'log_slow_slave_statements';
connection master;
INSERT INTO t VALUES (7);
sync_slave_with_master;
connection master;
FLUSH LOGS;
-- echo # Analyse master slow_query_log
let $i=7;
let $k=1;
while($i)
{
--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_log_slow_slave_statements-master.log
--let grep_pattern = INSERT INTO t VALUES \($k\)
--source grep.inc
dec $i;
inc $k;
}
connection slave;
FLUSH LOGS;
-- echo # Analyse slave slow_query_log
let $i=7;
let $k=1;
while($i)
{
--let grep_file = $MYSQLTEST_VARDIR/mysqld.2/data/percona_log_slow_slave_statements-slave.log
--let grep_pattern = INSERT INTO t VALUES \($k\)
--source grep.inc
dec $i;
inc $k;
}
set global log_slow_slave_statements=OFF;
connection master;
DROP TABLE t;
sync_slave_with_master;
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc

View File

@@ -0,0 +1 @@
--slow_query_log_timestamp_precision='microsecond'

View File

@@ -0,0 +1,3 @@
show global variables like 'slow_query_log_timestamp_precision';
Variable_name Value
slow_query_log_timestamp_precision microsecond

View File

@@ -0,0 +1 @@
show global variables like 'slow_query_log_timestamp_precision';

View File

@@ -0,0 +1,3 @@
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time ON

View File

@@ -0,0 +1 @@
show global variables like 'use_global_long_query_time';

View File

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

View File

@@ -0,0 +1,46 @@
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set global long_query_time=4;
set global slow_query_log_use_global_control='long_query_time';
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set global long_query_time=2;
set global slow_query_log_use_global_control='';
SET GLOBAL SLOW_QUERY_LOG=OFF;
FLUSH LOGS;
3
show global variables like 'slow_query_log_use_global_control';
Variable_name Value
slow_query_log_use_global_control
set global slow_query_log_use_global_control='long_query_time';
show global variables like 'slow_query_log_use_global_control';
Variable_name Value
slow_query_log_use_global_control long_query_time
set global slow_query_log_use_global_control='log_slow_filter,long_query_time';
show global variables like 'slow_query_log_use_global_control';
Variable_name Value
slow_query_log_use_global_control log_slow_filter,long_query_time
set global slow_query_log_use_global_control='log_slow_filter';
show global variables like 'slow_query_log_use_global_control';
Variable_name Value
slow_query_log_use_global_control log_slow_filter
set global slow_query_log_use_global_control='';
show global variables like 'slow_query_log_use_global_control';
Variable_name Value
slow_query_log_use_global_control
set global slow_query_log_use_global_control='long_query_time';

View File

@@ -0,0 +1,40 @@
source include/have_xtradb.inc;
SET GLOBAL SLOW_QUERY_LOG=ON;
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set global long_query_time=4;
set global slow_query_log_use_global_control='long_query_time';
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set global long_query_time=2;
set global slow_query_log_use_global_control='';
SET GLOBAL SLOW_QUERY_LOG=OFF;
FLUSH LOGS;
--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-use_global_long_query_time.log
--let grep_pattern = Query_time
--source grep.inc
show global variables like 'slow_query_log_use_global_control';
set global slow_query_log_use_global_control='long_query_time';
show global variables like 'slow_query_log_use_global_control';
set global slow_query_log_use_global_control='log_slow_filter,long_query_time';
show global variables like 'slow_query_log_use_global_control';
set global slow_query_log_use_global_control='log_slow_filter';
show global variables like 'slow_query_log_use_global_control';
set global slow_query_log_use_global_control='';
show global variables like 'slow_query_log_use_global_control';
set global slow_query_log_use_global_control='long_query_time';