diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-05-18 10:34:38 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2022-05-18 10:34:38 +0200 |
commit | 99a433ed1cc2cebad93d6ece2b65691f2f49d3ea (patch) | |
tree | e7fc16ab8fe9b4b9ff486d1adbc27ed84c72b923 /extra | |
parent | 0a1d9d0681fda7595c0d08038357b56cf3bea9eb (diff) | |
parent | b2187662bcba12b66667bc0531727453b3b8a666 (diff) | |
download | mariadb-git-99a433ed1cc2cebad93d6ece2b65691f2f49d3ea.tar.gz |
Merge branch '10.6' into 10.7mariadb-10.7.4
Diffstat (limited to 'extra')
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 76a1d88e56c..528dbaac898 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -51,6 +51,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include <my_getopt.h> #include <mysql_com.h> #include <my_default.h> +#include <scope.h> #include <sql_class.h> #include <fcntl.h> @@ -4603,13 +4604,6 @@ fail: } - if (auto b = aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) { - field_ref_zero = static_cast<byte*>( - memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); - } else { - goto fail; - } - { /* definition from recv_recovery_from_checkpoint_start() */ ulint max_cp_field; @@ -4626,10 +4620,6 @@ reread_log_header: msg("Error: cannot read redo log header"); unlock_and_fail: mysql_mutex_unlock(&log_sys.mutex); -free_and_fail: - aligned_free(const_cast<byte*>(field_ref_zero)); - field_ref_zero = nullptr; - goto fail; } if (log_sys.log.format == 0) { @@ -4655,7 +4645,7 @@ free_and_fail: xtrabackup_init_datasinks(); if (!select_history()) { - goto free_and_fail; + goto fail; } /* open the log file */ @@ -4664,7 +4654,7 @@ free_and_fail: if (dst_log_file == NULL) { msg("Error: failed to open the target stream for '%s'.", LOG_FILE_NAME); - goto free_and_fail; + goto fail; } /* label it */ @@ -4702,7 +4692,7 @@ free_and_fail: if (ds_write(dst_log_file, log_hdr_buf, LOG_FILE_HDR_SIZE)) { msg("error: write to logfile failed"); aligned_free(log_hdr_buf); - goto free_and_fail; + goto fail; } aligned_free(log_hdr_buf); @@ -4723,7 +4713,7 @@ free_and_fail: " error %s.", ut_strerr(err)); fail_before_log_copying_thread_start: log_copying_running = false; - goto free_and_fail; + goto fail; } /* copy log file by current position */ @@ -4746,7 +4736,7 @@ fail_before_log_copying_thread_start: /* FLUSH CHANGED_PAGE_BITMAPS call */ if (!flush_changed_page_bitmaps()) { - goto free_and_fail; + goto fail; } ut_a(xtrabackup_parallel > 0); @@ -4814,9 +4804,6 @@ fail_before_log_copying_thread_start: if (opt_log_innodb_page_corruption) ok = corrupted_pages.print_to_file(MB_CORRUPTED_PAGES_FILE); - aligned_free(const_cast<byte*>(field_ref_zero)); - field_ref_zero = nullptr; - if (!ok) { goto fail; } @@ -7004,6 +6991,20 @@ static int main_low(char** argv) } } + ut_ad(!field_ref_zero); + if (auto b = aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) { + field_ref_zero = static_cast<byte*>( + memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); + } else { + msg("Can't allocate memory for field_ref_zero"); + return EXIT_FAILURE; + } + + auto _ = make_scope_exit([]() { + aligned_free(const_cast<byte*>(field_ref_zero)); + field_ref_zero = nullptr; + }); + /* --backup */ if (xtrabackup_backup && !xtrabackup_backup_func()) { return(EXIT_FAILURE); |