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

Proposed by Alexey Kopytov on 2012-05-30
Status: Merged
Approved by: Stewart Smith on 2012-05-31
Approved revision: 435
Merged at revision: 435
Proposed branch: lp:~akopytov/percona-xtrabackup/bug713267-2.0
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 162 lines (+80/-47)
1 file modified
src/xtrabackup.c (+80/-47)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug713267-2.0
Reviewer Review Type Date Requested Status
Stewart Smith (community) 2012-05-30 Approve on 2012-05-31
Review via email: mp+107939@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/xtrabackup.c'
2--- src/xtrabackup.c 2012-05-21 07:55:19 +0000
3+++ src/xtrabackup.c 2012-05-30 09:24:26 +0000
4@@ -2919,6 +2919,38 @@
5 #endif
6 }
7
8+#ifdef INNODB_VERSION_SHORT
9+/***********************************************************************
10+Reads the space flags from a given data file and returns the compressed
11+page size, or 0 if the space is not compressed. */
12+static
13+ulint
14+xb_get_zip_size(os_file_t file)
15+{
16+ byte *buf;
17+ byte *page;
18+ ulint zip_size = ULINT_UNDEFINED;
19+ ibool success;
20+ ulint space;
21+
22+ buf = ut_malloc(2 * UNIV_PAGE_SIZE_MAX);
23+ page = ut_align(buf, UNIV_PAGE_SIZE_MAX);
24+
25+ success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE_MAX);
26+ if (!success) {
27+ goto end;
28+ }
29+
30+ space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
31+ zip_size = (space == 0 ) ? 0 :
32+ dict_table_flags_to_zip_size(fsp_header_get_flags(page));
33+end:
34+ ut_free(buf);
35+
36+ return(zip_size);
37+}
38+#endif
39+
40 /* TODO: We may tune the behavior (e.g. by fil_aio)*/
41 #define COPY_CHUNK 64
42
43@@ -3043,11 +3075,58 @@
44 }
45
46 skip_filter:
47+
48+#ifdef XTRADB_BASED
49+ if (trx_sys_sys_space(node->space->id))
50+#else
51+ if (node->space->id == 0)
52+#endif
53+ {
54+ char *next, *p;
55+ /* system datafile "/fullpath/datafilename.ibd" or "./datafilename.ibd" */
56+ p = node->name;
57+ while ((next = strstr(p, SRV_PATH_SEPARATOR_STR)) != NULL)
58+ {
59+ p = next + 1;
60+ }
61+ strncpy(dst_name, p, sizeof(dst_name));
62+ } else {
63+ /* file per table style "./database/table.ibd" */
64+ strncpy(dst_name, node->name, sizeof(dst_name));
65+ }
66+
67+ /* open src_file*/
68+ if (!node->open) {
69+ src_file = xb_file_create_no_error_handling(node->name,
70+ OS_FILE_OPEN,
71+ OS_FILE_READ_ONLY,
72+ &success);
73+ if (!success) {
74+ /* The following call prints an error message */
75+ os_file_get_last_error(TRUE);
76+
77+ msg("[%02u] xtrabackup: Warning: cannot open %s\n"
78+ "[%02u] xtrabackup: Warning: We assume the "
79+ "table was dropped or renamed during "
80+ "xtrabackup execution and ignore the file.\n",
81+ thread_n, node->name, thread_n);
82+ goto skip;
83+ }
84+
85+ xb_file_set_nocache(src_file, node->name, "OPEN");
86+ } else {
87+ src_file = node->handle;
88+ }
89+
90+#ifdef USE_POSIX_FADVISE
91+ posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);
92+#endif
93+
94 #ifndef INNODB_VERSION_SHORT
95 page_size = UNIV_PAGE_SIZE;
96 page_size_shift = UNIV_PAGE_SIZE_SHIFT;
97 #else
98- zip_size = fil_space_get_zip_size(node->space->id);
99+ zip_size = xb_get_zip_size(src_file);
100 if (zip_size == ULINT_UNDEFINED) {
101 goto skip;
102 } else if (zip_size) {
103@@ -3066,25 +3145,6 @@
104 }
105 #endif
106
107-#ifdef XTRADB_BASED
108- if (trx_sys_sys_space(node->space->id))
109-#else
110- if (node->space->id == 0)
111-#endif
112- {
113- char *next, *p;
114- /* system datafile "/fullpath/datafilename.ibd" or "./datafilename.ibd" */
115- p = node->name;
116- while ((next = strstr(p, SRV_PATH_SEPARATOR_STR)) != NULL)
117- {
118- p = next + 1;
119- }
120- strncpy(dst_name, p, sizeof(dst_name));
121- } else {
122- /* file per table style "./database/table.ibd" */
123- strncpy(dst_name, node->name, sizeof(dst_name));
124- }
125-
126 if (xtrabackup_incremental) {
127 /* allocate buffer for incremental backup (4096 pages) */
128 incremental_buffer_base = ut_malloc((UNIV_PAGE_SIZE_MAX / 4 + 1)
129@@ -3106,33 +3166,6 @@
130 } else
131 info.page_size = 0;
132
133- /* open src_file*/
134- if (!node->open) {
135- src_file = xb_file_create_no_error_handling(node->name,
136- OS_FILE_OPEN,
137- OS_FILE_READ_ONLY,
138- &success);
139- if (!success) {
140- /* The following call prints an error message */
141- os_file_get_last_error(TRUE);
142-
143- msg("[%02u] xtrabackup: Warning: cannot open %s\n"
144- "[%02u] xtrabackup: Warning: We assume the "
145- "table was dropped or renamed during "
146- "xtrabackup execution and ignore the file.\n",
147- thread_n, node->name, thread_n);
148- goto skip;
149- }
150-
151- xb_file_set_nocache(src_file, node->name, "OPEN");
152- } else {
153- src_file = node->handle;
154- }
155-
156-#ifdef USE_POSIX_FADVISE
157- posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);
158-#endif
159-
160 if (my_stat(node->name, &src_stat, MYF(MY_WME)) == NULL) {
161 msg("[%02u] xtrabackup: Warning: cannot stat %s\n",
162 thread_n, node->name);

Subscribers

People subscribed via source and target branches