diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-29 22:17:00 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-29 22:17:00 +0300 |
commit | f98bb23168ee9bc0da8aa7111f35cf2539986387 (patch) | |
tree | b7e9c3dc28e9d1fd82eebea077f3ca0aac640218 /extra | |
parent | e35676f5557d68c7b51ba47aa73dcdf72eafa436 (diff) | |
parent | e99ed820d790617a029b03d9c4ab437c246c956a (diff) | |
download | mariadb-git-f98bb23168ee9bc0da8aa7111f35cf2539986387.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'extra')
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 56653a192d3..a4b18950838 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4146,9 +4146,12 @@ reread_log_header: log_header_read(max_cp_field); - if (checkpoint_no_start != mach_read_from_8(buf + LOG_CHECKPOINT_NO)) { + if (checkpoint_no_start != mach_read_from_8(buf + LOG_CHECKPOINT_NO) + || checkpoint_lsn_start + != mach_read_from_8(buf + LOG_CHECKPOINT_LSN) + || log_sys.log.get_lsn_offset() + != mach_read_from_8(buf + LOG_CHECKPOINT_OFFSET)) goto reread_log_header; - } log_mutex_exit(); @@ -4168,42 +4171,39 @@ reread_log_header: } /* label it */ - byte MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) log_hdr[OS_FILE_LOG_BLOCK_SIZE]; - memset(log_hdr, 0, sizeof log_hdr); - mach_write_to_4(LOG_HEADER_FORMAT + log_hdr, log_sys.log.format); - mach_write_to_4(LOG_HEADER_SUBFORMAT + log_hdr, log_sys.log.subformat); - mach_write_to_8(LOG_HEADER_START_LSN + log_hdr, checkpoint_lsn_start); - strcpy(reinterpret_cast<char*>(LOG_HEADER_CREATOR + log_hdr), - "Backup " MYSQL_SERVER_VERSION); - log_block_set_checksum(log_hdr, - log_block_calc_checksum_crc32(log_hdr)); - - /* Write the log header. */ - if (ds_write(dst_log_file, log_hdr, sizeof log_hdr)) { - log_write_fail: - msg("error: write to logfile failed"); - goto fail; - } - /* Adjust the checkpoint page. */ - memcpy(log_hdr, buf, OS_FILE_LOG_BLOCK_SIZE); - mach_write_to_8(log_hdr + LOG_CHECKPOINT_OFFSET, - (checkpoint_lsn_start & (OS_FILE_LOG_BLOCK_SIZE - 1)) - | LOG_FILE_HDR_SIZE); + 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_field = log_hdr_buf; + mach_write_to_4(LOG_HEADER_FORMAT + log_hdr_field, log_sys.log.format); + mach_write_to_4(LOG_HEADER_SUBFORMAT + log_hdr_field, log_sys.log.subformat); + mach_write_to_8(LOG_HEADER_START_LSN + log_hdr_field, checkpoint_lsn_start); + strcpy(reinterpret_cast<char*>(LOG_HEADER_CREATOR + log_hdr_field), + "Backup " MYSQL_SERVER_VERSION); + log_block_set_checksum(log_hdr_field, + log_block_calc_checksum_crc32(log_hdr_field)); + + /* copied from log_group_checkpoint() */ + log_hdr_field += + (log_sys.next_checkpoint_no & 1) ? LOG_CHECKPOINT_2 : LOG_CHECKPOINT_1; /* The least significant bits of LOG_CHECKPOINT_OFFSET must be stored correctly in the copy of the ib_logfile. The most significant bits, which identify the start offset of the log block in the file, we did choose freely, as LOG_FILE_HDR_SIZE. */ ut_ad(!((log_sys.log.get_lsn() ^ checkpoint_lsn_start) & (OS_FILE_LOG_BLOCK_SIZE - 1))); - log_block_set_checksum(log_hdr, - log_block_calc_checksum_crc32(log_hdr)); - /* Write checkpoint page 1 and two empty log pages before the - payload. */ - if (ds_write(dst_log_file, log_hdr, OS_FILE_LOG_BLOCK_SIZE) - || !memset(log_hdr, 0, sizeof log_hdr) - || ds_write(dst_log_file, log_hdr, sizeof log_hdr) - || ds_write(dst_log_file, log_hdr, sizeof log_hdr)) { - goto log_write_fail; + /* Adjust the checkpoint page. */ + memcpy(log_hdr_field, log_sys.checkpoint_buf, OS_FILE_LOG_BLOCK_SIZE); + mach_write_to_8(log_hdr_field + LOG_CHECKPOINT_OFFSET, + (checkpoint_lsn_start & (OS_FILE_LOG_BLOCK_SIZE - 1)) + | LOG_FILE_HDR_SIZE); + log_block_set_checksum(log_hdr_field, + log_block_calc_checksum_crc32(log_hdr_field)); + + /* Write log header*/ + if (ds_write(dst_log_file, log_hdr_buf, sizeof(log_hdr_buf))) { + msg("error: write to logfile failed"); + goto fail; } log_copying_running = true; |