MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rpl_row_img_set.inc
1 #
2 # This is an auxiliar script that sets the binlog-row-image
3 # on a set of connections. These connections are passed as
4 # a parameter to this script. Its format is the following:
5 #
6 # <conid,value,Y_or_N>:[<conid,value,Y_or_N>:...]
7 #
8 # In detail:
9 #
10 # conid -- connection id (eg, master)
11 # value -- binlog_row_image value to set (eg, FULL)
12 # Y_or_N -- Issue stop and start slave (eg, Y)
13 #
14 # Sample usage:
15 #
16 # -- let $row_img_set=master:FULL:N,slave:MINIMAL:Y
17 # -- source include/rpl_row_img_set.inc
18 #
19 # Notes:
20 #
21 # 1. This script saves and restores the original connection that was
22 # in use at the time it was included.
23 
24 -- let $old_conn= $CURRENT_CONNECTION
25 
26 while (`SELECT HEX('$row_img_set') != HEX('')`)
27 {
28 
29  -- let $tuple= `SELECT SUBSTRING_INDEX('$row_img_set', ',', 1)`
30 
31  -- let $conn= `SELECT SUBSTRING_INDEX('$tuple', ':', 1)`
32  -- let $rimg= `SELECT SUBSTRING_INDEX(LTRIM(SUBSTRING('$tuple', LENGTH('$conn') + 2)), ':', 1)`
33 
34  -- let $is_slave_restart= `SELECT LTRIM(SUBSTRING('$tuple', LENGTH('$conn') + LENGTH('$rimg')+ 3))`
35 
36  -- echo CON: '$conn', IMG: '$rimg', RESTART SLAVE: '$is_slave_restart'
37 
38  -- connection $conn
39  -- eval SET SESSION binlog_row_image= '$rimg'
40  -- eval SET GLOBAL binlog_row_image= '$rimg'
41 
42  if ($is_slave_restart == Y)
43  {
44  -- source include/stop_slave.inc
45  -- source include/start_slave.inc
46  }
47 
48  FLUSH TABLES;
49  SHOW VARIABLES LIKE 'binlog_row_image';
50 
51  -- let $row_img_set= `SELECT LTRIM(SUBSTRING('$row_img_set', LENGTH('$tuple') + 2 ))`
52 
53 }
54 
55 -- connection $old_conn