1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge XtraDB from Percona-Server 5.1.52-11.6 into MariaDB 5.1

revid:oleg.tsarev@percona.com-20101118145125-wjhjrb5jwhi0g7sj
This commit is contained in:
unknown
2010-11-24 14:04:38 +01:00
114 changed files with 340 additions and 2493 deletions

View File

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

View File

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

View File

@ -0,0 +1,10 @@
source include/have_innodb.inc;
SELECT sleep(2);
set global log_slow_verbosity=innodb;
set global use_global_log_slow_control="log_slow_verbosity,long_query_time";
SELECT sleep(2);
set global use_global_log_slow_control=none;
set global log_slow_verbosity=microtime;
let $cmd = cat var/mysqld.1/data/percona_slow_query_log-control_global_slow.log | grep "No InnoDB statistics available for this query" | wc -l;
echo $cmd;
exec $cmd;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,11 @@
source include/have_innodb.inc;
SELECT sleep(2);
set log_slow_verbosity=innodb;
SELECT sleep(2);
let $cmd = cat var/mysqld.1/data/percona_slow_query_log-log_slow_verbosity.log | grep "No InnoDB statistics available for this query" | wc -l;
echo $cmd;
exec $cmd;

View File

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

View File

@ -0,0 +1,22 @@
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set long_query_time=4;
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set long_query_time=2;
cat var/mysqld.1/data/percona_slow_query_log-long_query_time.log | grep Query_time | wc -l
3

View File

@ -0,0 +1,17 @@
source include/have_innodb.inc;
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set long_query_time=4;
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set long_query_time=2;
let $cmd = cat var/mysqld.1/data/percona_slow_query_log-long_query_time.log | grep Query_time | wc -l;
echo $cmd;
exec $cmd;

View File

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

View File

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

View File

@ -0,0 +1,17 @@
source include/have_innodb.inc;
SELECT sleep(2);
set global slow_query_log_microseconds_timestamp=ON;
SELECT sleep(2);
set global slow_query_log_microseconds_timestamp=OFF;
let $cmd = cat var/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+.[0-9]+' | wc -l;
echo $cmd;
exec $cmd;
let $cmd = cat var/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+' | wc -l;
echo $cmd;
exec $cmd;

View File

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

View File

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

View File

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

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,21 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
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;
START SLAVE;
INSERT INTO t SELECT t.id,t.data from t;
DROP TABLE IF EXISTS t;
4

View File

@ -0,0 +1,44 @@
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_innodb.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;
exec cat var/mysqld.2/mysqld-slow.log | grep InnoDB_IO_r_ops | wc -l;

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

View File

@ -0,0 +1,107 @@
-- source include/have_binlog_format_mixed_or_statement.inc
-- echo # Activate master-slave replication
-- source include/master-slave.inc
connection master;
-- echo # Make table t for test
-- disable_warnings
DROP TABLE IF EXISTS t;
-- enable_warnings
CREATE TABLE t(id INT);
-- echo # Start slave replication
-- disable_warnings
connection slave;
START SLAVE;
-- source include/wait_for_slave_to_start.inc
-- enable_warnings
#-- echo # Make insert(1) on master
connection master;
INSERT INTO t VALUES (1);
sync_slave_with_master;
connection slave;
-- echo # Read and change log_slow_slave_statements to ON on slave
show variables like 'log_slow_slave_statements';
set global log_slow_slave_statements=ON;
show variables like 'log_slow_slave_statements';
#-- echo # Make insert(2) on master
connection master;
INSERT INTO t VALUES (2);
sync_slave_with_master;
connection slave;
-- echo # Restart slave
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc
START SLAVE;
-- source include/wait_for_slave_to_start.inc
#-- echo # Make insert(3) on master
connection master;
INSERT INTO t VALUES (3);
sync_slave_with_master;
connection slave;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'use_global_long_query_time';
set global long_query_time=0;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'use_global_long_query_time';
#-- echo # Make insert(4) on master
connection master;
INSERT INTO t VALUES (4);
sync_slave_with_master;
connection slave;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'use_global_long_query_time';
set global use_global_long_query_time=1;
show variables like 'long_query_time';
show global variables like 'long_query_time';
show global variables like 'use_global_long_query_time';
#-- echo # Make insert(5) on master
connection master;
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 'use_global_long_query_time';
set global long_query_time=1;
set global use_global_long_query_time=0;
-- echo # Analyse master slow_query_log
let $i=5;
let $k=1;
let $cmd=cat ./var/mysqld.1/data/percona_log_slow_slave_statements-master.log | grep;
while($i)
{
let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l;
exec $current_cmd;
dec $i;
inc $k;
}
-- echo # Analyse slave slow_query_log
let $i=5;
let $k=1;
let $cmd=cat ./var/mysqld.2/data/percona_log_slow_slave_statements-slave.log | grep;
while($i)
{
let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l;
exec $current_cmd;
dec $i;
inc $k;
}
set global log_slow_slave_statements=OFF;
connection master;
DROP TABLE t;
sync_slave_with_master;
connection slave;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,59 @@
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set global long_query_time=4;
set global use_global_long_query_time=1;
SELECT sleep(1);
sleep(1)
0
SELECT sleep(3);
sleep(3)
0
SELECT sleep(5);
sleep(5)
0
set global long_query_time=2;
set global use_global_long_query_time=0;
cat var/mysqld.1/data/percona_slow_query_log-use_global_long_query_time.log | grep Query_time | wc -l
3
show global variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control none
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time OFF
set global use_global_log_slow_control = long_query_time;
show global 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
set global use_global_log_slow_control = log_slow_filter;
show global variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control log_slow_filter
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time OFF
set global use_global_long_query_time = ON;
show global variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control log_slow_filter,long_query_time
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time ON
set global use_global_long_query_time = OFF;
show global variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control log_slow_filter
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time OFF
set global use_global_log_slow_control = long_query_time;

View File

@ -0,0 +1,40 @@
source include/have_innodb.inc;
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set global long_query_time=4;
set global use_global_long_query_time=1;
SELECT sleep(1);
SELECT sleep(3);
SELECT sleep(5);
set global long_query_time=2;
set global use_global_long_query_time=0;
let $cmd = cat var/mysqld.1/data/percona_slow_query_log-use_global_long_query_time.log | grep Query_time | wc -l;
echo $cmd;
exec $cmd;
show global variables like 'use_global_log_slow_control';
show global variables like 'use_global_long_query_time';
set global use_global_log_slow_control = long_query_time;
show global variables like 'use_global_log_slow_control';
show global variables like 'use_global_long_query_time';
set global use_global_log_slow_control = log_slow_filter;
show global variables like 'use_global_log_slow_control';
show global variables like 'use_global_long_query_time';
set global use_global_long_query_time = ON;
show global variables like 'use_global_log_slow_control';
show global variables like 'use_global_long_query_time';
set global use_global_long_query_time = OFF;
show global variables like 'use_global_log_slow_control';
show global variables like 'use_global_long_query_time';
set global use_global_log_slow_control = long_query_time;

View File

@ -0,0 +1,23 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT);
INSERT INTO t SELECT SLEEP(5);
STOP SLAVE;
select count(*) from t;
count(*)
0
SHOW SLAVE STATUS NOLOCK;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
host user port 1 master-bin.000001 276 slave-relay-bin.000003 422 master-bin.000001 No No 0 0 276 577 None 0 No NULL No 0 0
select count(*) from t;
count(*)
0
START SLAVE;
Warnings:
Note 1592 Statement may not be safe to log in statement format.
DROP TABLE t;

View File

@ -0,0 +1,28 @@
--source include/master-slave.inc
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(5);
sleep 1;
connection slave;
send STOP SLAVE;
connection slave1;
select count(*) from t;
replace_column 2 host 3 user 4 port;
SHOW SLAVE STATUS NOLOCK;
select count(*) from t;
connection slave;
reap;
--source include/wait_for_slave_to_stop.inc
START SLAVE;
--source include/wait_for_slave_to_start.inc
connection master;
reap;
DROP TABLE t;
sync_slave_with_master;