Debian Codegraph @

mysql-test/suite/rpl/include/create_or_drop_sync_func.inc

raw
1 # Creates or drops a stored function as a part of debug-sync based
2 # synchronization mechanism between replication servers.
3 #
4 # Parameters:
5 # $create_or_drop= [create]
6 # $server_master = [master]
7 # $server_slave = [slave]
8 if (!$create_or_drop)
9 {
10 --let $create_or_drop=create
11 }
12
13 if (`select strcmp('$create_or_drop', 'create') = 0`)
14 {
15 if (!$server_master)
16 {
17 --let $server_master=master
18 }
19 if (!$server_slave)
20 {
21 --let $server_slave=slave
22 }
23
24 --connection $server_master
25 # Use a stored function to inject a debug_sync into the appropriate THD.
26 # The function does nothing on the master, and on the slave it injects the
27 # desired debug_sync action(s).
28 SET sql_log_bin=0;
29 --delimiter ||
30 CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
31 RETURNS INT DETERMINISTIC
32 BEGIN
33 RETURN x;
34 END
35 ||
36 --delimiter ;
37 SET sql_log_bin=1;
38
39 --connection $server_slave
40
41 SET sql_log_bin=0;
42 --delimiter ||
43 CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
44 RETURNS INT DETERMINISTIC
45 BEGIN
46 IF d1 != '' THEN
47 SET debug_sync = d1;
48 END IF;
49 IF d2 != '' THEN
50 SET debug_sync = d2;
51 END IF;
52 RETURN x;
53 END
54 ||
55 --delimiter ;
56 SET sql_log_bin=1;
57 }
58
59 if (`select strcmp('$create_or_drop', 'drop') = 0`)
60 {
61 if (!$server_slave)
62 {
63 --let $server_slave=slave=
64 }
65 if (!$server_master)
66 {
67 --let $server_master=master
68 }
69 --connection $server_slave
70 SET DEBUG_SYNC='RESET';
71
72 --connection $server_master
73 SET DEBUG_SYNC='RESET';
74 DROP FUNCTION foo;
75 }