Commit 27309fc6 authored by Vlad Lesin's avatar Vlad Lesin

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.
parent 4849d94f
......@@ -4524,32 +4524,32 @@ static bool xtrabackup_backup_func()
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()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment