File: rpl_safe_slave.inc

package info (click to toggle)
mariadb-10.0 10.0.32-0%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 476,064 kB
  • sloc: cpp: 1,400,131; ansic: 832,140; perl: 54,391; sh: 41,304; pascal: 32,365; yacc: 14,921; xml: 5,257; sql: 4,667; cs: 4,647; makefile: 4,555; ruby: 4,465; python: 2,292; lex: 1,427; java: 941; asm: 295; awk: 54; php: 22; sed: 16
file content (109 lines) | stat: -rw-r--r-- 3,428 bytes parent folder | download | duplicates (4)
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
--connection server_1
--echo ### Create temp table on master
CREATE TEMPORARY TABLE t1 (a INT);

--let $sync_slave_connection= server_2
--source include/sync_slave_sql_with_master.inc

--echo ### Setup debug_sync points and prepare for slave backup
--connection slave_2
SET SESSION debug="+d,debug_sync_abort_on_timeout";

SHOW STATUS LIKE 'Slave_open_temp_tables';

SET DEBUG_SYNC= 'tokudb_backup_wait_for_safe_slave_entered SIGNAL sse WAIT_FOR sse_continue';
SET DEBUG_SYNC= 'tokudb_backup_wait_for_temp_tables_loop_begin SIGNAL ttlb WAIT_FOR ttlb_continue';
SET DEBUG_SYNC= 'tokudb_backup_wait_for_temp_tables_loop_slave_started SIGNAL ttlss WAIT_FOR ttlss_continue EXECUTE 2';
SET DEBUG_SYNC= 'tokudb_backup_wait_for_temp_tables_loop_end SIGNAL ttle WAIT_FOR ttle_continue';

--mkdir $BACKUP_DIR_SLAVE

--echo ### Turn-on safe-slave option
SET GLOBAL tokudb_backup_safe_slave=ON;
SET GLOBAL tokudb_backup_safe_slave_timeout=30;

--echo ### Start slave backup
--disable_query_log
--send_eval SET SESSION tokudb_backup_dir='$BACKUP_DIR_SLAVE'
--enable_query_log

--connection server_2
SET SESSION debug="+d,debug_sync_abort_on_timeout";

--echo ### Wait for safe slave function to start
SET DEBUG_SYNC = "now WAIT_FOR sse";
SHOW STATUS LIKE 'Slave_open_temp_tables';
--echo ### Wait for safe slave loop start
SET DEBUG_SYNC = "now SIGNAL sse_continue WAIT_FOR ttlb";
SHOW STATUS LIKE 'Slave_open_temp_tables';
--echo ### Wait for safe thread loop point just after slave sql thread start 1
SET DEBUG_SYNC = "now SIGNAL ttlb_continue WAIT_FOR ttlss";
SHOW STATUS LIKE 'Slave_open_temp_tables';
--echo ### Wait for safe thread loop end
SET DEBUG_SYNC = "now SIGNAL ttlss_continue WAIT_FOR ttle";
SHOW STATUS LIKE 'Slave_open_temp_tables';

--echo ### Wait for safe thread loop point just after slave sql thread start 2
SET DEBUG_SYNC = "now SIGNAL ttle_continue WAIT_FOR ttlss";

--connection server_1
--echo ### Drop temp table on master
DROP TABLE t1;

--echo ### and syncronize slave
--let $sync_slave_connection= server_2
--source include/sync_slave_sql_with_master.inc

SHOW STATUS LIKE 'Slave_open_temp_tables';

--echo ### Continue backup
SET DEBUG_SYNC = "now SIGNAL ttlss_continue";

--connection slave_2
--echo ### Wait for backup finish
--reap

--let $input_file = $S_SLAVE_INFO_FILE_PATH
--source include/filter_file.inc
--echo ### Slave $SLAVE_INFO_FILE content:
--cat_file $S_SLAVE_INFO_FILE_PATH

--echo ### Delete slave backup dir
--perl
use File::Path 'rmtree';
$DDIR=$ENV{"BACKUP_DIR_SLAVE"};
rmtree([ "$DDIR" ]);
EOF

--echo ### Turn-off safe-slave option for slave
SET GLOBAL tokudb_backup_safe_slave=default;
SET GLOBAL tokudb_backup_safe_slave_timeout=default;

--connection server_1

--echo ### Turn-on safe-slave option for master
SET GLOBAL tokudb_backup_safe_slave=ON;
SET GLOBAL tokudb_backup_safe_slave_timeout=30;

--echo ### Backup master
--mkdir $BACKUP_DIR_MASTER
--disable_query_log
--eval SET SESSION tokudb_backup_dir='$BACKUP_DIR_MASTER'
--enable_query_log

--echo ### Turn-off safe-slave option for master
SET GLOBAL tokudb_backup_safe_slave=default;
SET GLOBAL tokudb_backup_safe_slave_timeout=default;

--let $input_file = $M_MASTER_INFO_FILE_PATH
--source include/filter_file.inc
--echo ### Master $MASTER_INFO_FILE content:
--cat_file $M_MASTER_INFO_FILE_PATH

--echo ### Delete master backup dir
--perl
use File::Path 'rmtree';
$DDIR=$ENV{"BACKUP_DIR_MASTER"};
rmtree([ "$DDIR" ]);
EOF