File: rpl_max_relay_size.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (117 lines) | stat: -rw-r--r-- 2,638 bytes parent folder | download | duplicates (2)
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
108
109
110
111
112
113
114
115
116
117
# Test of options max_binlog_size and max_relay_log_size and
# how they act (if max_relay_log_size == 0, use max_binlog_size 
# for relay logs too).
# Test of manual relay log rotation with FLUSH LOGS.

# Requires statement logging
-- source include/master-slave.inc

connection slave;
stop slave;
connection master;

--echo #
--echo # Generate a big enough master's binlog to cause relay log rotations
--echo #

create table t1 (a int);
let $1=800;
disable_query_log;
begin;
while ($1)
{
# eval means expand $ expressions
 eval insert into t1 values( $1 );
 dec $1;
}
enable_query_log;
drop table t1;
save_master_pos;
connection slave;
reset slave;

--echo #
--echo # Test 1
--echo #

set @my_max_binlog_size= @@global.max_binlog_size;
set global max_binlog_size=8192;
set global max_relay_log_size=8192-1; # mapped to 4096
select @@global.max_relay_log_size;
start slave;
sync_with_master;
--source include/check_slave_is_running.inc

--echo #
--echo # Test 2
--echo #

stop slave;
reset slave;
set global max_relay_log_size=(5*4096);
query_vertical select @@global.max_relay_log_size;
start slave;
sync_with_master;
--source include/check_slave_is_running.inc

--echo #
--echo # Test 3: max_relay_log_size = 0
--echo #

stop slave;
reset slave;
set global max_relay_log_size=0;
query_vertical select @@global.max_relay_log_size;
start slave;
sync_with_master;
--source include/check_slave_is_running.inc

--echo #
--echo # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
--echo #

stop slave;
reset slave;
# test of relay log rotation when the slave is stopped
# (to make sure it does not crash).
flush logs;

--echo #
--echo # Test 5
--echo #

reset slave;
start slave;
sync_with_master;
# test of relay log rotation when the slave is started
flush logs;
# We have now easy way to be sure that the SQL thread has now deleted the
# log we just closed. But a trick to achieve this is do an update on the master.
connection master;
create table t1 (a int);
--source include/sync_slave_sql_with_master.inc
--source include/check_slave_is_running.inc

--echo #
--echo # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
--echo #

flush logs;
connection master;
drop table t1;
--source include/sync_slave_sql_with_master.inc
--source include/check_slave_is_running.inc

connection master;
# test that the absence of relay logs does not make a master crash
flush logs;
source include/show_master_status.inc;

# Restore max_binlog_size
connection slave;
set global max_binlog_size= @my_max_binlog_size;

--echo #
--echo # End of 4.1 tests
--echo # 
--source include/rpl_end.inc