Merge lp:~akopytov/percona-xtrabackup/bug713267-2.1 into lp:percona-xtrabackup/2.1

Proposed by Alexey Kopytov on 2012-05-30
Status: Merged
Approved by: Stewart Smith on 2012-05-31
Approved revision: 401
Merged at revision: 401
Proposed branch: lp:~akopytov/percona-xtrabackup/bug713267-2.1
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 143 lines (+70/-30)
3 files modified
src/fil_cur.c (+31/-29)
src/xtrabackup.c (+31/-0)
src/xtrabackup.h (+8/-1)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug713267-2.1
Reviewer Review Type Date Requested Status
Stewart Smith (community) 2012-05-30 Approve on 2012-05-31
Review via email: mp+107938@code.launchpad.net
To post a comment you must log in.
Stewart Smith (stewart) wrote :

 review approve
 merge approve
--
Stewart Smith

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/fil_cur.c'
2--- src/fil_cur.c 2012-05-25 11:38:15 +0000
3+++ src/fil_cur.c 2012-05-30 09:23:28 +0000
4@@ -56,34 +56,6 @@
5
6 cursor->is_system = trx_sys_sys_space(node->space->id);
7
8- /* Determine the page size */
9-#ifndef INNODB_VERSION_SHORT
10- zip_size = UNIV_PAGE_SIZE;
11- page_size = UNIV_PAGE_SIZE;
12- page_size_shift = UNIV_PAGE_SIZE_SHIFT;
13-#else
14- zip_size = fil_space_get_zip_size(node->space->id);
15- if (zip_size == ULINT_UNDEFINED) {
16- return(XB_FIL_CUR_SKIP);
17- } else if (zip_size) {
18- page_size = zip_size;
19- page_size_shift = get_bit_shift(page_size);
20- msg("[%02u] %s is compressed with page size = "
21- "%lu bytes\n", thread_n, node->name, page_size);
22- if (page_size_shift < 10 || page_size_shift > 14) {
23- msg("[%02u] xtrabackup: Error: Invalid "
24- "page size: %lu.\n", thread_n, page_size);
25- ut_error;
26- }
27- } else {
28- page_size = UNIV_PAGE_SIZE;
29- page_size_shift = UNIV_PAGE_SIZE_SHIFT;
30- }
31-#endif
32- cursor->page_size = page_size;
33- cursor->page_size_shift = page_size_shift;
34- cursor->zip_size = zip_size;
35-
36 /* Make the file path relative to the backup root,
37 i.e. "ibdata1" for system tablespace or database/table.ibd for
38 per-table spaces. */
39@@ -133,7 +105,35 @@
40 cursor->file = node->handle;
41 }
42 posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);
43- posix_fadvise(cursor->file, 0, 0, POSIX_FADV_DONTNEED);
44+
45+ /* Determine the page size */
46+#ifndef INNODB_VERSION_SHORT
47+ zip_size = UNIV_PAGE_SIZE;
48+ page_size = UNIV_PAGE_SIZE;
49+ page_size_shift = UNIV_PAGE_SIZE_SHIFT;
50+#else
51+ zip_size = xb_get_zip_size(cursor->file);
52+ if (zip_size == ULINT_UNDEFINED) {
53+ os_file_close(cursor->file);
54+ return(XB_FIL_CUR_SKIP);
55+ } else if (zip_size) {
56+ page_size = zip_size;
57+ page_size_shift = get_bit_shift(page_size);
58+ msg("[%02u] %s is compressed with page size = "
59+ "%lu bytes\n", thread_n, node->name, page_size);
60+ if (page_size_shift < 10 || page_size_shift > 14) {
61+ msg("[%02u] xtrabackup: Error: Invalid "
62+ "page size: %lu.\n", thread_n, page_size);
63+ ut_error;
64+ }
65+ } else {
66+ page_size = UNIV_PAGE_SIZE;
67+ page_size_shift = UNIV_PAGE_SIZE_SHIFT;
68+ }
69+#endif
70+ cursor->page_size = page_size;
71+ cursor->page_size_shift = page_size_shift;
72+ cursor->zip_size = zip_size;
73
74 /* Allocate read buffer */
75 cursor->buf_size = XB_FIL_CUR_PAGES * page_size;
76@@ -246,6 +246,8 @@
77 cursor->buf_npages++;
78 }
79
80+ posix_fadvise(cursor->file, 0, 0, POSIX_FADV_DONTNEED);
81+
82 cursor->offset += page_size * i;
83
84 return(ret);
85
86=== modified file 'src/xtrabackup.c'
87--- src/xtrabackup.c 2012-05-25 11:38:15 +0000
88+++ src/xtrabackup.c 2012-05-30 09:23:28 +0000
89@@ -1626,6 +1626,37 @@
90 return(TRUE);
91 }
92
93+#ifdef INNODB_VERSION_SHORT
94+/***********************************************************************
95+Reads the space flags from a given data file and returns the compressed
96+page size, or 0 if the space is not compressed. */
97+ulint
98+xb_get_zip_size(os_file_t file)
99+{
100+ byte *buf;
101+ byte *page;
102+ ulint zip_size = ULINT_UNDEFINED;
103+ ibool success;
104+ ulint space;
105+
106+ buf = ut_malloc(2 * UNIV_PAGE_SIZE_MAX);
107+ page = ut_align(buf, UNIV_PAGE_SIZE_MAX);
108+
109+ success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE_MAX);
110+ if (!success) {
111+ goto end;
112+ }
113+
114+ space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
115+ zip_size = (space == 0 ) ? 0 :
116+ dict_table_flags_to_zip_size(fsp_header_get_flags(page));
117+end:
118+ ut_free(buf);
119+
120+ return(zip_size);
121+}
122+#endif
123+
124 /* TODO: We may tune the behavior (e.g. by fil_aio)*/
125
126 static
127
128=== modified file 'src/xtrabackup.h'
129--- src/xtrabackup.h 2012-05-25 11:38:15 +0000
130+++ src/xtrabackup.h 2012-05-30 09:23:28 +0000
131@@ -38,4 +38,11 @@
132 my_bool xb_write_delta_metadata(const char *filename,
133 const xb_delta_info_t *info);
134
135-#endif
136+#ifdef INNODB_VERSION_SHORT
137+/***********************************************************************
138+Reads the space flags from a given data file and returns the compressed
139+page size, or 0 if the space is not compressed. */
140+ulint xb_get_zip_size(os_file_t file);
141+#endif /* INNODB_VERSION_SHORT */
142+
143+#endif /* XB_XTRABACKUP_H */

Subscribers

People subscribed via source and target branches

to all changes: