|
4 | 4 | # point: pause, execute another statement on another connection, and
|
5 | 5 | # unpause.
|
6 | 6 | #
|
| 7 | +# See also: execute_to_sync_point.inc, execute_from_sync_point.inc |
| 8 | +# |
7 | 9 | # ==== Usage ====
|
8 | 10 | #
|
9 |
| -# [--let $main_connection= CONNECTION_NAME] |
10 |
| -# --let $main_statement= STATEMENT |
11 |
| -# --let $middle_connection= CONNECTION_NAME |
12 |
| -# --let $middle_statement= STATEMENT |
| 11 | +# --let $statement_connection= CONNECTION_NAME |
| 12 | +# --let $statement= STATEMENT |
| 13 | +# --let $other_statement= STATEMENT |
13 | 14 | # --let $sync_point= SYNC_POINT_NAME
|
| 15 | +# [--let $auxiliary_connection= CONNECTION_NAME] |
14 | 16 | # [--let $quiet= [0|1|2]]
|
15 | 17 | # [--let $sync_point_timeout= N]
|
16 | 18 | # --source include/execute_statement_at_sync_point.inc
|
17 | 19 | #
|
18 | 20 | # Parameters:
|
19 | 21 | #
|
20 |
| -# $main_connection |
21 |
| -# The connection on which the "main" statement is to be executed. |
22 |
| -# If this is not specified, uses the current connection. |
| 22 | +# $statement_connection |
| 23 | +# The connection on which $statement is to be executed. |
| 24 | +# This must be different from $auxiliary_connection. |
23 | 25 | #
|
24 |
| -# $main_statement |
| 26 | +# $statement |
25 | 27 | # The statement that will be paused on the sync point.
|
26 | 28 | #
|
27 |
| -# $middle_connection |
28 |
| -# The connection on which the "interluding" statement is to be |
29 |
| -# executed while the main statement is paused on the sync point. |
30 |
| -# |
31 |
| -# $middle_statement |
32 |
| -# The statement that will be executed on $middle_connection while |
33 |
| -# $main_statement is paused on the sync point. |
| 29 | +# $auxiliary_statement |
| 30 | +# The statement that will be executed on the current connection while |
| 31 | +# $statement is paused on the sync point. |
34 | 32 | #
|
35 | 33 | # $sync_point
|
36 | 34 | # The name of the sync point (not quoted).
|
37 | 35 | #
|
| 36 | +# $auxiliary_connection |
| 37 | +# By default, $auxiliary_statement, as well as some SET DEBUG |
| 38 | +# statements, are executed on the current connection. If this |
| 39 | +# variable is not empty, uses $auxiliary_connection instead. |
| 40 | +# |
38 | 41 | # $quiet
|
39 | 42 | # By default (or if $quiet==0), the following is echoed to the log:
|
40 |
| -# START $main_statement; |
41 |
| -# $middle_statement; |
42 |
| -# END $main_statement; |
| 43 | +# START $statement; |
| 44 | +# $other_statement; |
| 45 | +# result of other statement |
| 46 | +# END $statement; |
43 | 47 | # If you set $quiet=1, the START and END lines are still there,
|
44 |
| -# but from the middle statement only the result is echoed. |
| 48 | +# but from the other statement only the result is echoed. |
45 | 49 | # If you set $quiet=2, all output is suppressed.
|
46 | 50 | #
|
47 | 51 | # $sync_point_timeout
|
48 |
| -# Both the main connection and the middle connection will be |
49 |
| -# waiting for a signal. By default, the wait has a timeout |
| 52 | +# Both the $statement_connection and the current connection will |
| 53 | +# be waiting for a signal. By default, the wait has a timeout |
50 | 54 | # specified by --debug-sync-timeout=N. You can set
|
51 | 55 | # $sync_point_timeout to use a different timeout. The unit is
|
52 | 56 | # seconds.
|
| 57 | +# |
| 58 | +# $skip_reap |
| 59 | +# By default, the script will wait for $statement to ACK to the |
| 60 | +# client (reap). Set $skip_reap to prevent that from happening. |
| 61 | +# The caller then has the execute reap manually. |
53 | 62 |
|
54 |
| ---let $_easp_query_log_enabled= $ENABLED_QUERY_LOG |
55 |
| ---disable_query_log |
| 63 | +--let $include_silent= 1 |
| 64 | +--let $include_filename= execute_at_sync_point.inc |
| 65 | +--source include/begin_include_file.inc |
| 66 | +--let $include_silent= 0 |
56 | 67 |
|
57 |
| -# Configure. |
58 |
| ---let $_easp_previous_connection = $CURRENT_CONNECTION |
59 | 68 |
|
60 |
| ---let $_easp_main_connection= $main_connection |
61 |
| -if ($main_connection == '') |
62 |
| -{ |
63 |
| - --let $_easp_main_connection= $CURRENT_CONNECTION |
64 |
| -} |
| 69 | +--source include/execute_to_sync_point.inc |
65 | 70 |
|
66 |
| ---let $_easp_timeout= |
67 |
| -if ($sync_point_timeout) |
| 71 | +# execute other statement |
| 72 | +if (!$quiet) |
68 | 73 | {
|
69 |
| - --let $_easp_timeout= TIMEOUT $sync_point_timeout |
| 74 | + --echo $other_statement |
70 | 75 | }
|
71 |
| - |
72 |
| ---let $_easp_quiet= $quiet |
73 |
| -if ($quiet == '') |
74 |
| -{ |
75 |
| - --let $_easp_quiet= 0 |
76 |
| -} |
77 |
| - |
78 |
| -# Begin waiting for signal on middle connection. |
79 |
| ---connection $middle_connection |
80 |
| ---send |
81 |
| -eval SET @@SESSION.DEBUG_SYNC = 'now WAIT_FOR _easp_parked $_easp_timeout'; |
82 |
| - |
83 |
| -# Setup sync point and begin execute main statement. |
84 |
| ---connection $_easp_main_connection |
85 |
| -eval SET @@SESSION.DEBUG_SYNC = '$sync_point SIGNAL _easp_parked WAIT_FOR _easp_go $_easp_timeout'; |
86 |
| - |
87 |
| -if ($_easp_quiet < 2) |
| 76 | +--connection $_esp_auxiliary_connection |
| 77 | +--let $result= `$other_statement` |
| 78 | +if ($quiet != 2) |
88 | 79 | {
|
89 |
| - --echo [START] $main_statement; |
| 80 | + --echo $result |
90 | 81 | }
|
91 |
| ---send |
92 |
| -eval $main_statement; |
93 | 82 |
|
94 |
| -# Finish waiting for signal on middle connection, execute middle |
95 |
| -# statement, tell main statement to continue. |
96 |
| ---connection $middle_connection |
97 |
| -reap; |
98 |
| -if ($_easp_quiet == 0) |
99 |
| -{ |
100 |
| - --echo $middle_statement; |
101 |
| -} |
102 |
| -if ($_easp_quiet == 1) |
103 |
| -{ |
104 |
| - --let $_easp_result= `$middle_statement` |
105 |
| - --echo $_easp_result |
106 |
| -} |
107 |
| -if ($_easp_quiet != 1) |
108 |
| -{ |
109 |
| - eval $middle_statement; |
110 |
| -} |
111 |
| -SET @@SESSION.DEBUG_SYNC = 'now SIGNAL _easp_go'; |
| 83 | +--source include/execute_from_sync_point.inc |
112 | 84 |
|
113 |
| -# Wait for main statement to finish. |
114 |
| -if ($_easp_quiet < 2) |
115 |
| -{ |
116 |
| - --echo [END] $main_statement; |
117 |
| -} |
118 |
| ---connection $_easp_main_connection |
119 |
| -reap; |
120 | 85 |
|
121 |
| -# Restore state |
122 |
| ---connection $_easp_previous_connection |
123 |
| -if ($_easp_query_log_enabled) |
124 |
| -{ |
125 |
| - --enable_query_log |
126 |
| -} |
| 86 | +--let $include_filename= execute_at_sync_point.inc |
| 87 | +--source include/end_include_file.inc |
0 commit comments