Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-18611

mariabackup silently ended during xtrabackup_copy_logfile()

    Details

    • Type: Bug
    • Status: In Progress (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.2, 10.4, 10.3.11
    • Fix Version/s: 10.2, 10.3, 10.4
    • Component/s: mariabackup
    • Labels:
      None

      Description

      Mariabackup silently stopped in some cases.

      Regarding an analysis from Vladislav Lesin , it will be happen, if

      log_sys.log.read_log_seg() returns 0, even if there was something wring during reading.

      Variant 1:
      log_sys.log.read_log_seg() returned true, but lsn == start_lsn.

      ) log_sys.log.read_log_seg() returned true, but lsn == start_lsn. If we look into log_t::files::read_log_seg(), we will see that the function can silently return true and do not advance lsn on the following condition:
      === log_t::files::read_log_seg()
      if (block_number != log_block_convert_lsn_to_no(*start_lsn)) {
      /* Garbage or an incompletely written log block.
      We will not report any error, because this can
      happen when InnoDB was killed while it was
      writing redo log. We simply treat this as an
      abrupt end of the redo log. */
      end_lsn = *start_lsn;
      break;
      }
      

      Variant 2:

      Downloaded buffer is unequal to expected datasize.

       
      === log_t::files::read_log_seg()
      if (dl < LOG_BLOCK_HDR_SIZE
      || (dl > OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE
      && dl != OS_FILE_LOG_BLOCK_SIZE)) {
      recv_sys->found_corrupt_log = true;
      end_lsn = *start_lsn;
      break;
      }
      === log_t::files::read_log_seg()
      

      But in this case the flag about corrupted log is set.

      Suggested fix from Vladislav Lesin

       
      ===
      --- a/extra/mariabackup/xtrabackup.cc
      +++ b/extra/mariabackup/xtrabackup.cc
      @@ -2728,13 +2728,19 @@ static bool xtrabackup_copy_logfile(bool last = false)
      lsn_t lsn= start_lsn;
      for (int retries= 0; retries < 100; retries++) {
      if (log_sys.log.read_log_seg(&lsn, end_lsn)
      - || lsn != start_lsn) {
      + && lsn != start_lsn) {
      break;
      }
      msg("Retrying read of log at LSN=" LSN_PF "\n", lsn);
      my_sleep(1000);
      }
       
      + if (recv_sys->found_corrupt_log) {
      + msg("mariabackup: Error: xtrabackup_copy_logfile()"
      + " found corrupted log.\n");
      + exit(EXIT_FAILURE);
      + }
      +
      start_lsn = (lsn == start_lsn)
      ? 0 : xtrabackup_copy_log(start_lsn, lsn, last);
       
      ===
      

        Attachments

          Activity

            People

            • Assignee:
              vlad.lesin Vladislav Lesin
              Reporter:
              Richard Richard Stracke
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: