1# ==== Purpose ====
2#
3# Finish a sync-point wait that was previously started by
4# execute_to_sync_point.inc
5#
6# See also: execute_to_sync_point.inc, execute_at_sync_point.inc
7#
8# ==== Usage ====
9#
10# --let $statement_connection= CONNECTION_NAME
11# --let $statement= STATEMENT
12# --let $sync_point= SYNC_POINT_NAME
13# [--let $auxiliary_connection= CONNECTION_NAME]
14# [--let $quiet= [0|2]]
15# --source include/execute_from_sync_point.inc
16#
17# Parameters:
18#   See execute_at_sync_point.inc
19
20
21--let $include_silent= 1
22--let $include_filename= execute_from_sync_point.inc
23--source include/begin_include_file.inc
24--let $include_silent= 0
25
26# Sanity check.
27if ($statement_connection == '')
28{
29  --die !!!ERROR IN TEST: set $statement_connection
30}
31--let $_esp_auxiliary_connection= $CURRENT_CONNECTION
32if ($auxiliary_connection != '')
33{
34  --let $_esp_auxiliary_connection= $auxiliary_connection
35}
36if ($statement_connection == $_esp_auxiliary_connection)
37{
38  --die !!!ERROR IN TEST: set $statement_connection to something else than $auxiliary_connection
39}
40if ($statement == '')
41{
42  --die !!!ERROR IN TEST: set $statement
43}
44if ($sync_point == '')
45{
46  --die !!!ERROR IN TEST: set $sync_point
47}
48
49if (!$rpl_debug)
50{
51  --disable_query_log
52}
53if ($rpl_debug)
54{
55  --echo statement_connection=$statement_connection auxiliary_connection=$auxiliary_connection statement=$statement sync_point=$sync_point
56}
57
58# Tell statement to continue on auxiliary connection.
59--let $rpl_connection_name= $_esp_auxiliary_connection
60--source include/rpl_connection.inc
61eval SET @@SESSION.DEBUG_SYNC = 'now SIGNAL _esp_go_$sync_point$underscore$statement_connection';
62
63# Wait for statement to finish.
64--let $rpl_connection_name= $statement_connection
65--source include/rpl_connection.inc
66if ($_esp_quiet != 2)
67{
68  --echo [END] $statement;
69}
70if (!$skip_reap)
71{
72  reap;
73}
74--let $rpl_connection_name= $_esp_auxiliary_connection
75--source include/rpl_connection.inc
76
77--let $include_filename= execute_from_sync_point.inc
78--source include/end_include_file.inc
79