Merge lp:~akopytov/percona-xtrabackup/bugs_665210_and_810269-1.7 into lp:percona-xtrabackup/2.0

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 294
Proposed branch: lp:~akopytov/percona-xtrabackup/bugs_665210_and_810269-1.7
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 649 lines (+318/-66)
2 files modified
patches/tar4ibd_libtar-1.2.11.patch (+236/-66)
test/t/bug810269.sh (+82/-0)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bugs_665210_and_810269-1.7
Reviewer Review Type Date Requested Status
Stewart Smith Pending
Review via email: mp+68001@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Added copyright notice to tar4ibd_libtar-1.2.11.patch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'patches/tar4ibd_libtar-1.2.11.patch'
2--- patches/tar4ibd_libtar-1.2.11.patch 2011-06-12 11:48:28 +0000
3+++ patches/tar4ibd_libtar-1.2.11.patch 2011-07-18 09:36:40 +0000
4@@ -1,7 +1,40 @@
5-diff -ruN a/lib/Makefile.in b/lib/Makefile.in
6---- a/lib/Makefile.in 2011-05-25 16:46:41.000000000 +0400
7-+++ b/lib/Makefile.in 2011-05-25 16:47:54.000000000 +0400
8-@@ -29,7 +29,7 @@
9+# (c) 2009 - 2011 Percona Inc.
10+#
11+# This program is free software; you can redistribute it and/or modify
12+# it under the terms of the GNU General Public License as published by
13+# the Free Software Foundation; version 2 of the License.
14+#
15+# This program is distributed in the hope that it will be useful,
16+# but WITHOUT ANY WARRANTY; without even the implied warranty of
17+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+# GNU General Public License for more details.
19+#
20+# You should have received a copy of the GNU General Public License
21+# along with this program; if not, write to the Free Software
22+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23+#
24+# This patch incorporates code covered by the following copyright and
25+# permission notice:
26+#
27+# Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
28+#
29+# This program is free software; you can redistribute it and/or modify it under
30+# the terms of the GNU General Public License as published by the Free Software
31+# Foundation; version 2 of the License.
32+#
33+# This program is distributed in the hope that it will be useful, but WITHOUT
34+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
35+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
36+#
37+# You should have received a copy of the GNU General Public License along with
38+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
39+# Place, Suite 330, Boston, MA 02111-1307 USA
40+#
41+#
42+diff -ruN libtar-1.2.11.orig/lib/Makefile.in libtar-1.2.11/lib/Makefile.in
43+--- libtar-1.2.11.orig/lib/Makefile.in 2011-07-14 13:27:10.000000000 +0400
44++++ libtar-1.2.11/lib/Makefile.in 2011-07-14 13:27:37.000000000 +0400
45+@@ -29,7 +29,7 @@ CPPFLAGS = -I. \
46 -I${top_srcdir}/compat \
47 -I../listhash \
48 @CPPFLAGS@
49@@ -10,13 +43,19 @@
50 LDFLAGS = @LDFLAGS@
51 LIBS = @LIBS@
52 LIBOBJS = @LIBOBJS@
53-diff -ruN a/lib/append.c b/lib/append.c
54---- a/lib/append.c 2011-05-25 16:46:41.000000000 +0400
55-+++ b/lib/append.c 2011-05-25 17:42:25.000000000 +0400
56-@@ -27,6 +27,218 @@
57+diff -ruN libtar-1.2.11.orig/lib/append.c libtar-1.2.11/lib/append.c
58+--- libtar-1.2.11.orig/lib/append.c 2011-07-14 13:27:10.000000000 +0400
59++++ libtar-1.2.11/lib/append.c 2011-07-14 18:37:57.000000000 +0400
60+@@ -27,6 +27,327 @@
61 # include <unistd.h>
62 #endif
63
64++#ifdef HAVE_LIBZ
65++#include <zlib.h>
66++#else
67++#error "zlib not found"
68++#endif
69++
70 +#ifdef POSIX_FADV_NORMAL
71 +#define USE_POSIX_FADVISE
72 +#endif
73@@ -24,15 +63,26 @@
74 +/* all of these ripped from InnoDB code from MySQL 4.0.22 */
75 +#define UT_HASH_RANDOM_MASK 1463735687
76 +#define UT_HASH_RANDOM_MASK2 1653893711
77-+#define FIL_PAGE_LSN 16
78++#define FIL_PAGE_LSN 16
79 +#define FIL_PAGE_FILE_FLUSH_LSN 26
80 +#define FIL_PAGE_OFFSET 4
81 +#define FIL_PAGE_DATA 38
82 +#define FIL_PAGE_DATA_ALIGN_32 40
83 +#define FIL_PAGE_END_LSN_OLD_CHKSUM 8
84 +#define FIL_PAGE_SPACE_OR_CHKSUM 0
85-+//#define UNIV_PAGE_SIZE (2 * 8192)
86 +#define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL
87++#define FSP_EXTENT_SIZE 64
88++#define FSP_HEADER_OFFSET FIL_PAGE_DATA
89++#define FSP_SPACE_FLAGS 16 /* table->flags & ~DICT_TF_COMPACT */
90++#define DICT_TF_ZSSIZE_SHIFT 1
91++#define DICT_TF_ZSSIZE_MASK (15 << DICT_TF_ZSSIZE_SHIFT)
92++#define PAGE_ZIP_MIN_SIZE_SHIFT 10
93++#define PAGE_ZIP_MIN_SIZE (1 << PAGE_ZIP_MIN_SIZE_SHIFT)
94++#define UNIV_PAGE_SIZE (2 * 8192)
95++#define FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID 34 /* starting from 4.1.x this
96++ contains the space id of the page */
97++#define FIL_PAGE_TYPE 24 /* file page type: FIL_PAGE_INDEX,...,
98++ 2 bytes.
99 +
100 +/* defined in libtar.c. if 1, O_DIRECT will be used for input files */
101 +extern int use_direct;
102@@ -136,6 +186,87 @@
103 +}
104 +
105 +ulint
106++fsp_header_get_flags(
107++/*=================*/
108++ byte* page) /*!< in: first page of a tablespace */
109++{
110++ return(mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page));
111++}
112++
113++ulint
114++dict_table_flags_to_zip_size(
115++/*=========================*/
116++ ulint flags) /*!< in: flags */
117++{
118++ ulint zip_size = flags & DICT_TF_ZSSIZE_MASK;
119++
120++ if (zip_size) {
121++ zip_size = ((PAGE_ZIP_MIN_SIZE >> 1)
122++ << (zip_size >> DICT_TF_ZSSIZE_SHIFT));
123++ }
124++
125++ return(zip_size);
126++}
127++
128++int
129++fil_fd_get_zip_size(
130++/*===================*/
131++ int fd)
132++{
133++ ulint flags;
134++ byte buf[UNIV_PAGE_SIZE * 2];
135++ byte *page = (byte *) (((unsigned long) buf + UNIV_PAGE_SIZE - 1) &
136++ ~(UNIV_PAGE_SIZE - 1));
137++
138++ if(pread(fd, page, UNIV_PAGE_SIZE, 0) != UNIV_PAGE_SIZE)
139++ return -1;
140++
141++ flags = fsp_header_get_flags(page);
142++
143++ if (flags && flags != (ulint)-1) {
144++ return(dict_table_flags_to_zip_size(flags));
145++ }
146++
147++ return(flags);
148++}
149++
150++ulint
151++fil_fd_get_space_id(
152++/*===================*/
153++ int fd)
154++{
155++ byte buf[UNIV_PAGE_SIZE * 2];
156++ byte *page = (byte *) (((unsigned long) buf + UNIV_PAGE_SIZE - 1) &
157++ ~(UNIV_PAGE_SIZE - 1));
158++
159++ if(pread(fd, page, UNIV_PAGE_SIZE, 0) != UNIV_PAGE_SIZE)
160++ return -1;
161++
162++ return(mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
163++}
164++
165++ulint
166++page_zip_calc_checksum(
167++/*===================*/
168++ const void* data, /*!< in: compressed page */
169++ ulint size) /*!< in: size of compressed page */
170++{
171++ /* Exclude FIL_PAGE_SPACE_OR_CHKSUM, FIL_PAGE_LSN,
172++ and FIL_PAGE_FILE_FLUSH_LSN from the checksum. */
173++
174++ const Bytef* s = data;
175++ uLong adler;
176++
177++ adler = adler32(0L, s + FIL_PAGE_OFFSET,
178++ FIL_PAGE_LSN - FIL_PAGE_OFFSET);
179++ adler = adler32(adler, s + FIL_PAGE_TYPE, 2);
180++ adler = adler32(adler, s + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
181++ size - FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
182++
183++ return((ulint) adler);
184++}
185++
186++ulint
187 +buf_calc_page_new_checksum_32(
188 +/*==========================*/
189 + byte* page,
190@@ -175,15 +306,17 @@
191 +/*==================*/
192 + /* out: TRUE if corrupted */
193 + byte* read_buf, /* in: a database page */
194-+ ulint page_size)
195++ ulint page_size,
196++ ulint zip_size)
197 +{
198 + ulint checksum;
199 + ulint old_checksum;
200 + ulint checksum_field;
201 + ulint old_checksum_field;
202 +
203-+ if (mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
204-+ != mach_read_from_4(read_buf + page_size
205++ if (!zip_size &&
206++ mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
207++ != mach_read_from_4(read_buf + page_size
208 + - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
209 +
210 + /* Stored log sequence numbers at the start and the end
211@@ -195,18 +328,27 @@
212 + /* If we use checksums validation, make additional check before returning
213 + TRUE to ensure that the checksum is not equal to BUF_NO_CHECKSUM_MAGIC which
214 + might be stored by InnoDB with checksums disabled.
215-+ Otherwise, skip checksum calculation and return FALSE */
216-+
217-+ old_checksum = buf_calc_page_old_checksum(read_buf);
218-+
219-+ old_checksum_field = mach_read_from_4(read_buf + page_size
220-+ - FIL_PAGE_END_LSN_OLD_CHKSUM);
221++ Otherwise, skip checksum calculation and return FALSE */
222++
223++ checksum_field = mach_read_from_4(read_buf +
224++ FIL_PAGE_SPACE_OR_CHKSUM);
225++
226++ if (zip_size) {
227++ return(checksum_field != BUF_NO_CHECKSUM_MAGIC
228++ && checksum_field
229++ != page_zip_calc_checksum(read_buf, zip_size));
230++ }
231++
232++ old_checksum = buf_calc_page_old_checksum(read_buf);
233++
234++ old_checksum_field = mach_read_from_4(read_buf + page_size
235++ - FIL_PAGE_END_LSN_OLD_CHKSUM);
236 +
237 + /* There are 2 valid formulas for old_checksum_field:
238 + 1. Very old versions of InnoDB only stored 8 byte lsn to the start
239 + and the end of the page.
240 + 2. Newer InnoDB versions store the old formula checksum there. */
241-+
242++
243 + if (old_checksum_field != mach_read_from_4(read_buf + FIL_PAGE_LSN)
244 + && old_checksum_field != old_checksum
245 + && old_checksum_field != BUF_NO_CHECKSUM_MAGIC) {
246@@ -226,13 +368,13 @@
247 +
248 + return(1);
249 + }
250-+
251++
252 + return(0);
253 +}
254
255 struct tar_dev
256 {
257-@@ -69,7 +281,7 @@
258+@@ -69,7 +390,7 @@ tar_append_file(TAR *t, char *realname,
259 (savename ? savename : "[NULL]"));
260 #endif
261
262@@ -241,7 +383,7 @@
263 {
264 #ifdef DEBUG
265 perror("lstat()");
266-@@ -210,11 +422,14 @@
267+@@ -210,11 +531,17 @@ tar_append_eof(TAR *t)
268 int
269 tar_append_regfile(TAR *t, char *realname)
270 {
271@@ -252,14 +394,17 @@
272 - int i, j;
273 - size_t size;
274 + int j, k, n_retry;
275-+ long long i, size;
276-+ int page_size = 4 * 1024; /* check 4K, 8K and 16K */
277++ long long i, size, offset;
278++ int page_size = 1 * 1024; /* check 1K, 2K, 4K, 8K and 16K */
279++ int page_size_shift = 10;
280++ int zip_size;
281++ int is_sys_space;
282
283 + block = (unsigned char *)(((unsigned long) buf + 16384 - 1) & ~(16384 - 1));
284 filefd = open(realname, O_RDONLY);
285 if (filefd == -1)
286 {
287-@@ -224,28 +439,66 @@
288+@@ -224,27 +551,93 @@ tar_append_regfile(TAR *t, char *realnam
289 return -1;
290 }
291
292@@ -273,10 +418,23 @@
293 + fcntl(filefd, F_SETFL, O_DIRECT);
294 +#endif
295 +
296++ zip_size = fil_fd_get_zip_size(filefd);
297++ if (zip_size == -1) {
298++ fprintf(stderr,
299++ "tar4ibd: file '%s' has invalid zip_size value.\n",
300++ realname);
301++ return(-1);
302++ } else if (zip_size != 0) {
303++ page_size = zip_size;
304++ }
305++
306++ is_sys_space = (fil_fd_get_space_id(filefd) == 0);
307++
308 + n_retry = 0;
309 size = th_get_size(t);
310 - for (i = size; i > T_BLOCKSIZE; i -= T_BLOCKSIZE)
311-+ for (i = size; i >= page_size; i -= page_size)
312++ for (i = size, offset = 0; i >= page_size;
313++ i -= page_size, offset += page_size)
314 {
315 - j = read(filefd, &block, T_BLOCKSIZE);
316 - if (j != T_BLOCKSIZE)
317@@ -288,8 +446,19 @@
318 return -1;
319 }
320 - if (tar_block_write(t, &block) == -1)
321-- return -1;
322-+ if (buf_page_is_corrupted(block, (ulint)page_size)) {
323++ if (buf_page_is_corrupted(block, (ulint)page_size,
324++ (ulint)zip_size)) {
325++ ulint page_no = (unsigned long)
326++ (offset >> page_size_shift);
327++ if (is_sys_space &&
328++ page_no >= FSP_EXTENT_SIZE &&
329++ page_no < FSP_EXTENT_SIZE * 3) {
330++ fprintf(stderr, "tar4ibd: page %lu seems to "
331++ "be from the doublewrite buffer. "
332++ "skipping checksum validation.\n",
333++ page_no);
334++ goto write_page;
335++ }
336 + if (n_retry > 9) {
337 + fprintf(stderr,
338 +"The file '%s' may not be InnoDB datafile or may be corrupted.\n",
339@@ -302,20 +471,23 @@
340 + if (lseek(filefd, - page_size, SEEK_CUR) == -1)
341 + return -1;
342 +
343-+ if (i == size
344++ if (i == size && !zip_size
345 + && page_size < 16 * 1024) {
346 + page_size *= 2;
347++ page_size_shift++;
348 + } else {
349 + n_retry++;
350 + }
351 +
352 + i += page_size;
353++ offset -= page_size;
354 +
355 + continue;
356 + }
357++write_page:
358 + for (k = 0; k < page_size / T_BLOCKSIZE; k++)
359 + if (tar_block_write(t, &block[T_BLOCKSIZE * k]) == -1)
360-+ return -1;
361+ return -1;
362 + n_retry = 0;
363 }
364
365@@ -327,18 +499,16 @@
366 return -1;
367 - memset(&(block[i]), 0, T_BLOCKSIZE - i);
368 - if (tar_block_write(t, &block) == -1)
369-- return -1;
370 + memset(&(block[i]), 0, T_BLOCKSIZE * 32 - i);
371 + for (k = 0; k < ((j - 1) / T_BLOCKSIZE + 1); k++)
372 + if (tar_block_write(t, &block[T_BLOCKSIZE * k]) == -1)
373-+ return -1;
374+ return -1;
375 }
376
377- close(filefd);
378-diff -ruN a/lib/extract.c b/lib/extract.c
379---- a/lib/extract.c 2011-05-25 16:46:41.000000000 +0400
380-+++ b/lib/extract.c 2011-05-25 16:47:54.000000000 +0400
381-@@ -158,11 +158,11 @@
382+diff -ruN libtar-1.2.11.orig/lib/extract.c libtar-1.2.11/lib/extract.c
383+--- libtar-1.2.11.orig/lib/extract.c 2011-07-14 13:27:10.000000000 +0400
384++++ libtar-1.2.11/lib/extract.c 2011-07-14 13:27:37.000000000 +0400
385+@@ -158,11 +158,11 @@ int
386 tar_extract_regfile(TAR *t, char *realname)
387 {
388 mode_t mode;
389@@ -352,10 +522,10 @@
390 char buf[T_BLOCKSIZE];
391 char *filename;
392
393-diff -ruN a/lib/libtar.h b/lib/libtar.h
394---- a/lib/libtar.h 2011-05-25 16:46:41.000000000 +0400
395-+++ b/lib/libtar.h 2011-05-25 16:47:54.000000000 +0400
396-@@ -180,7 +180,7 @@
397+diff -ruN libtar-1.2.11.orig/lib/libtar.h libtar-1.2.11/lib/libtar.h
398+--- libtar-1.2.11.orig/lib/libtar.h 2011-07-14 13:27:10.000000000 +0400
399++++ libtar-1.2.11/lib/libtar.h 2011-07-14 13:27:37.000000000 +0400
400+@@ -180,7 +180,7 @@ int th_write(TAR *t);
401
402 /* decode tar header info */
403 #define th_get_crc(t) oct_to_int((t)->th_buf.chksum)
404@@ -364,7 +534,7 @@
405 #define th_get_mtime(t) oct_to_int((t)->th_buf.mtime)
406 #define th_get_devmajor(t) oct_to_int((t)->th_buf.devmajor)
407 #define th_get_devminor(t) oct_to_int((t)->th_buf.devminor)
408-@@ -204,9 +204,9 @@
409+@@ -204,9 +204,9 @@ void th_set_user(TAR *t, uid_t uid);
410 void th_set_group(TAR *t, gid_t gid);
411 void th_set_mode(TAR *t, mode_t fmode);
412 #define th_set_mtime(t, fmtime) \
413@@ -376,7 +546,7 @@
414
415 /* encode everything at once (except the pathname and linkname) */
416 void th_set_from_stat(TAR *t, struct stat *s);
417-@@ -268,13 +268,16 @@
418+@@ -268,13 +268,16 @@ int th_crc_calc(TAR *t);
419
420 /* string-octal to integer conversion */
421 int oct_to_int(char *oct);
422@@ -394,10 +564,10 @@
423
424
425 /***** wrapper.c **********************************************************/
426-diff -ruN a/lib/util.c b/lib/util.c
427---- a/lib/util.c 2011-05-25 16:46:41.000000000 +0400
428-+++ b/lib/util.c 2011-05-25 16:47:54.000000000 +0400
429-@@ -138,6 +138,14 @@
430+diff -ruN libtar-1.2.11.orig/lib/util.c libtar-1.2.11/lib/util.c
431+--- libtar-1.2.11.orig/lib/util.c 2011-07-14 13:27:10.000000000 +0400
432++++ libtar-1.2.11/lib/util.c 2011-07-14 13:27:37.000000000 +0400
433+@@ -138,6 +138,14 @@ oct_to_int(char *oct)
434 return i;
435 }
436
437@@ -412,7 +582,7 @@
438
439 /* integer to string-octal conversion, no NULL */
440 void
441-@@ -147,4 +155,46 @@
442+@@ -147,4 +155,46 @@ int_to_oct_nonull(int num, char *oct, si
443 oct[octlen - 1] = ' ';
444 }
445
446@@ -459,10 +629,10 @@
447 + }
448 + return i;
449 +}
450-diff -ruN a/libtar/Makefile.in b/libtar/Makefile.in
451---- a/libtar/Makefile.in 2011-05-25 16:46:41.000000000 +0400
452-+++ b/libtar/Makefile.in 2011-05-25 16:47:54.000000000 +0400
453-@@ -29,7 +29,7 @@
454+diff -ruN libtar-1.2.11.orig/libtar/Makefile.in libtar-1.2.11/libtar/Makefile.in
455+--- libtar-1.2.11.orig/libtar/Makefile.in 2011-07-14 13:27:10.000000000 +0400
456++++ libtar-1.2.11/libtar/Makefile.in 2011-07-14 13:27:37.000000000 +0400
457+@@ -29,7 +29,7 @@ CPPFLAGS = -I.. \
458 -I${top_srcdir}/lib \
459 -I${top_srcdir}/compat \
460 @CPPFLAGS@
461@@ -471,7 +641,7 @@
462 LDFLAGS = @LDFLAGS@
463 LIBS = @LIBS@
464 LIBOBJS = @LIBOBJS@
465-@@ -46,15 +46,15 @@
466+@@ -46,15 +46,15 @@ LIBTAR_HDRS = ../config.h \
467 ${top_srcdir}/lib/libtar.h \
468 ../listhash/libtar_listhash.h
469 LIBTAR_LIBS = ../lib/libtar.a
470@@ -490,16 +660,16 @@
471
472 ${LIBTAR_OBJS}: ${LIBTAR_HDRS}
473
474-@@ -69,5 +69,5 @@
475+@@ -69,5 +69,5 @@ distclean: clean
476
477 install: ${ALL}
478 ${MKDIR} ${DESTDIR}${bindir}
479 - ${INSTALL_PROGRAM} libtar ${DESTDIR}${bindir}
480 + ${INSTALL_PROGRAM} tar4ibd ${DESTDIR}${bindir}
481
482-diff -ruN a/libtar/libtar.c b/libtar/libtar.c
483---- a/libtar/libtar.c 2011-05-25 16:46:41.000000000 +0400
484-+++ b/libtar/libtar.c 2011-05-25 16:47:54.000000000 +0400
485+diff -ruN libtar-1.2.11.orig/libtar/libtar.c libtar-1.2.11/libtar/libtar.c
486+--- libtar-1.2.11.orig/libtar/libtar.c 2011-07-14 13:27:10.000000000 +0400
487++++ libtar-1.2.11/libtar/libtar.c 2011-07-14 17:22:13.000000000 +0400
488 @@ -14,6 +14,7 @@
489 #include <libtar.h>
490
491@@ -516,7 +686,7 @@
492
493 #ifdef DEBUG
494 void
495-@@ -109,7 +111,7 @@
496+@@ -109,7 +111,7 @@ create(char *tarfile, char *rootdir, lib
497 char buf[MAXPATHLEN];
498 libtar_listptr_t lp;
499
500@@ -525,7 +695,7 @@
501 #ifdef HAVE_LIBZ
502 (use_zlib ? &gztype : NULL),
503 #else
504-@@ -164,7 +166,7 @@
505+@@ -164,7 +166,7 @@ list(char *tarfile)
506 TAR *t;
507 int i;
508
509@@ -534,7 +704,7 @@
510 #ifdef HAVE_LIBZ
511 (use_zlib ? &gztype : NULL),
512 #else
513-@@ -225,7 +227,7 @@
514+@@ -225,7 +227,7 @@ extract(char *tarfile, char *rootdir)
515 #ifdef DEBUG
516 puts("opening tarfile...");
517 #endif
518@@ -543,7 +713,7 @@
519 #ifdef HAVE_LIBZ
520 (use_zlib ? &gztype : NULL),
521 #else
522-@@ -264,9 +266,9 @@
523+@@ -264,9 +266,9 @@ extract(char *tarfile, char *rootdir)
524 void
525 usage()
526 {
527@@ -555,7 +725,7 @@
528 progname);
529 exit(-1);
530 }
531-@@ -287,7 +289,7 @@
532+@@ -287,7 +289,7 @@ main(int argc, char *argv[])
533
534 progname = basename(argv[0]);
535
536@@ -564,7 +734,7 @@
537 switch (c)
538 {
539 case 'V':
540-@@ -323,11 +325,21 @@
541+@@ -323,11 +325,21 @@ main(int argc, char *argv[])
542 use_zlib = 1;
543 break;
544 #endif /* HAVE_LIBZ */
545@@ -577,7 +747,7 @@
546 + use_direct = 1;
547 + break;
548 +#endif
549-+
550++
551 default:
552 usage();
553 }
554@@ -587,7 +757,7 @@
555 {
556 #ifdef DEBUG
557 printf("argc - optind == %d\tmode == %d\n", argc - optind,
558-@@ -343,15 +355,14 @@
559+@@ -343,15 +355,14 @@ main(int argc, char *argv[])
560 switch (mode)
561 {
562 case MODE_EXTRACT:
563
564=== added file 'test/t/bug810269.sh'
565--- test/t/bug810269.sh 1970-01-01 00:00:00 +0000
566+++ test/t/bug810269.sh 2011-07-18 09:36:40 +0000
567@@ -0,0 +1,82 @@
568+########################################################################
569+# Bug #665210: tar4ibd does not support innodb row_format=compressed
570+# Bug #810269: tar4ibd does not check for doublewrite buffer pages
571+########################################################################
572+
573+. inc/common.sh
574+
575+init
576+
577+if [ -z "$INNODB_VERSION" ]; then
578+ echo "Requires InnoDB plugin or XtraDB" >$SKIPPED_REASON
579+ exit $SKIPPED_EXIT_CODE
580+fi
581+
582+run_mysqld "--innodb_strict_mode --innodb_file_per_table \
583+--innodb_file_format=Barracuda"
584+
585+load_dbase_schema incremental_sample
586+
587+vlog "Compressing the table"
588+
589+run_cmd $MYSQL $MYSQL_ARGS -e \
590+ "ALTER TABLE test ENGINE=InnoDB ROW_FORMAT=compressed \
591+KEY_BLOCK_SIZE=4" incremental_sample
592+
593+vlog "Adding initial rows to table"
594+
595+numrow=10000
596+count=0
597+while [ "$numrow" -gt "$count" ]; do
598+ sql="INSERT INTO test VALUES ($count, $numrow)"
599+ let "count=count+1"
600+ for ((i=0; $i<99; i++)); do
601+ sql="$sql,($count, $numrow)"
602+ let "count=count+1"
603+ done
604+ ${MYSQL} ${MYSQL_ARGS} -e "$sql" incremental_sample
605+done
606+
607+rows=`${MYSQL} ${MYSQL_ARGS} -Ns -e "SELECT COUNT(*) FROM test" \
608+ incremental_sample`
609+if [ "$rows" != "10000" ]; then
610+ vlog "Failed to add initial rows"
611+ exit -1
612+fi
613+
614+vlog "Initial rows added"
615+
616+checksum_a=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" \
617+incremental_sample | awk '{print $2}'`
618+
619+vlog "Starting streaming backup"
620+
621+mkdir -p $topdir/backup
622+
623+innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
624+
625+stop_mysqld
626+rm -rf $mysql_datadir
627+
628+vlog "Applying log"
629+
630+cd $topdir/backup
631+$TAR -ixvf out.tar
632+cd -
633+innobackupex --apply-log $topdir/backup
634+
635+vlog "Restoring MySQL datadir"
636+mkdir -p $mysql_datadir
637+innobackupex --copy-back $topdir/backup
638+
639+run_mysqld
640+
641+checksum_b=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" \
642+incremental_sample | awk '{print $2}'`
643+
644+if [ "$checksum_a" != "$checksum_b" ]; then
645+ vlog "Checksums do not match"
646+ exit -1
647+fi
648+
649+vlog "Checksums are OK"

Subscribers

People subscribed via source and target branches