Merge lp:~sergei.glushchenko/percona-xtrabackup/2.1-bug1125993 into lp:percona-xtrabackup/2.1

Proposed by Sergei Glushchenko
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 564
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/2.1-bug1125993
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 244 lines (+83/-11)
7 files modified
doc/source/innobackupex/innobackupex_option_reference.rst (+4/-0)
doc/source/xtrabackup_bin/xbk_option_reference.rst (+4/-0)
innobackupex (+9/-0)
src/innodb_int.cc (+19/-0)
src/innodb_int.h (+12/-0)
src/xtrabackup.cc (+20/-11)
test/t/bug1125993.sh (+15/-0)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/2.1-bug1125993
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+158524@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Merge from 2.0

Revision history for this message
Alexey Kopytov (akopytov) :
review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) :
review: Needs Fixing
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 'doc/source/innobackupex/innobackupex_option_reference.rst'
2--- doc/source/innobackupex/innobackupex_option_reference.rst 2013-03-29 10:33:27 +0000
3+++ doc/source/innobackupex/innobackupex_option_reference.rst 2013-04-15 11:40:33 +0000
4@@ -114,6 +114,10 @@
5
6 This option accepts a string argument that specifies the log sequence number (:term:`LSN`) to use for the incremental backup. It is used with the :option:`--incremental` option. It is used instead of specifying :option:`--incremental-basedir`. For databases created by *MySQL* and *Percona Server* 5.0-series versions, specify the as two 32-bit integers in high:low format. For databases created in 5.1 and later, specify the LSN as a single 64-bit integer.
7
8+.. option:: --log-copy-interval
9+
10+ This option specifies time interval between checks done by log copying thread in milliseconds.
11+
12 .. option:: --move-back
13
14 Move all the files in a previously made backup from the backup directory to their original locations. As this option removes backup files, it must be used with caution.
15
16=== modified file 'doc/source/xtrabackup_bin/xbk_option_reference.rst'
17--- doc/source/xtrabackup_bin/xbk_option_reference.rst 2012-05-18 11:19:17 +0000
18+++ doc/source/xtrabackup_bin/xbk_option_reference.rst 2013-04-15 11:40:33 +0000
19@@ -105,6 +105,10 @@
20
21 This option is to set the group which should be read from the configuration file. This is used by innobackupex if you use the `--defaults-group` option. It is needed for mysqld_multi deployments.
22
23+.. option:: --log-copy-interval
24+
25+ This option specifies time interval between checks done by log copying thread in milliseconds (default is 1 second).
26+
27 .. option:: --log-stream
28
29 Makes xtrabackup not copy data files, and output the contents of the InnoDB log files to STDOUT until the :option:`--suspend-at-end` file is deleted. This option enables :option:`--suspend-at-end` automatically.
30
31=== modified file 'innobackupex'
32--- innobackupex 2013-04-09 10:58:46 +0000
33+++ innobackupex 2013-04-15 11:40:33 +0000
34@@ -107,6 +107,7 @@
35 my $option_galera_info = '';
36 my $option_no_lock = '';
37 my $option_ibbackup_binary = 'autodetect';
38+my $option_log_copy_interval = 0;
39
40 my $option_defaults_file = '';
41 my $option_defaults_extra_file = '';
42@@ -1012,6 +1013,9 @@
43 if ($option_throttle) {
44 $options = $options . " --throttle=$option_throttle";
45 }
46+ if ($option_log_copy_interval) {
47+ $options = $options . " --log-copy-interval=$option_log_copy_interval";
48+ }
49 if ($option_sleep) {
50 $options = $options . " --sleep=$option_sleep";
51 }
52@@ -1754,6 +1758,7 @@
53 'help' => \$option_help,
54 'version' => \$option_version,
55 'throttle=i' => \$option_throttle,
56+ 'log-copy-interval=i', \$option_log_copy_interval,
57 'sleep=i' => \$option_sleep,
58 'apply-log' => \$option_apply_log,
59 'redo-only' => \$option_redo_only,
60@@ -2918,6 +2923,10 @@
61
62 This option specifies the directory where the incremental backup will be combined with the full backup to make a new full backup. The option accepts a string argument. It is used with the --incremental option.
63
64+=item --log-copy-interval
65+
66+This option specifies time interval between checks done by log copying thread in milliseconds.
67+
68 =item --incremental-lsn
69
70 This option specifies the log sequence number (LSN) to use for the incremental backup. The option accepts a string argument. It is used with the --incremental option. It is used instead of specifying --incremental-basedir. For databases created by MySQL and Percona Server 5.0-series versions, specify the LSN as two 32-bit integers in high:low format. For databases created in 5.1 and later, specify the LSN as a single 64-bit integer.
71
72=== modified file 'src/innodb_int.cc'
73--- src/innodb_int.cc 2013-03-22 09:14:31 +0000
74+++ src/innodb_int.cc 2013-04-15 11:40:33 +0000
75@@ -1131,3 +1131,22 @@
76 #endif
77 index_field->prefix_len = dict_index_field->prefix_len;
78 }
79+
80+/**********************************************************//**
81+Waits for an event object until it is in the signaled state or
82+a timeout is exceeded.
83+@return 0 if success, OS_SYNC_TIME_EXCEEDED if timeout was exceeded */
84+ulint
85+xb_event_wait_time(
86+/*===============*/
87+ os_event_t event, /*!< in: event to wait */
88+ ulint time_in_usec) /*!< in: timeout in
89+ microseconds, or
90+ OS_SYNC_INFINITE_TIME */
91+{
92+#if (MYSQL_VERSION_ID > 50500) && (MYSQL_VERSION_ID > 50600)
93+ return os_event_wait_time_low(event, time_in_usec, 0);
94+#else
95+ return os_event_wait_time(event, time_in_usec);
96+#endif
97+}
98
99=== modified file 'src/innodb_int.h'
100--- src/innodb_int.h 2013-03-22 09:14:31 +0000
101+++ src/innodb_int.h 2013-04-15 11:40:33 +0000
102@@ -1089,4 +1089,16 @@
103 const dict_field_t* dict_index_field, /*!< in: field */
104 index_field_t* index_field); /*!< out: field */
105
106+/**********************************************************//**
107+Waits for an event object until it is in the signaled state or
108+a timeout is exceeded.
109+@return 0 if success, OS_SYNC_TIME_EXCEEDED if timeout was exceeded */
110+ulint
111+xb_event_wait_time(
112+/*===============*/
113+ os_event_t event, /*!< in: event to wait */
114+ ulint time_in_usec); /*!< in: timeout in
115+ microseconds, or
116+ OS_SYNC_INFINITE_TIME */
117+
118 #endif /* INNODB_INT_H */
119
120=== modified file 'src/xtrabackup.cc'
121--- src/xtrabackup.cc 2013-04-09 07:24:21 +0000
122+++ src/xtrabackup.cc 2013-04-15 11:40:33 +0000
123@@ -94,6 +94,7 @@
124 long xtrabackup_throttle = 0; /* 0:unlimited */
125 lint io_ticket;
126 os_event_t wait_throttle = NULL;
127+os_event_t log_copying_stop = NULL;
128
129 char *xtrabackup_incremental = NULL;
130 lsn_t incremental_lsn;
131@@ -160,6 +161,10 @@
132 uint xtrabackup_encrypt_threads;
133 ulonglong xtrabackup_encrypt_chunk_size = 0;
134
135+/* sleep interval beetween log copy iterations in log copying thread
136+in milliseconds (default is 1 second) */
137+int xtrabackup_log_copy_interval = 1000;
138+
139 /* === metadata of backup === */
140 #define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
141 char metadata_type[30] = ""; /*[full-backuped|full-prepared|incremental]*/
142@@ -359,6 +364,7 @@
143 OPT_XTRA_SUSPEND_AT_END,
144 OPT_XTRA_USE_MEMORY,
145 OPT_XTRA_THROTTLE,
146+ OPT_XTRA_LOG_COPY_INTERVAL,
147 OPT_XTRA_INCREMENTAL,
148 OPT_XTRA_INCREMENTAL_BASEDIR,
149 OPT_XTRA_EXTRA_LSNDIR,
150@@ -491,6 +497,9 @@
151 {"throttle", OPT_XTRA_THROTTLE, "limit count of IO operations (pairs of read&write) per second to IOS values (for '--backup')",
152 (G_PTR*) &xtrabackup_throttle, (G_PTR*) &xtrabackup_throttle,
153 0, GET_LONG, REQUIRED_ARG, 0, 0, LONG_MAX, 0, 1, 0},
154+ {"log-copy-interval", OPT_XTRA_LOG_COPY_INTERVAL, "time interval between checks done by log copying thread in milliseconds (default is 1 second).",
155+ (G_PTR*) &xtrabackup_log_copy_interval, (G_PTR*) &xtrabackup_log_copy_interval,
156+ 0, GET_LONG, REQUIRED_ARG, 1000, 0, LONG_MAX, 0, 1, 0},
157 {"extra-lsndir", OPT_XTRA_EXTRA_LSNDIR, "(for --backup): save an extra copy of the xtrabackup_checkpoints file in this directory.",
158 (G_PTR*) &xtrabackup_extra_lsndir, (G_PTR*) &xtrabackup_extra_lsndir,
159 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
160@@ -2082,9 +2091,6 @@
161 return(TRUE);
162 }
163
164-/* copying logfile in background */
165-#define SLEEPING_PERIOD 5
166-
167 static
168 #ifndef __WIN__
169 void*
170@@ -2094,8 +2100,6 @@
171 log_copying_thread(
172 void* arg __attribute__((unused)))
173 {
174- ulint counter = 0;
175-
176 /*
177 Initialize mysys thread-specific memory so we can
178 use mysys functions in this thread.
179@@ -2107,13 +2111,14 @@
180 log_copying_running = TRUE;
181
182 while(log_copying) {
183- os_thread_sleep(200000); /*0.2 sec*/
184-
185- counter++;
186- if(counter >= SLEEPING_PERIOD * 5) {
187- if(xtrabackup_copy_logfile(log_copy_scanned_lsn, FALSE))
188+ os_event_reset(log_copying_stop);
189+ xb_event_wait_time(log_copying_stop,
190+ xtrabackup_log_copy_interval * 1000ULL);
191+ if (log_copying) {
192+ if(xtrabackup_copy_logfile(log_copy_scanned_lsn,
193+ FALSE)) {
194 goto end;
195- counter = 0;
196+ }
197 }
198 }
199
200@@ -2937,6 +2942,7 @@
201 exit(EXIT_FAILURE);
202
203
204+ log_copying_stop = xb_os_event_create(NULL);
205 os_thread_create(log_copying_thread, NULL, &log_copying_thread_id);
206
207 ut_a(xtrabackup_parallel > 0);
208@@ -3036,6 +3042,7 @@
209 skip_last_cp:
210 /* stop log_copying_thread */
211 log_copying = FALSE;
212+ os_event_set(log_copying_stop);
213 msg("xtrabackup: Stopping log copying thread.\n");
214 while (log_copying_running) {
215 msg(".");
216@@ -3048,6 +3055,8 @@
217 exit(EXIT_FAILURE);
218 }
219
220+ os_event_free(log_copying_stop);
221+
222 /* Signal innobackupex that log copying has stopped and it may now
223 unlock tables, so we can possibly stream xtrabackup_logfile later
224 without holding the lock. */
225
226=== added file 'test/t/bug1125993.sh'
227--- test/t/bug1125993.sh 1970-01-01 00:00:00 +0000
228+++ test/t/bug1125993.sh 2013-04-15 11:40:33 +0000
229@@ -0,0 +1,15 @@
230+########################################################################
231+# Bug #1125993: To specify sleep interval in log copying thread
232+########################################################################
233+
234+. inc/common.sh
235+
236+start_server --innodb_file_per_table
237+
238+run_cmd $MYSQL $MYSQL_ARGS test <<EOF
239+CREATE TABLE t1(a INT) ENGINE=InnoDB;
240+INSERT INTO t1 VALUES (4), (5), (6);
241+EOF
242+
243+vlog "Starting backup"
244+innobackupex --no-timestamp $topdir/backup --log-copy-interval=590

Subscribers

People subscribed via source and target branches