MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ndb_setup_slave.inc
1 #
2 # now setup replication to continue from last epoch
3 # 1. get ndb_apply_status epoch from slave
4 # 2. get corresponding _next_ binlog postition from master
5 # 3. change master on slave
6 
7 # 1.
8 
9 --connection slave
10 --replace_column 1 <the_epoch>
11 SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
12 --let $the_epoch= `select @the_epoch`
13 
14 # 2.
15 --connection master
16 --replace_result $the_epoch <the_epoch>
17 --replace_column 1 <the_pos>
18 --disable_query_log
19 eval SELECT @the_pos:=Position,
20  @the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\\\','/'), '/', -1)
21  FROM mysql.ndb_binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1;
22 --enable_query_log
23 --let $the_pos= `SELECT @the_pos`
24 --let $the_file= `SELECT @the_file`
25 
26 # 3.
27 --connection slave
28 --replace_result $the_pos <the_pos>
29 eval CHANGE MASTER TO
30  master_log_file = '$the_file',
31  master_log_pos = $the_pos ;