Merge lp:~akopytov/percona-xtrabackup/bug1411157 into lp:percona-xtrabackup/2.3
- bug1411157
- Merge into 2.3
Proposed by
Alexey Kopytov
Status: | Merged |
---|---|
Approved by: | Alexey Kopytov |
Approved revision: | no longer in the source branch. |
Merged at revision: | 5063 |
Proposed branch: | lp:~akopytov/percona-xtrabackup/bug1411157 |
Merge into: | lp:percona-xtrabackup/2.3 |
Diff against target: |
211 lines (+47/-47) 4 files modified
storage/innobase/xtrabackup/doc/source/innobackupex/improved_ftwrl.rst (+11/-11) storage/innobase/xtrabackup/doc/source/innobackupex/innobackupex_option_reference.rst (+6/-6) storage/innobase/xtrabackup/innobackupex.pl (+21/-21) storage/innobase/xtrabackup/test/t/kill_long_selects.sh (+9/-9) |
To merge this branch: | bzr merge lp:~akopytov/percona-xtrabackup/bug1411157 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexey Kopytov (community) | Approve | ||
Review via email: mp+246760@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'storage/innobase/xtrabackup/doc/source/innobackupex/improved_ftwrl.rst' | |||
2 | --- storage/innobase/xtrabackup/doc/source/innobackupex/improved_ftwrl.rst 2014-12-18 12:48:27 +0000 | |||
3 | +++ storage/innobase/xtrabackup/doc/source/innobackupex/improved_ftwrl.rst 2015-01-16 18:10:24 +0000 | |||
4 | @@ -14,11 +14,11 @@ | |||
5 | 14 | Waiting for queries to finish | 14 | Waiting for queries to finish |
6 | 15 | ----------------------------- | 15 | ----------------------------- |
7 | 16 | 16 | ||
13 | 17 | Good moment to issue a global lock is the moment when there are no long queries running. But waiting for a good moment to issue the global lock for extended period of time isn't always good approach, as it can extend the time needed for backup to take place. To prevent |innobackupex| from waiting to issue ``FLUSH TABLES WITH READ LOCK`` for too long, new option has been implemented: :option:`innobackupex --lock-wait-timeout` option can be used to limit the waiting time. If the good moment to issue the lock did not happen during this time, |innobackupex| will give up and exit with an error message and backup will not be taken. Zero value for this option turns off the feature (which is default). | 17 | Good moment to issue a global lock is the moment when there are no long queries running. But waiting for a good moment to issue the global lock for extended period of time isn't always good approach, as it can extend the time needed for backup to take place. To prevent |innobackupex| from waiting to issue ``FLUSH TABLES WITH READ LOCK`` for too long, new option has been implemented: :option:`innobackupex --ftwrl-wait-timeout` option can be used to limit the waiting time. If the good moment to issue the lock did not happen during this time, |innobackupex| will give up and exit with an error message and backup will not be taken. Zero value for this option turns off the feature (which is default). |
14 | 18 | 18 | ||
15 | 19 | Another possibility is to specify the type of query to wait on. In this case :option:`innobackupex --lock-wait-query-type`. Possible values are ``all`` and ``update``. When ``all`` is used |innobackupex| will wait for all long running queries (execution time longer than allowed by :option:`innobackupex --lock-wait-threshold`) to finish before running the ``FLUSH TABLES WITH READ LOCK``. When ``update`` is used |innobackupex| will wait on ``UPDATE/ALTER/REPLACE/INSERT`` queries to finish. | 19 | Another possibility is to specify the type of query to wait on. In this case :option:`innobackupex --ftwrl-wait-query-type`. Possible values are ``all`` and ``update``. When ``all`` is used |innobackupex| will wait for all long running queries (execution time longer than allowed by :option:`innobackupex --ftwrl-wait-threshold`) to finish before running the ``FLUSH TABLES WITH READ LOCK``. When ``update`` is used |innobackupex| will wait on ``UPDATE/ALTER/REPLACE/INSERT`` queries to finish. |
16 | 20 | 20 | ||
17 | 21 | Although time needed for specific query to complete is hard to predict, we can assume that queries that are running for a long time already will likely not be completed soon, and queries which are running for a short time will likely be completed shortly. |innobackupex| can use the value of :option:`innobackupex --lock-wait-threshold` option to specify which query is long running and will likely block global lock for a while. In order to use this option xtrabackup user should have ``PROCESS`` and ``SUPER`` privileges. | 21 | Although time needed for specific query to complete is hard to predict, we can assume that queries that are running for a long time already will likely not be completed soon, and queries which are running for a short time will likely be completed shortly. |innobackupex| can use the value of :option:`innobackupex --ftwrl-wait-threshold` option to specify which query is long running and will likely block global lock for a while. In order to use this option xtrabackup user should have ``PROCESS`` and ``SUPER`` privileges. |
18 | 22 | 22 | ||
19 | 23 | Killing the blocking queries | 23 | Killing the blocking queries |
20 | 24 | ---------------------------- | 24 | ---------------------------- |
21 | @@ -30,11 +30,11 @@ | |||
22 | 30 | Options summary | 30 | Options summary |
23 | 31 | --------------- | 31 | --------------- |
24 | 32 | 32 | ||
30 | 33 | * :option:`--lock-wait-timeout=N` (seconds) - how long to wait for a good moment. Default is 0, not to wait. | 33 | * :option:`--ftwrl-wait-timeout=N` (seconds) - how long to wait for a good moment. Default is 0, not to wait. |
31 | 34 | 34 | ||
32 | 35 | * :option:`--lock-wait-query-type={all|update}` - which long queries should be finished before ``FLUSH TABLES WITH READ LOCK`` is run. Default is all. | 35 | * :option:`--ftwrl-wait-query-type={all|update}` - which long queries should be finished before ``FLUSH TABLES WITH READ LOCK`` is run. Default is all. |
33 | 36 | 36 | ||
34 | 37 | * :option:`--lock-wait-threshold=N` (seconds) - how long query should be running before we consider it long running and potential blocker of global lock. | 37 | * :option:`--ftwrl-wait-threshold=N` (seconds) - how long query should be running before we consider it long running and potential blocker of global lock. |
35 | 38 | 38 | ||
36 | 39 | * :option:`--kill-long-queries-timeout=N` (seconds) - how many time we give for queries to complete after ``FLUSH TABLES WITH READ LOCK`` is issued before start to kill. Default if ``0``, not to kill. | 39 | * :option:`--kill-long-queries-timeout=N` (seconds) - how many time we give for queries to complete after ``FLUSH TABLES WITH READ LOCK`` is issued before start to kill. Default if ``0``, not to kill. |
37 | 40 | 40 | ||
38 | @@ -45,7 +45,7 @@ | |||
39 | 45 | 45 | ||
40 | 46 | Running the |innobackupex| with the following options: :: | 46 | Running the |innobackupex| with the following options: :: |
41 | 47 | 47 | ||
43 | 48 | $ innobackupex --lock-wait-threshold=40 --lock-wait-query-type=all --lock-wait-timeout=180 --kill-long-queries-timeout=20 --kill-long-query-type=all /data/backups/ | 48 | $ innobackupex --ftwrl-wait-threshold=40 --ftwrl-wait-query-type=all --ftwrl-wait-timeout=180 --kill-long-queries-timeout=20 --kill-long-query-type=all /data/backups/ |
44 | 49 | 49 | ||
45 | 50 | will cause |innobackupex| to spend no longer than 3 minutes waiting for all queries older than 40 seconds to complete. After ``FLUSH TABLES WITH READ LOCK`` is issued, |innobackupex| will wait 20 seconds for lock to be acquired. If lock is still not acquired after 20 seconds, it will kill all queries which are running longer that the ``FLUSH TABLES WITH READ LOCK``. | 50 | will cause |innobackupex| to spend no longer than 3 minutes waiting for all queries older than 40 seconds to complete. After ``FLUSH TABLES WITH READ LOCK`` is issued, |innobackupex| will wait 20 seconds for lock to be acquired. If lock is still not acquired after 20 seconds, it will kill all queries which are running longer that the ``FLUSH TABLES WITH READ LOCK``. |
46 | 51 | 51 | ||
47 | 52 | 52 | ||
48 | === modified file 'storage/innobase/xtrabackup/doc/source/innobackupex/innobackupex_option_reference.rst' | |||
49 | --- storage/innobase/xtrabackup/doc/source/innobackupex/innobackupex_option_reference.rst 2014-12-18 10:39:15 +0000 | |||
50 | +++ storage/innobase/xtrabackup/doc/source/innobackupex/innobackupex_option_reference.rst 2015-01-16 18:10:24 +0000 | |||
51 | @@ -150,15 +150,15 @@ | |||
52 | 150 | 150 | ||
53 | 151 | This option specifies which types of queries should be killed to unblock the global lock. Default is "all". | 151 | This option specifies which types of queries should be killed to unblock the global lock. Default is "all". |
54 | 152 | 152 | ||
56 | 153 | .. option:: --lock-wait-timeout=SECONDS | 153 | .. option:: --ftwrl-wait-timeout=SECONDS |
57 | 154 | 154 | ||
58 | 155 | This option specifies time in seconds that innobackupex should wait for queries that would block ``FLUSH TABLES WITH READ LOCK`` before running it. If there are still such queries when the timeout expires, innobackupex terminates with an error. Default is 0, in which case innobackupex does not wait for queries to complete and starts ``FLUSH TABLES WITH READ LOCK`` immediately. | 155 | This option specifies time in seconds that innobackupex should wait for queries that would block ``FLUSH TABLES WITH READ LOCK`` before running it. If there are still such queries when the timeout expires, innobackupex terminates with an error. Default is 0, in which case innobackupex does not wait for queries to complete and starts ``FLUSH TABLES WITH READ LOCK`` immediately. |
59 | 156 | 156 | ||
65 | 157 | .. option:: --lock-wait-threshold=SECONDS | 157 | .. option:: --ftwrl-wait-threshold=SECONDS |
66 | 158 | 158 | ||
67 | 159 | This option specifies the query run time threshold which is used by innobackupex to detect long-running queries with a non-zero value of :option:`innobackupex --lock-wait-timeout`. FLUSH TABLES WITH READ LOCK`` is not started until such long-running queries exist. This option has no effect if --lock-wait-timeout is 0. Default value is 60 seconds. | 159 | This option specifies the query run time threshold which is used by innobackupex to detect long-running queries with a non-zero value of :option:`innobackupex --ftwrl-wait-timeout`. FLUSH TABLES WITH READ LOCK`` is not started until such long-running queries exist. This option has no effect if --ftwrl-wait-timeout is 0. Default value is 60 seconds. |
68 | 160 | 160 | ||
69 | 161 | .. option:: --lock-wait-query-type=all|update | 161 | .. option:: --ftwrl-wait-query-type=all|update |
70 | 162 | 162 | ||
71 | 163 | This option specifies which types of queries are allowed to complete before innobackupex will issue the global lock. Default is all. | 163 | This option specifies which types of queries are allowed to complete before innobackupex will issue the global lock. Default is all. |
72 | 164 | 164 | ||
73 | 165 | 165 | ||
74 | === modified file 'storage/innobase/xtrabackup/innobackupex.pl' | |||
75 | --- storage/innobase/xtrabackup/innobackupex.pl 2014-12-08 06:52:10 +0000 | |||
76 | +++ storage/innobase/xtrabackup/innobackupex.pl 2015-01-16 18:10:24 +0000 | |||
77 | @@ -229,14 +229,14 @@ | |||
78 | 229 | my $option_kill_long_queries_timeout = 0; | 229 | my $option_kill_long_queries_timeout = 0; |
79 | 230 | 230 | ||
80 | 231 | # waiting for an appropriate time to start FTWRL timeout | 231 | # waiting for an appropriate time to start FTWRL timeout |
82 | 232 | my $option_lock_wait_timeout = 0; | 232 | my $option_ftwrl_wait_timeout = 0; |
83 | 233 | 233 | ||
84 | 234 | # how old should be query to be waited for | 234 | # how old should be query to be waited for |
86 | 235 | my $option_lock_wait_threshold = 60; | 235 | my $option_ftwrl_wait_threshold = 60; |
87 | 236 | 236 | ||
88 | 237 | # which type of queries we are waiting for during the pre-FTWRL phase | 237 | # which type of queries we are waiting for during the pre-FTWRL phase |
89 | 238 | # possible values are "update" and "all" | 238 | # possible values are "update" and "all" |
91 | 239 | my $option_lock_wait_query_type = "all"; | 239 | my $option_ftwrl_wait_query_type = "all"; |
92 | 240 | 240 | ||
93 | 241 | # which type of queries wa are waiting when clearing the way for FTWRL | 241 | # which type of queries wa are waiting when clearing the way for FTWRL |
94 | 242 | # by killing; possible values are "select" and "all" | 242 | # by killing; possible values are "select" and "all" |
95 | @@ -3342,7 +3342,7 @@ | |||
96 | 3342 | while (my ($id, $process) = each %$processlist) { | 3342 | while (my ($id, $process) = each %$processlist) { |
97 | 3343 | if (defined($process->{Info}) && | 3343 | if (defined($process->{Info}) && |
98 | 3344 | $process->{Time} >= $threshold && | 3344 | $process->{Time} >= $threshold && |
100 | 3345 | (($option_lock_wait_query_type eq "all" && | 3345 | (($option_ftwrl_wait_query_type eq "all" && |
101 | 3346 | is_query($process->{Info})) || | 3346 | is_query($process->{Info})) || |
102 | 3347 | is_update_query($process->{Info}))) { | 3347 | is_update_query($process->{Info}))) { |
103 | 3348 | print STDERR "\n$now $prefix Waiting for query $id (duration " . | 3348 | print STDERR "\n$now $prefix Waiting for query $id (duration " . |
104 | @@ -3456,9 +3456,9 @@ | |||
105 | 3456 | return; | 3456 | return; |
106 | 3457 | } | 3457 | } |
107 | 3458 | 3458 | ||
111 | 3459 | if ($option_lock_wait_timeout) { | 3459 | if ($option_ftwrl_wait_timeout) { |
112 | 3460 | wait_for_no_updates($con, $option_lock_wait_timeout, | 3460 | wait_for_no_updates($con, $option_ftwrl_wait_timeout, |
113 | 3461 | $option_lock_wait_threshold); | 3461 | $option_ftwrl_wait_threshold); |
114 | 3462 | } | 3462 | } |
115 | 3463 | 3463 | ||
116 | 3464 | $now = current_time(); | 3464 | $now = current_time(); |
117 | @@ -3831,10 +3831,10 @@ | |||
118 | 3831 | \$option_kill_long_queries_timeout, | 3831 | \$option_kill_long_queries_timeout, |
119 | 3832 | 'kill-long-query-type=s' => | 3832 | 'kill-long-query-type=s' => |
120 | 3833 | \$option_kill_long_query_type, | 3833 | \$option_kill_long_query_type, |
125 | 3834 | 'lock-wait-timeout=i' => \$option_lock_wait_timeout, | 3834 | 'ftwrl-wait-timeout=i' => \$option_ftwrl_wait_timeout, |
126 | 3835 | 'lock-wait-threshold=i' => \$option_lock_wait_threshold, | 3835 | 'ftwrl-wait-threshold=i' => \$option_ftwrl_wait_threshold, |
127 | 3836 | 'lock-wait-query-type=s' => | 3836 | 'ftwrl-wait-query-type=s' => |
128 | 3837 | \$option_lock_wait_query_type, | 3837 | \$option_ftwrl_wait_query_type, |
129 | 3838 | 'version-check!' => \$option_version_check, | 3838 | 'version-check!' => \$option_version_check, |
130 | 3839 | 'force-non-empty-directories' => | 3839 | 'force-non-empty-directories' => |
131 | 3840 | \$option_force_non_empty_dirs | 3840 | \$option_force_non_empty_dirs |
132 | @@ -3902,10 +3902,10 @@ | |||
133 | 3902 | $option_compress = 0; | 3902 | $option_compress = 0; |
134 | 3903 | } | 3903 | } |
135 | 3904 | 3904 | ||
140 | 3905 | # validate lock-wait-query-type and kill-long-query-type values | 3905 | # validate ftwrl-wait-query-type and kill-long-query-type values |
141 | 3906 | if (!(grep {$_ eq $option_lock_wait_query_type} qw/all update/)) { | 3906 | if (!(grep {$_ eq $option_ftwrl_wait_query_type} qw/all update/)) { |
142 | 3907 | die "Wrong value of lock-wait-query-type. ". | 3907 | die "Wrong value of ftwrl-wait-query-type. ". |
143 | 3908 | "Possible values are all|update, but $option_lock_wait_query_type ". | 3908 | "Possible values are all|update, but $option_ftwrl_wait_query_type ". |
144 | 3909 | "is specified."; | 3909 | "is specified."; |
145 | 3910 | } | 3910 | } |
146 | 3911 | if (!(grep {$_ eq $option_kill_long_query_type} qw/all select/)) { | 3911 | if (!(grep {$_ eq $option_kill_long_query_type} qw/all select/)) { |
147 | @@ -5507,16 +5507,16 @@ | |||
148 | 5507 | 5507 | ||
149 | 5508 | This option specifies which types of queries should be killed to unblock the global lock. Default is "all". | 5508 | This option specifies which types of queries should be killed to unblock the global lock. Default is "all". |
150 | 5509 | 5509 | ||
152 | 5510 | =item --lock-wait-timeout=SECONDS | 5510 | =item --ftwrl-wait-timeout=SECONDS |
153 | 5511 | 5511 | ||
154 | 5512 | This option specifies time in seconds that innobackupex should wait for queries that would block FTWRL before running it. If there are still such queries when the timeout expires, innobackupex terminates with an error. | 5512 | This option specifies time in seconds that innobackupex should wait for queries that would block FTWRL before running it. If there are still such queries when the timeout expires, innobackupex terminates with an error. |
155 | 5513 | Default is 0, in which case innobackupex does not wait for queries to complete and starts FTWRL immediately. | 5513 | Default is 0, in which case innobackupex does not wait for queries to complete and starts FTWRL immediately. |
156 | 5514 | 5514 | ||
162 | 5515 | =item --lock-wait-threshold=SECONDS | 5515 | =item --ftwrl-wait-threshold=SECONDS |
163 | 5516 | 5516 | ||
164 | 5517 | This option specifies the query run time threshold which is used by innobackupex to detect long-running queries with a non-zero value of --lock-wait-timeout. FTWRL is not started until such long-running queries exist. This option has no effect if --lock-wait-timeout is 0. Default value is 60 seconds. | 5517 | This option specifies the query run time threshold which is used by innobackupex to detect long-running queries with a non-zero value of --ftwrl-wait-timeout. FTWRL is not started until such long-running queries exist. This option has no effect if --ftwrl-wait-timeout is 0. Default value is 60 seconds. |
165 | 5518 | 5518 | ||
166 | 5519 | =item --lock-wait-query-type=all|update | 5519 | =item --ftwrl-wait-query-type=all|update |
167 | 5520 | 5520 | ||
168 | 5521 | This option specifies which types of queries are allowed to complete before innobackupex will issue the global lock. Default is all. | 5521 | This option specifies which types of queries are allowed to complete before innobackupex will issue the global lock. Default is all. |
169 | 5522 | 5522 | ||
170 | 5523 | 5523 | ||
171 | === modified file 'storage/innobase/xtrabackup/test/t/kill_long_selects.sh' | |||
172 | --- storage/innobase/xtrabackup/test/t/kill_long_selects.sh 2014-09-04 16:53:33 +0000 | |||
173 | +++ storage/innobase/xtrabackup/test/t/kill_long_selects.sh 2015-01-16 18:10:24 +0000 | |||
174 | @@ -153,9 +153,9 @@ | |||
175 | 153 | wait_for_connection_count 2 | 153 | wait_for_connection_count 2 |
176 | 154 | 154 | ||
177 | 155 | run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} $topdir/full \ | 155 | run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} $topdir/full \ |
181 | 156 | --lock-wait-timeout=3 \ | 156 | --ftwrl-wait-timeout=3 \ |
182 | 157 | --lock-wait-query-type=all \ | 157 | --ftwrl-wait-query-type=all \ |
183 | 158 | --lock-wait-threshold=1 \ | 158 | --ftwrl-wait-threshold=1 \ |
184 | 159 | --kill-long-queries-timeout=1 \ | 159 | --kill-long-queries-timeout=1 \ |
185 | 160 | --kill-long-query-type=all | 160 | --kill-long-query-type=all |
186 | 161 | 161 | ||
187 | @@ -171,9 +171,9 @@ | |||
188 | 171 | wait_for_connection_count 2 | 171 | wait_for_connection_count 2 |
189 | 172 | 172 | ||
190 | 173 | run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} $topdir/full \ | 173 | run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} $topdir/full \ |
194 | 174 | --lock-wait-timeout=3 \ | 174 | --ftwrl-wait-timeout=3 \ |
195 | 175 | --lock-wait-query-type=update \ | 175 | --ftwrl-wait-query-type=update \ |
196 | 176 | --lock-wait-threshold=2 \ | 176 | --ftwrl-wait-threshold=2 \ |
197 | 177 | --kill-long-queries-timeout=1 \ | 177 | --kill-long-queries-timeout=1 \ |
198 | 178 | --kill-long-query-type=all | 178 | --kill-long-query-type=all |
199 | 179 | 179 | ||
200 | @@ -190,9 +190,9 @@ | |||
201 | 190 | wait_for_connection_count 2 | 190 | wait_for_connection_count 2 |
202 | 191 | 191 | ||
203 | 192 | innobackupex $topdir/full \ | 192 | innobackupex $topdir/full \ |
207 | 193 | --lock-wait-timeout=6 \ | 193 | --ftwrl-wait-timeout=6 \ |
208 | 194 | --lock-wait-query-type=update \ | 194 | --ftwrl-wait-query-type=update \ |
209 | 195 | --lock-wait-threshold=2 \ | 195 | --ftwrl-wait-threshold=2 \ |
210 | 196 | --kill-long-queries-timeout=1 \ | 196 | --kill-long-queries-timeout=1 \ |
211 | 197 | --kill-long-query-type=all | 197 | --kill-long-query-type=all |
212 | 198 | 198 |