3 # This file does the same as the built-in command sync_with_master,
4 # but more flexible. In particular:
5 # - Can use a custom timeout.
6 # - Can use WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS instead of MASTER_POS_WAIT.
7 # - The position can be set by the user, it is not restricted to
13 # --source include/save_master_pos.inc
15 # [--let $slave_timeout= X]
16 # [--let $use_gtids= 1]
17 # --source include/sync_slave.inc
21 # See wait_for_slave_param.inc
24 # If set, uses GTIDs instead of filename and offset for positions.
26 --let $include_filename= sync_slave_sql.inc
27 --source include/begin_include_file.inc
29 --let $_sss_slave_timeout= $slave_timeout
30 if (!$_sss_slave_timeout)
32 --let $_sss_slave_timeout= 300
37 --echo use_gtids=
'$use_gtids' _saved_gtids=
'$_saved_gtids' _saved_file=
'$_saved_file' _saved_pos=
'$_saved_pos' timeout=
'$_sss_slave_timeout'
44 --echo debug: WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS(
'$_saved_gtids', $_sss_slave_timeout)
46 --let $_sss_result= `SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS(
'$_saved_gtids', $_sss_slave_timeout)`
52 --echo debug: MASTER_POS_WAIT(
'$_saved_file', $_saved_pos, $_sss_slave_timeout)
54 --let $_sss_result= `SELECT MASTER_POS_WAIT(
'$_saved_file', $_saved_pos, $_sss_slave_timeout)`
57 if ($_sss_result ==
'')
59 --let $_sss_result = -2
60 --let $error_type= The slave SQL thread was not started, the slave
's master information was not initialized, the arguments were incorrect, or an error occurred.
62 if ($_sss_result == -1)
64 --let $error_type= Timeout after $slave_timeout seconds.
69 --source include/show_rpl_debug_info.inc
70 --echo ERROR: sync_slave_sql.inc failed on connection '$CURRENT_CONNECTION
'
71 --echo ERROR: use_gtids='$use_gtids
'
72 --echo ERROR: _saved_gtids='$_saved_gtids
'
73 --echo ERROR: _saved_file='$_saved_file
'
74 --echo ERROR: _saved_pos='$_saved_pos
'
75 --echo ERROR: timeout='$_sss_slave_timeout
'
76 --echo ERROR: result='$_sss_result
'
77 --echo ERROR: error type: $error_type
78 --die Error in sync_with_master.inc
81 --let $include_filename= sync_slave_sql.inc
82 --source include/end_include_file.inc