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

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 340
Proposed branch: lp:~akopytov/percona-xtrabackup/bug713267-1.6
Merge into: lp:percona-xtrabackup/1.6
Diff against target: 148 lines (+75/-42)
1 file modified
xtrabackup.c (+75/-42)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug713267-1.6
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+107940@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :
Revision history for this message
Alexey Kopytov (akopytov) wrote :

issue #19179

Revision history for this message
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 'xtrabackup.c'
2--- xtrabackup.c 2012-03-27 01:07:43 +0000
3+++ xtrabackup.c 2012-05-30 09:26:29 +0000
4@@ -2577,6 +2577,38 @@
5 }
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@@ -2703,28 +2735,6 @@
44 }
45
46 skip_filter:
47-#ifndef INNODB_VERSION_SHORT
48- page_size = UNIV_PAGE_SIZE;
49- page_size_shift = UNIV_PAGE_SIZE_SHIFT;
50-#else
51- zip_size = fil_space_get_zip_size(node->space->id);
52- if (zip_size == ULINT_UNDEFINED) {
53- goto skip;
54- } else if (zip_size) {
55- page_size = zip_size;
56- page_size_shift = get_bit_shift(page_size);
57- fprintf(stderr, "[%02u] %s is compressed with page size = "
58- "%lu bytes\n", thread_n, node->name, page_size);
59- if (page_size_shift < 10 || page_size_shift > 14) {
60- fprintf(stderr, "[%02u] xtrabackup: Error: Invalid "
61- "page size.\n", thread_n);
62- ut_error;
63- }
64- } else {
65- page_size = UNIV_PAGE_SIZE;
66- page_size_shift = UNIV_PAGE_SIZE_SHIFT;
67- }
68-#endif
69
70 #ifdef XTRADB_BASED
71 if (trx_sys_sys_space(node->space->id))
72@@ -2745,26 +2755,6 @@
73 sprintf(dst_path, "%s%s", xtrabackup_target_dir, strstr(node->name, SRV_PATH_SEPARATOR_STR));
74 }
75
76- if (xtrabackup_incremental) {
77- /* allocate buffer for incremental backup (4096 pages) */
78- incremental_buffer_base = ut_malloc((UNIV_PAGE_SIZE_MAX / 4 + 1)
79- * UNIV_PAGE_SIZE_MAX);
80- incremental_buffer = ut_align(incremental_buffer_base,
81- UNIV_PAGE_SIZE_MAX);
82-
83- snprintf(meta_path, sizeof(meta_path),
84- "%s%s", dst_path, XB_DELTA_INFO_SUFFIX);
85- strcat(dst_path, ".delta");
86-
87- /* clear buffer */
88- bzero(incremental_buffer, (page_size/4) * page_size);
89- page_in_buffer = 0;
90- mach_write_to_4(incremental_buffer, 0x78747261UL);/*"xtra"*/
91- page_in_buffer++;
92-
93- info.page_size = page_size;
94- }
95-
96 /* open src_file*/
97 if (!node->open) {
98 src_file = os_file_create_simple_no_error_handling(
99@@ -2798,6 +2788,49 @@
100 posix_fadvise(src_file, 0, 0, POSIX_FADV_DONTNEED);
101 #endif
102
103+#ifndef INNODB_VERSION_SHORT
104+ page_size = UNIV_PAGE_SIZE;
105+ page_size_shift = UNIV_PAGE_SIZE_SHIFT;
106+#else
107+ zip_size = xb_get_zip_size(src_file);
108+ if (zip_size == ULINT_UNDEFINED) {
109+ goto skip;
110+ } else if (zip_size) {
111+ page_size = zip_size;
112+ page_size_shift = get_bit_shift(page_size);
113+ fprintf(stderr, "[%02u] %s is compressed with page size = "
114+ "%lu bytes\n", thread_n, node->name, page_size);
115+ if (page_size_shift < 10 || page_size_shift > 14) {
116+ fprintf(stderr, "[%02u] xtrabackup: Error: Invalid "
117+ "page size.\n", thread_n);
118+ ut_error;
119+ }
120+ } else {
121+ page_size = UNIV_PAGE_SIZE;
122+ page_size_shift = UNIV_PAGE_SIZE_SHIFT;
123+ }
124+#endif
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+ * UNIV_PAGE_SIZE_MAX);
130+ incremental_buffer = ut_align(incremental_buffer_base,
131+ UNIV_PAGE_SIZE_MAX);
132+
133+ snprintf(meta_path, sizeof(meta_path),
134+ "%s%s", dst_path, XB_DELTA_INFO_SUFFIX);
135+ strcat(dst_path, ".delta");
136+
137+ /* clear buffer */
138+ bzero(incremental_buffer, (page_size/4) * page_size);
139+ page_in_buffer = 0;
140+ mach_write_to_4(incremental_buffer, 0x78747261UL);/*"xtra"*/
141+ page_in_buffer++;
142+
143+ info.page_size = page_size;
144+ }
145+
146 /* open dst_file */
147 /* os_file_create reads srv_unix_file_flush_method */
148 dst_file = os_file_create(

Subscribers

People subscribed via source and target branches