summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2019-04-08 15:08:04 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-04-08 21:33:49 +0300
commitcaa8c20abee29416c82031a8ae2f7dd23d821b10 (patch)
treedf4b58c2ca6c2c88ab28db49300c9241fb14a1b3
parent4b822111ef043286806225e903cfe4de584b2c6f (diff)
downloadmariadb-git-caa8c20abee29416c82031a8ae2f7dd23d821b10.tar.gz
MDEV-14192 Mariabackup assertion failure: byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0
xtrabackup_backup_func(): If the log checkpoint header changed since we last read it, search for the most recent checkpoint again. Otherwise, we could corrupt the backup of the redo log, because the least significant bits of checkpoint_lsn_start would not match log_sys->log.lsn.
-rw-r--r--extra/mariabackup/xtrabackup.cc31
1 files changed, 11 insertions, 20 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index b8c87f09ec1..3eca4687bbd 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -4003,9 +4003,7 @@ static bool xtrabackup_backup_low()
/** Implement --backup
@return whether the operation succeeded */
-static
-bool
-xtrabackup_backup_func()
+static bool xtrabackup_backup_func()
{
MY_STAT stat_info;
uint i;
@@ -4175,38 +4173,25 @@ fail:
log_mutex_enter();
+reread_log_header:
dberr_t err = recv_find_max_checkpoint(&max_cp_field);
if (err != DB_SUCCESS) {
-log_fail:
+ msg("Error: cannot read redo log header");
log_mutex_exit();
goto fail;
}
if (log_sys->log.format == 0) {
-old_format:
- msg("Error: cannot process redo log"
- " before MariaDB 10.2.2");
+ msg("Error: cannot process redo log before MariaDB 10.2.2");
log_mutex_exit();
- goto log_fail;
+ goto fail;
}
const byte* buf = log_sys->checkpoint_buf;
-
-reread_log_header:
checkpoint_lsn_start = log_sys->log.lsn;
checkpoint_no_start = log_sys->next_checkpoint_no;
- err = recv_find_max_checkpoint(&max_cp_field);
-
- if (err != DB_SUCCESS) {
- goto log_fail;
- }
-
- if (log_sys->log.format == 0) {
- goto old_format;
- }
-
log_group_header_read(&log_sys->log, max_cp_field);
if (checkpoint_no_start != mach_read_from_8(buf + LOG_CHECKPOINT_NO)) {
@@ -4253,6 +4238,12 @@ reread_log_header:
mach_write_to_8(log_hdr + LOG_CHECKPOINT_OFFSET,
(checkpoint_lsn_start & (OS_FILE_LOG_BLOCK_SIZE - 1))
| LOG_FILE_HDR_SIZE);
+ /* 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.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