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
=== modified file 'xtrabackup.c'
--- xtrabackup.c 2012-03-27 01:07:43 +0000
+++ xtrabackup.c 2012-05-30 09:26:29 +0000
@@ -2577,6 +2577,38 @@
2577}2577}
25782578
25792579
2580#ifdef INNODB_VERSION_SHORT
2581/***********************************************************************
2582Reads the space flags from a given data file and returns the compressed
2583page size, or 0 if the space is not compressed. */
2584static
2585ulint
2586xb_get_zip_size(os_file_t file)
2587{
2588 byte *buf;
2589 byte *page;
2590 ulint zip_size = ULINT_UNDEFINED;
2591 ibool success;
2592 ulint space;
2593
2594 buf = ut_malloc(2 * UNIV_PAGE_SIZE_MAX);
2595 page = ut_align(buf, UNIV_PAGE_SIZE_MAX);
2596
2597 success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE_MAX);
2598 if (!success) {
2599 goto end;
2600 }
2601
2602 space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
2603 zip_size = (space == 0 ) ? 0 :
2604 dict_table_flags_to_zip_size(fsp_header_get_flags(page));
2605end:
2606 ut_free(buf);
2607
2608 return(zip_size);
2609}
2610#endif
2611
2580/* TODO: We may tune the behavior (e.g. by fil_aio)*/2612/* TODO: We may tune the behavior (e.g. by fil_aio)*/
2581#define COPY_CHUNK 642613#define COPY_CHUNK 64
25822614
@@ -2703,28 +2735,6 @@
2703 }2735 }
27042736
2705skip_filter:2737skip_filter:
2706#ifndef INNODB_VERSION_SHORT
2707 page_size = UNIV_PAGE_SIZE;
2708 page_size_shift = UNIV_PAGE_SIZE_SHIFT;
2709#else
2710 zip_size = fil_space_get_zip_size(node->space->id);
2711 if (zip_size == ULINT_UNDEFINED) {
2712 goto skip;
2713 } else if (zip_size) {
2714 page_size = zip_size;
2715 page_size_shift = get_bit_shift(page_size);
2716 fprintf(stderr, "[%02u] %s is compressed with page size = "
2717 "%lu bytes\n", thread_n, node->name, page_size);
2718 if (page_size_shift < 10 || page_size_shift > 14) {
2719 fprintf(stderr, "[%02u] xtrabackup: Error: Invalid "
2720 "page size.\n", thread_n);
2721 ut_error;
2722 }
2723 } else {
2724 page_size = UNIV_PAGE_SIZE;
2725 page_size_shift = UNIV_PAGE_SIZE_SHIFT;
2726 }
2727#endif
27282738
2729#ifdef XTRADB_BASED2739#ifdef XTRADB_BASED
2730 if (trx_sys_sys_space(node->space->id))2740 if (trx_sys_sys_space(node->space->id))
@@ -2745,26 +2755,6 @@
2745 sprintf(dst_path, "%s%s", xtrabackup_target_dir, strstr(node->name, SRV_PATH_SEPARATOR_STR));2755 sprintf(dst_path, "%s%s", xtrabackup_target_dir, strstr(node->name, SRV_PATH_SEPARATOR_STR));
2746 }2756 }
27472757
2748 if (xtrabackup_incremental) {
2749 /* allocate buffer for incremental backup (4096 pages) */
2750 incremental_buffer_base = ut_malloc((UNIV_PAGE_SIZE_MAX / 4 + 1)
2751 * UNIV_PAGE_SIZE_MAX);
2752 incremental_buffer = ut_align(incremental_buffer_base,
2753 UNIV_PAGE_SIZE_MAX);
2754
2755 snprintf(meta_path, sizeof(meta_path),
2756 "%s%s", dst_path, XB_DELTA_INFO_SUFFIX);
2757 strcat(dst_path, ".delta");
2758
2759 /* clear buffer */
2760 bzero(incremental_buffer, (page_size/4) * page_size);
2761 page_in_buffer = 0;
2762 mach_write_to_4(incremental_buffer, 0x78747261UL);/*"xtra"*/
2763 page_in_buffer++;
2764
2765 info.page_size = page_size;
2766 }
2767
2768 /* open src_file*/2758 /* open src_file*/
2769 if (!node->open) {2759 if (!node->open) {
2770 src_file = os_file_create_simple_no_error_handling(2760 src_file = os_file_create_simple_no_error_handling(
@@ -2798,6 +2788,49 @@
2798 posix_fadvise(src_file, 0, 0, POSIX_FADV_DONTNEED);2788 posix_fadvise(src_file, 0, 0, POSIX_FADV_DONTNEED);
2799#endif2789#endif
28002790
2791#ifndef INNODB_VERSION_SHORT
2792 page_size = UNIV_PAGE_SIZE;
2793 page_size_shift = UNIV_PAGE_SIZE_SHIFT;
2794#else
2795 zip_size = xb_get_zip_size(src_file);
2796 if (zip_size == ULINT_UNDEFINED) {
2797 goto skip;
2798 } else if (zip_size) {
2799 page_size = zip_size;
2800 page_size_shift = get_bit_shift(page_size);
2801 fprintf(stderr, "[%02u] %s is compressed with page size = "
2802 "%lu bytes\n", thread_n, node->name, page_size);
2803 if (page_size_shift < 10 || page_size_shift > 14) {
2804 fprintf(stderr, "[%02u] xtrabackup: Error: Invalid "
2805 "page size.\n", thread_n);
2806 ut_error;
2807 }
2808 } else {
2809 page_size = UNIV_PAGE_SIZE;
2810 page_size_shift = UNIV_PAGE_SIZE_SHIFT;
2811 }
2812#endif
2813
2814 if (xtrabackup_incremental) {
2815 /* allocate buffer for incremental backup (4096 pages) */
2816 incremental_buffer_base = ut_malloc((UNIV_PAGE_SIZE_MAX / 4 + 1)
2817 * UNIV_PAGE_SIZE_MAX);
2818 incremental_buffer = ut_align(incremental_buffer_base,
2819 UNIV_PAGE_SIZE_MAX);
2820
2821 snprintf(meta_path, sizeof(meta_path),
2822 "%s%s", dst_path, XB_DELTA_INFO_SUFFIX);
2823 strcat(dst_path, ".delta");
2824
2825 /* clear buffer */
2826 bzero(incremental_buffer, (page_size/4) * page_size);
2827 page_in_buffer = 0;
2828 mach_write_to_4(incremental_buffer, 0x78747261UL);/*"xtra"*/
2829 page_in_buffer++;
2830
2831 info.page_size = page_size;
2832 }
2833
2801 /* open dst_file */2834 /* open dst_file */
2802 /* os_file_create reads srv_unix_file_flush_method */2835 /* os_file_create reads srv_unix_file_flush_method */
2803 dst_file = os_file_create(2836 dst_file = os_file_create(

Subscribers

People subscribed via source and target branches