Merge lp:~akopytov/percona-xtrabackup/bug1411157 into lp:percona-xtrabackup/2.3

Proposed by Alexey Kopytov on 2015-01-16
Status: Merged
Approved by: Alexey Kopytov on 2015-01-16
Approved revision: 5063
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
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve on 2015-01-16
Review via email: mp+246760@code.launchpad.net
To post a comment you must log in.
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 Waiting for queries to finish
6 -----------------------------
7
8-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).
9-
10-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.
11-
12-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.
13+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+
15+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+
17+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
19 Killing the blocking queries
20 ----------------------------
21@@ -30,11 +30,11 @@
22 Options summary
23 ---------------
24
25-* :option:`--lock-wait-timeout=N` (seconds) - how long to wait for a good moment. Default is 0, not to wait.
26-
27-* :option:`--lock-wait-query-type={all|update}` - which long queries should be finished before ``FLUSH TABLES WITH READ LOCK`` is run. Default is all.
28-
29-* :option:`--lock-wait-threshold=N` (seconds) - how long query should be running before we consider it long running and potential blocker of global lock.
30+* :option:`--ftwrl-wait-timeout=N` (seconds) - how long to wait for a good moment. Default is 0, not to wait.
31+
32+* :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+
34+* :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
36 * :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
38@@ -45,7 +45,7 @@
39
40 Running the |innobackupex| with the following options: ::
41
42- $ 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/
43+ $ 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
45 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
47
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
53 This option specifies which types of queries should be killed to unblock the global lock. Default is "all".
54
55-.. option:: --lock-wait-timeout=SECONDS
56+.. option:: --ftwrl-wait-timeout=SECONDS
57
58 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
60-.. option:: --lock-wait-threshold=SECONDS
61-
62- 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.
63-
64-.. option:: --lock-wait-query-type=all|update
65+.. option:: --ftwrl-wait-threshold=SECONDS
66+
67+ 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+
69+.. option:: --ftwrl-wait-query-type=all|update
70
71 This option specifies which types of queries are allowed to complete before innobackupex will issue the global lock. Default is all.
72
73
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 my $option_kill_long_queries_timeout = 0;
79
80 # waiting for an appropriate time to start FTWRL timeout
81-my $option_lock_wait_timeout = 0;
82+my $option_ftwrl_wait_timeout = 0;
83
84 # how old should be query to be waited for
85-my $option_lock_wait_threshold = 60;
86+my $option_ftwrl_wait_threshold = 60;
87
88 # which type of queries we are waiting for during the pre-FTWRL phase
89 # possible values are "update" and "all"
90-my $option_lock_wait_query_type = "all";
91+my $option_ftwrl_wait_query_type = "all";
92
93 # which type of queries wa are waiting when clearing the way for FTWRL
94 # by killing; possible values are "select" and "all"
95@@ -3342,7 +3342,7 @@
96 while (my ($id, $process) = each %$processlist) {
97 if (defined($process->{Info}) &&
98 $process->{Time} >= $threshold &&
99- (($option_lock_wait_query_type eq "all" &&
100+ (($option_ftwrl_wait_query_type eq "all" &&
101 is_query($process->{Info})) ||
102 is_update_query($process->{Info}))) {
103 print STDERR "\n$now $prefix Waiting for query $id (duration " .
104@@ -3456,9 +3456,9 @@
105 return;
106 }
107
108- if ($option_lock_wait_timeout) {
109- wait_for_no_updates($con, $option_lock_wait_timeout,
110- $option_lock_wait_threshold);
111+ if ($option_ftwrl_wait_timeout) {
112+ wait_for_no_updates($con, $option_ftwrl_wait_timeout,
113+ $option_ftwrl_wait_threshold);
114 }
115
116 $now = current_time();
117@@ -3831,10 +3831,10 @@
118 \$option_kill_long_queries_timeout,
119 'kill-long-query-type=s' =>
120 \$option_kill_long_query_type,
121- 'lock-wait-timeout=i' => \$option_lock_wait_timeout,
122- 'lock-wait-threshold=i' => \$option_lock_wait_threshold,
123- 'lock-wait-query-type=s' =>
124- \$option_lock_wait_query_type,
125+ 'ftwrl-wait-timeout=i' => \$option_ftwrl_wait_timeout,
126+ 'ftwrl-wait-threshold=i' => \$option_ftwrl_wait_threshold,
127+ 'ftwrl-wait-query-type=s' =>
128+ \$option_ftwrl_wait_query_type,
129 'version-check!' => \$option_version_check,
130 'force-non-empty-directories' =>
131 \$option_force_non_empty_dirs
132@@ -3902,10 +3902,10 @@
133 $option_compress = 0;
134 }
135
136- # validate lock-wait-query-type and kill-long-query-type values
137- if (!(grep {$_ eq $option_lock_wait_query_type} qw/all update/)) {
138- die "Wrong value of lock-wait-query-type. ".
139- "Possible values are all|update, but $option_lock_wait_query_type ".
140+ # validate ftwrl-wait-query-type and kill-long-query-type values
141+ if (!(grep {$_ eq $option_ftwrl_wait_query_type} qw/all update/)) {
142+ die "Wrong value of ftwrl-wait-query-type. ".
143+ "Possible values are all|update, but $option_ftwrl_wait_query_type ".
144 "is specified.";
145 }
146 if (!(grep {$_ eq $option_kill_long_query_type} qw/all select/)) {
147@@ -5507,16 +5507,16 @@
148
149 This option specifies which types of queries should be killed to unblock the global lock. Default is "all".
150
151-=item --lock-wait-timeout=SECONDS
152+=item --ftwrl-wait-timeout=SECONDS
153
154 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 Default is 0, in which case innobackupex does not wait for queries to complete and starts FTWRL immediately.
156
157-=item --lock-wait-threshold=SECONDS
158-
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 --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.
160-
161-=item --lock-wait-query-type=all|update
162+=item --ftwrl-wait-threshold=SECONDS
163+
164+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+
166+=item --ftwrl-wait-query-type=all|update
167
168 This option specifies which types of queries are allowed to complete before innobackupex will issue the global lock. Default is all.
169
170
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 wait_for_connection_count 2
176
177 run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} $topdir/full \
178- --lock-wait-timeout=3 \
179- --lock-wait-query-type=all \
180- --lock-wait-threshold=1 \
181+ --ftwrl-wait-timeout=3 \
182+ --ftwrl-wait-query-type=all \
183+ --ftwrl-wait-threshold=1 \
184 --kill-long-queries-timeout=1 \
185 --kill-long-query-type=all
186
187@@ -171,9 +171,9 @@
188 wait_for_connection_count 2
189
190 run_cmd_expect_failure ${IB_BIN} ${IB_ARGS} $topdir/full \
191- --lock-wait-timeout=3 \
192- --lock-wait-query-type=update \
193- --lock-wait-threshold=2 \
194+ --ftwrl-wait-timeout=3 \
195+ --ftwrl-wait-query-type=update \
196+ --ftwrl-wait-threshold=2 \
197 --kill-long-queries-timeout=1 \
198 --kill-long-query-type=all
199
200@@ -190,9 +190,9 @@
201 wait_for_connection_count 2
202
203 innobackupex $topdir/full \
204- --lock-wait-timeout=6 \
205- --lock-wait-query-type=update \
206- --lock-wait-threshold=2 \
207+ --ftwrl-wait-timeout=6 \
208+ --ftwrl-wait-query-type=update \
209+ --ftwrl-wait-threshold=2 \
210 --kill-long-queries-timeout=1 \
211 --kill-long-query-type=all
212

Subscribers

People subscribed via source and target branches

to all changes: