blob: c718b2c3d28ac71115038383822f0ec1811df4c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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
|