diff options
author | Vlad Lesin <vlad_lesin@mail.ru> | 2022-06-14 11:31:11 +0300 |
---|---|---|
committer | Vlad Lesin <vlad_lesin@mail.ru> | 2022-06-15 13:30:42 +0300 |
commit | 27309fc6b0833d7a74baab4afaeef1dcb14307c8 (patch) | |
tree | 6773fd3c93c97f2ef06467f9497469799d66862f /extra | |
parent | 4849d94fe6bd918fd3dc6dc21424681a0ab5fa02 (diff) | |
download | mariadb-git-27309fc6b0833d7a74baab4afaeef1dcb14307c8.tar.gz |
MDEV-28832 infinite loop in mariabackup if log LOG_HEADER_FORMAT field is 0
Avoid the loop with getting rid of back and forth jumping.
Diffstat (limited to 'extra')
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 13319f44969..37c80baf32f 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4524,32 +4524,32 @@ fail: reread_log_header: dberr_t err = recv_find_max_checkpoint(&max_cp_field); - if (err != DB_SUCCESS) { + if (err != DB_SUCCESS) msg("Error: cannot read redo log header"); -unlock_and_fail: - mysql_mutex_unlock(&log_sys.mutex); - } - - if (log_sys.log.format == 0) { + else if (log_sys.log.format == 0) { msg("Error: cannot process redo log before MariaDB 10.2.2"); - goto unlock_and_fail; + err = DB_ERROR; } + else { + byte* buf = log_sys.checkpoint_buf; + checkpoint_lsn_start = log_sys.log.get_lsn(); + checkpoint_no_start = log_sys.next_checkpoint_no; - byte* buf = log_sys.checkpoint_buf; - checkpoint_lsn_start = log_sys.log.get_lsn(); - checkpoint_no_start = log_sys.next_checkpoint_no; - - log_sys.log.read(max_cp_field, {buf, OS_FILE_LOG_BLOCK_SIZE}); - - 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_sys.log.read(max_cp_field, {buf, OS_FILE_LOG_BLOCK_SIZE}); + 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; + } mysql_mutex_unlock(&log_sys.mutex); + if (err != DB_SUCCESS) + goto fail; + xtrabackup_init_datasinks(); if (!select_history()) { |