blob: 3aabe80e67303d00295cae64295d8d776c97cad6 (
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
-- These procedures belong to the mysql DB, e. g.
-- CALL mysql.resetSlave('foo');
-- Keep it simple: each procedure should be self-contained.
DELIMITER $$
DROP PROCEDURE IF EXISTS stopSlave $$
CREATE PROCEDURE stopSlave (IN ch VARCHAR(64))
COMMENT 'Stops slave channel (both I/O and SQL threads)'
BEGIN
-- Ignore ERROR 1617 (HY000): There is no master connection 'foo'
DECLARE EXIT HANDLER FOR 1617
BEGIN
SELECT 'No such master connection'
AS warning;
END;
SET default_master_connection = ch;
STOP SLAVE;
END $$
DROP PROCEDURE IF EXISTS startSlave $$
CREATE PROCEDURE startSlave (IN ch VARCHAR(64))
COMMENT 'Starts slave channel (both I/O and SQL threads)'
BEGIN
DECLARE EXIT HANDLER FOR 1617
BEGIN
SELECT 'No such master connection'
AS warning;
END;
SET default_master_connection = ch;
START SLAVE;
END $$
DROP PROCEDURE IF EXISTS kickSlave $$
CREATE PROCEDURE kickSlave (IN ch VARCHAR(64))
COMMENT 'Skips the next event from the master'
BEGIN
DECLARE EXIT HANDLER FOR 1617
BEGIN
SELECT 'No such master connection'
AS warning;
END;
SET default_master_connection = ch;
STOP SLAVE;
SET GLOBAL sql_slave_skip_counter = 1;
START SLAVE;
END $$
DROP PROCEDURE IF EXISTS pauseSlave $$
CREATE PROCEDURE pauseSlave (IN ch VARCHAR(64))
COMMENT 'Stops SQL thread of the slave channel'
BEGIN
DECLARE EXIT HANDLER FOR 1617
BEGIN
SELECT 'No such master connection'
AS warning;
END;
SET default_master_connection = ch;
STOP SLAVE SQL_THREAD;
END $$
DROP PROCEDURE IF EXISTS resetSlave $$
CREATE PROCEDURE resetSlave (IN ch VARCHAR(64))
COMMENT 'Stops and deletes slave channel'
BEGIN
DECLARE EXIT HANDLER FOR 1617
BEGIN
SELECT 'No such master connection'
AS warning;
END;
SET default_master_connection = ch;
STOP SLAVE;
RESET SLAVE ALL;
END $$
DROP PROCEDURE IF EXISTS stopAllSlaves $$
CREATE PROCEDURE stopAllSlaves ()
COMMENT 'Stops all slaves'
BEGIN
STOP ALL SLAVES;
END $$
DROP PROCEDURE IF EXISTS pauseAllSlaves $$
CREATE PROCEDURE pauseAllSlaves ()
COMMENT 'Stops SQL thread of all slaves'
BEGIN
STOP ALL SLAVES SQL_THREAD;
END $$
DROP PROCEDURE IF EXISTS startAllSlaves $$
CREATE PROCEDURE startAllSlaves ()
COMMENT 'Starts all slaves'
BEGIN
START ALL SLAVES;
END $$
DROP PROCEDURE IF EXISTS enableGeneralLog $$
CREATE PROCEDURE enableGeneralLog ()
BEGIN
SET GLOBAL general_log = ON;
END $$
DROP PROCEDURE IF EXISTS disableGeneralLog $$
CREATE PROCEDURE disableGeneralLog ()
BEGIN
SET GLOBAL general_log = OFF;
END $$
DROP PROCEDURE IF EXISTS truncateGeneralLog $$
CREATE PROCEDURE truncateGeneralLog ()
BEGIN
TRUNCATE mysql.general_log;
END $$
DROP PROCEDURE IF EXISTS truncateSlowLog $$
CREATE PROCEDURE truncateSlowLog ()
BEGIN
TRUNCATE mysql.slow_log;
END $$
DROP PROCEDURE IF EXISTS showEvents $$
CREATE PROCEDURE showEvents ()
COMMENT 'Shows all events for the mysql schema'
BEGIN
SHOW EVENTS IN mysql;
END $$
DELIMITER ;
|