diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-07-22 10:11:08 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-07-22 10:11:08 +0300 |
commit | 641f09398fdc37c6f3b0ec6731d5f246ecf24866 (patch) | |
tree | 0c6e4a290119928a42ad6ffe9d4bdb372d5482f1 /extra | |
parent | f43370baf3b00733ddfe0f704520a07092fc9a0e (diff) | |
parent | 82d5994520c239da1b6edf1b24e08138ae0c753d (diff) | |
download | mariadb-git-641f09398fdc37c6f3b0ec6731d5f246ecf24866.tar.gz |
Merge 10.5 into 10.6
Diffstat (limited to 'extra')
-rw-r--r-- | extra/innochecksum.cc | 3 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 37 |
2 files changed, 30 insertions, 10 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index 3b12e3e24ca..6ca68c47834 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -94,6 +94,9 @@ FILE* log_file = NULL; /* Enabled for log write option. */ static bool is_log_enabled = false; +static byte field_ref_zero_buf[UNIV_PAGE_SIZE_MAX]; +const byte *field_ref_zero = field_ref_zero_buf; + #ifndef _WIN32 /* advisory lock for non-window system. */ struct flock lk; diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 0b0cd5f55e3..6e321dcb436 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4479,6 +4479,14 @@ fail: goto 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; @@ -4493,14 +4501,17 @@ reread_log_header: if (err != DB_SUCCESS) { 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) { msg("Error: cannot process redo log before MariaDB 10.2.2"); - mysql_mutex_unlock(&log_sys.mutex); - goto fail; + goto unlock_and_fail; } byte* buf = log_sys.checkpoint_buf; @@ -4521,7 +4532,7 @@ reread_log_header: xtrabackup_init_datasinks(); if (!select_history()) { - goto fail; + goto free_and_fail; } /* open the log file */ @@ -4530,12 +4541,13 @@ reread_log_header: if (dst_log_file == NULL) { msg("Error: failed to open the target stream for '%s'.", LOG_FILE_NAME); - goto fail; + goto free_and_fail; } /* label it */ - byte MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) log_hdr_buf[LOG_FILE_HDR_SIZE]; - memset(log_hdr_buf, 0, sizeof log_hdr_buf); + byte* log_hdr_buf = static_cast<byte*>( + aligned_malloc(LOG_FILE_HDR_SIZE, OS_FILE_LOG_BLOCK_SIZE)); + memset(log_hdr_buf, 0, LOG_FILE_HDR_SIZE); byte *log_hdr_field = log_hdr_buf; mach_write_to_4(LOG_HEADER_FORMAT + log_hdr_field, log_sys.log.format); @@ -4564,11 +4576,13 @@ reread_log_header: log_block_calc_checksum_crc32(log_hdr_field)); /* Write log header*/ - if (ds_write(dst_log_file, log_hdr_buf, sizeof(log_hdr_buf))) { + if (ds_write(dst_log_file, log_hdr_buf, LOG_FILE_HDR_SIZE)) { msg("error: write to logfile failed"); - goto fail; + aligned_free(log_hdr_buf); + goto free_and_fail; } + aligned_free(log_hdr_buf); log_copying_running = true; /* start io throttle */ if(xtrabackup_throttle) { @@ -4586,7 +4600,7 @@ reread_log_header: " error %s.", ut_strerr(err)); fail_before_log_copying_thread_start: log_copying_running = false; - goto fail; + goto free_and_fail; } /* copy log file by current position */ @@ -4609,7 +4623,7 @@ fail_before_log_copying_thread_start: /* FLUSH CHANGED_PAGE_BITMAPS call */ if (!flush_changed_page_bitmaps()) { - goto fail; + goto free_and_fail; } ut_a(xtrabackup_parallel > 0); @@ -4677,6 +4691,9 @@ 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; } |