Merge lp:~laurynas-biveinis/percona-xtrabackup/bug1043762-2.1 into lp:percona-xtrabackup/2.1

Proposed by Laurynas Biveinis
Status: Work in progress
Proposed branch: lp:~laurynas-biveinis/percona-xtrabackup/bug1043762-2.1
Merge into: lp:percona-xtrabackup/2.1
Prerequisite: lp:~laurynas-biveinis/percona-xtrabackup/bug1044398-2.1
Diff against target: 179 lines (+99/-33)
2 files modified
src/write_filt.c (+1/-17)
src/xtrabackup.c (+98/-16)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-xtrabackup/bug1043762-2.1
Reviewer Review Type Date Requested Status
Percona core Pending
Review via email: mp+123248@code.launchpad.net

Description of the change

To post a comment you must log in.

Unmerged revisions

431. By Laurynas Biveinis

Merge fix for bug 1043762 from 2.0.

430. By Laurynas Biveinis

Automerge prerequisite lp:~laurynas-biveinis/percona-xtrabackup/bug1044398-2.1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/write_filt.c'
--- src/write_filt.c 2012-09-07 10:50:24 +0000
+++ src/write_filt.c 2012-09-07 10:50:24 +0000
@@ -32,21 +32,6 @@
32#include "xtrabackup.h"32#include "xtrabackup.h"
3333
34/************************************************************************34/************************************************************************
35The common tablespace-offset-based page filter. This is a subroutine for all
36other filters that will select additional pages to be written by their
37tablespace position, regardless of the main filter logic.
38
39@return TRUE if the page with given id should be selected, FALSE otherwise. */
40static my_bool wf_common_filter(ulint offset) {
41 /* We always copy the 1st FIL_IBD_INITIAL_SIZE *
42 UNIV_PAGE_SIZE bytes of any tablespace. These pages are
43 guaranteed to be flushed upon tablespace create and they are
44 needed so that we have a good minimal tablespace image before
45 doing anything further with it. */
46 return (offset < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE);
47}
48
49/************************************************************************
50Write-through page write filter. */35Write-through page write filter. */
51static my_bool wf_wt_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,36static my_bool wf_wt_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
52 xb_fil_cur_t *cursor);37 xb_fil_cur_t *cursor);
@@ -153,8 +138,7 @@
153 for (i = 0, page = cursor->buf; i < cursor->buf_npages;138 for (i = 0, page = cursor->buf; i < cursor->buf_npages;
154 i++, page += page_size) {139 i++, page += page_size) {
155 if (ut_dulint_cmp(incremental_lsn,140 if (ut_dulint_cmp(incremental_lsn,
156 MACH_READ_64(page + FIL_PAGE_LSN)) >= 0141 MACH_READ_64(page + FIL_PAGE_LSN)) >= 0) {
157 && !wf_common_filter(cursor->buf_offset + i * page_size)) {
158 continue;142 continue;
159 }143 }
160144
161145
=== modified file 'src/xtrabackup.c'
--- src/xtrabackup.c 2012-09-07 10:50:24 +0000
+++ src/xtrabackup.c 2012-09-07 10:50:24 +0000
@@ -3835,13 +3835,107 @@
3835 return TRUE;3835 return TRUE;
3836}3836}
38373837
3838/****************************************************************//**
3839Create a new tablespace on disk and return the handle to its opened
3840file. Code adopted from fil_create_new_single_table_tablespace with
3841the main difference that only disk file is created without updating
3842the InnoDB in-memory dictionary data structures.
3843
3844@return TRUE on success, FALSE on error. */
3845static
3846ibool
3847xb_delta_create_space_file(
3848/*=======================*/
3849 const char* path, /*!<in: path to tablespace */
3850 ulint space_id, /*!<in: space id */
3851 ulint flags __attribute__((unused)),/*!<in: tablespace
3852 flags */
3853 os_file_t* file) /*!<out: file handle */
3854{
3855 ibool ret;
3856 byte* buf;
3857 byte* page;
3858
3859 *file = xb_file_create_no_error_handling(path, OS_FILE_CREATE,
3860 OS_FILE_READ_WRITE, &ret);
3861 if (!ret) {
3862 msg("xtrabackup: cannot create file %s\n", path);
3863 return ret;
3864 }
3865
3866 ret = os_file_set_size(path, *file,
3867 FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE, 0);
3868 if (!ret) {
3869 msg("xtrabackup: cannot set size for file %s\n", path);
3870 os_file_close(*file);
3871 os_file_delete(path);
3872 return ret;
3873 }
3874
3875 buf = ut_malloc(3 * UNIV_PAGE_SIZE);
3876 /* Align the memory for file i/o if we might have O_DIRECT set */
3877 page = ut_align(buf, UNIV_PAGE_SIZE);
3878
3879 memset(page, '\0', UNIV_PAGE_SIZE);
3880
3881#ifdef INNODB_VERSION_SHORT
3882 fsp_header_init_fields(page, space_id, flags);
3883 mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
3884
3885 if (!(flags & DICT_TF_ZSSIZE_MASK)) {
3886 buf_flush_init_for_writing(page, NULL, 0);
3887
3888 ret = os_file_write(path, *file, page, 0, 0, UNIV_PAGE_SIZE);
3889 }
3890 else {
3891 page_zip_des_t page_zip;
3892 ulint zip_size;
3893
3894 zip_size = (PAGE_ZIP_MIN_SIZE >> 1)
3895 << ((flags & DICT_TF_ZSSIZE_MASK)
3896 >> DICT_TF_ZSSIZE_SHIFT);
3897 page_zip_set_size(&page_zip, zip_size);
3898 page_zip.data = page + UNIV_PAGE_SIZE;
3899 fprintf(stderr, "zip_size = %lu\n", zip_size);
3900
3901#ifdef UNIV_DEBUG
3902 page_zip.m_start =
3903#endif /* UNIV_DEBUG */
3904 page_zip.m_end = page_zip.m_nonempty =
3905 page_zip.n_blobs = 0;
3906
3907 buf_flush_init_for_writing(page, &page_zip, 0);
3908
3909 ret = os_file_write(path, *file, page_zip.data, 0, 0,
3910 zip_size);
3911 }
3912#else
3913 fsp_header_write_space_id(page, space_id);
3914
3915 buf_flush_init_for_writing(page, ut_dulint_zero, space_id, 0);
3916
3917 ret = os_file_write(path, *file, page, 0, 0, UNIV_PAGE_SIZE);
3918#endif
3919
3920 ut_free(buf);
3921
3922 if (!ret) {
3923 msg("xtrabackup: could not write the first page to %s\n",
3924 path);
3925 os_file_close(*file);
3926 os_file_delete(path);
3927 return ret;
3928 }
3929
3930 return TRUE;
3931}
38383932
3839/***********************************************************************3933/***********************************************************************
3840Searches for matching tablespace file for given .delta file and space_id3934Searches for matching tablespace file for given .delta file and space_id
3841in given directory. When matching tablespace found, renames it to match the3935in given directory. When matching tablespace found, renames it to match the
3842name of .delta file. If there was a tablespace with matching name and3936name of .delta file. If there was a tablespace with matching name and
3843mismatching ID, renames it to xtrabackup_tmp_#ID.ibd. If there was no3937mismatching ID, renames it to xtrabackup_tmp_#ID.ibd. If there was no
3844matching file, creates a placeholder for the new tablespace.3938matching file, creates a new tablespace.
3845@return file handle of matched or created file */3939@return file handle of matched or created file */
3846static3940static
3847os_file_t3941os_file_t
@@ -3942,12 +4036,7 @@
3942 goto found;4036 goto found;
3943 }4037 }
39444038
3945 /* No matching space found. create the new one. Note that this is not4039 /* No matching space found. create the new one. */
3946 a full-fledged tablespace create, as done by
3947 fil_create_new_single_table_tablespace(): the minumum tablespace size
3948 is not ensured and the 1st page fields are not set. We rely on backup
3949 delta to contain the 1st FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE
3950 to ensure the correct tablespace image. */
39514040
3952#ifdef INNODB_VERSION_SHORT4041#ifdef INNODB_VERSION_SHORT
3953 /* Calculate correct tablespace flags for compressed tablespaces. Do4042 /* Calculate correct tablespace flags for compressed tablespaces. Do
@@ -3977,15 +4066,8 @@
3977 goto exit;4066 goto exit;
3978 }4067 }
39794068
3980 file = xb_file_create_no_error_handling(real_name, OS_FILE_CREATE,4069 *success = xb_delta_create_space_file(real_name, space_id,
3981 OS_FILE_READ_WRITE,4070 tablespace_flags, &file);
3982 &ok);
3983
3984 if (ok) {
3985 *success = TRUE;
3986 } else {
3987 msg("xtrabackup: Cannot open file %s\n", real_name);
3988 }
39894071
3990 goto exit;4072 goto exit;
39914073

Subscribers

People subscribed via source and target branches