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

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
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) Approve
Review via email: mp+107938@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
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
=== modified file 'src/fil_cur.c'
--- src/fil_cur.c 2012-05-25 11:38:15 +0000
+++ src/fil_cur.c 2012-05-30 09:23:28 +0000
@@ -56,34 +56,6 @@
5656
57 cursor->is_system = trx_sys_sys_space(node->space->id);57 cursor->is_system = trx_sys_sys_space(node->space->id);
5858
59 /* Determine the page size */
60#ifndef INNODB_VERSION_SHORT
61 zip_size = UNIV_PAGE_SIZE;
62 page_size = UNIV_PAGE_SIZE;
63 page_size_shift = UNIV_PAGE_SIZE_SHIFT;
64#else
65 zip_size = fil_space_get_zip_size(node->space->id);
66 if (zip_size == ULINT_UNDEFINED) {
67 return(XB_FIL_CUR_SKIP);
68 } else if (zip_size) {
69 page_size = zip_size;
70 page_size_shift = get_bit_shift(page_size);
71 msg("[%02u] %s is compressed with page size = "
72 "%lu bytes\n", thread_n, node->name, page_size);
73 if (page_size_shift < 10 || page_size_shift > 14) {
74 msg("[%02u] xtrabackup: Error: Invalid "
75 "page size: %lu.\n", thread_n, page_size);
76 ut_error;
77 }
78 } else {
79 page_size = UNIV_PAGE_SIZE;
80 page_size_shift = UNIV_PAGE_SIZE_SHIFT;
81 }
82#endif
83 cursor->page_size = page_size;
84 cursor->page_size_shift = page_size_shift;
85 cursor->zip_size = zip_size;
86
87 /* Make the file path relative to the backup root,59 /* Make the file path relative to the backup root,
88 i.e. "ibdata1" for system tablespace or database/table.ibd for60 i.e. "ibdata1" for system tablespace or database/table.ibd for
89 per-table spaces. */61 per-table spaces. */
@@ -133,7 +105,35 @@
133 cursor->file = node->handle;105 cursor->file = node->handle;
134 }106 }
135 posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);107 posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);
136 posix_fadvise(cursor->file, 0, 0, POSIX_FADV_DONTNEED);108
109 /* Determine the page size */
110#ifndef INNODB_VERSION_SHORT
111 zip_size = UNIV_PAGE_SIZE;
112 page_size = UNIV_PAGE_SIZE;
113 page_size_shift = UNIV_PAGE_SIZE_SHIFT;
114#else
115 zip_size = xb_get_zip_size(cursor->file);
116 if (zip_size == ULINT_UNDEFINED) {
117 os_file_close(cursor->file);
118 return(XB_FIL_CUR_SKIP);
119 } else if (zip_size) {
120 page_size = zip_size;
121 page_size_shift = get_bit_shift(page_size);
122 msg("[%02u] %s is compressed with page size = "
123 "%lu bytes\n", thread_n, node->name, page_size);
124 if (page_size_shift < 10 || page_size_shift > 14) {
125 msg("[%02u] xtrabackup: Error: Invalid "
126 "page size: %lu.\n", thread_n, page_size);
127 ut_error;
128 }
129 } else {
130 page_size = UNIV_PAGE_SIZE;
131 page_size_shift = UNIV_PAGE_SIZE_SHIFT;
132 }
133#endif
134 cursor->page_size = page_size;
135 cursor->page_size_shift = page_size_shift;
136 cursor->zip_size = zip_size;
137137
138 /* Allocate read buffer */138 /* Allocate read buffer */
139 cursor->buf_size = XB_FIL_CUR_PAGES * page_size;139 cursor->buf_size = XB_FIL_CUR_PAGES * page_size;
@@ -246,6 +246,8 @@
246 cursor->buf_npages++;246 cursor->buf_npages++;
247 }247 }
248248
249 posix_fadvise(cursor->file, 0, 0, POSIX_FADV_DONTNEED);
250
249 cursor->offset += page_size * i;251 cursor->offset += page_size * i;
250252
251 return(ret);253 return(ret);
252254
=== modified file 'src/xtrabackup.c'
--- src/xtrabackup.c 2012-05-25 11:38:15 +0000
+++ src/xtrabackup.c 2012-05-30 09:23:28 +0000
@@ -1626,6 +1626,37 @@
1626 return(TRUE);1626 return(TRUE);
1627}1627}
16281628
1629#ifdef INNODB_VERSION_SHORT
1630/***********************************************************************
1631Reads the space flags from a given data file and returns the compressed
1632page size, or 0 if the space is not compressed. */
1633ulint
1634xb_get_zip_size(os_file_t file)
1635{
1636 byte *buf;
1637 byte *page;
1638 ulint zip_size = ULINT_UNDEFINED;
1639 ibool success;
1640 ulint space;
1641
1642 buf = ut_malloc(2 * UNIV_PAGE_SIZE_MAX);
1643 page = ut_align(buf, UNIV_PAGE_SIZE_MAX);
1644
1645 success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE_MAX);
1646 if (!success) {
1647 goto end;
1648 }
1649
1650 space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
1651 zip_size = (space == 0 ) ? 0 :
1652 dict_table_flags_to_zip_size(fsp_header_get_flags(page));
1653end:
1654 ut_free(buf);
1655
1656 return(zip_size);
1657}
1658#endif
1659
1629/* TODO: We may tune the behavior (e.g. by fil_aio)*/1660/* TODO: We may tune the behavior (e.g. by fil_aio)*/
16301661
1631static1662static
16321663
=== modified file 'src/xtrabackup.h'
--- src/xtrabackup.h 2012-05-25 11:38:15 +0000
+++ src/xtrabackup.h 2012-05-30 09:23:28 +0000
@@ -38,4 +38,11 @@
38my_bool xb_write_delta_metadata(const char *filename,38my_bool xb_write_delta_metadata(const char *filename,
39 const xb_delta_info_t *info);39 const xb_delta_info_t *info);
4040
41#endif41#ifdef INNODB_VERSION_SHORT
42/***********************************************************************
43Reads the space flags from a given data file and returns the compressed
44page size, or 0 if the space is not compressed. */
45ulint xb_get_zip_size(os_file_t file);
46#endif /* INNODB_VERSION_SHORT */
47
48#endif /* XB_XTRABACKUP_H */

Subscribers

People subscribed via source and target branches

to all changes: