Skip to content

Commit

Permalink
MDEV-14536 : In mariabackup, reread redo log blocks , if checksum mis…
Browse files Browse the repository at this point in the history
…match

is detected.

The checksum mismatch can be due to partial write, thus retry the read
  • Loading branch information
vaintroub committed Nov 29, 2017
1 parent 40756c9 commit bf6d11c
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions extra/mariabackup/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2555,8 +2555,9 @@ xtrabackup_scan_log_recs(
to this lsn */
lsn_t* group_scanned_lsn,/*!< out: scanning succeeded up to
this lsn */
bool* finished) /*!< out: false if is not able to scan
bool* finished, /*!< out: false if is not able to scan
any more in this log group */
bool* must_reread_log) /*!< out: should re-read buffer from disk, incomplete read*/
{
lsn_t scanned_lsn;
ulint data_len;
Expand All @@ -2566,6 +2567,7 @@ xtrabackup_scan_log_recs(
ulint scanned_checkpoint_no = 0;

*finished = false;
*must_reread_log = false;
scanned_lsn = start_lsn;
log_block = log_sys->buf;

Expand Down Expand Up @@ -2622,8 +2624,10 @@ xtrabackup_scan_log_recs(
msg("mariabackup: warning: this is possible when the "
"log block has not been fully written by the "
"server, will retry later.\n");
*finished = true;
break;
*finished = false;
*must_reread_log = true;
my_sleep(1000);
return false;
}

if (log_block_get_flush_bit(log_block)) {
Expand Down Expand Up @@ -2735,14 +2739,23 @@ xtrabackup_copy_logfile(lsn_t from_lsn, my_bool is_last)

mutex_enter(&log_sys->mutex);

log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
group, start_lsn, end_lsn, false);
bool scan_ok = false;
bool must_reread_log;
int retries = 0;
do {

log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
group, start_lsn, end_lsn, false);

if (!xtrabackup_scan_log_recs(group, is_last,
start_lsn, &contiguous_lsn, &group_scanned_lsn,
&finished)) {
scan_ok = xtrabackup_scan_log_recs(group, is_last,
start_lsn, &contiguous_lsn, &group_scanned_lsn,
&finished, &must_reread_log);

} while (!scan_ok && must_reread_log && retries++ < 100);

if (!scan_ok) {
goto error;
}
}

mutex_exit(&log_sys->mutex);

Expand Down

0 comments on commit bf6d11c

Please sign in to comment.