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

Recovery or backup of INSERT may be incorrect

    XMLWordPrintable

    Details

      Description

      Matthias Leich produced rr record traces where a child page number in a B-tree record was recovered incorrectly. The culprit seems to be an overzealous optimization:

      diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
      index dc740cad862..d37d3d85f96 100644
      --- a/storage/innobase/page/page0cur.cc
      +++ b/storage/innobase/page/page0cur.cc
      @@ -1579,8 +1579,12 @@ page_cur_insert_rec_low(
           const byte *r= rec;
           const byte *c= cur->rec;
           const byte *c_end= cur->rec + data_size;
      +    static_assert(REC_N_OLD_EXTRA_BYTES == REC_N_NEW_EXTRA_BYTES + 1, "");
           if (c <= insert_buf && c_end > insert_buf)
             c_end= insert_buf;
      +    else if (c_end < next_rec &&
      +             c_end >= next_rec - REC_N_OLD_EXTRA_BYTES + comp)
      +      c_end= next_rec - REC_N_OLD_EXTRA_BYTES + comp;
           else
             c_end= std::min<const byte*>(c_end, block->page.frame + srv_page_size -
                                          PAGE_DIR - PAGE_DIR_SLOT_SIZE *
      

      That is, we would compare the bytes of the being-inserted record to some header bytes of next_rec that were just updated by the same function, without them being written to the redo log at all.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marko Marko Mäkelä
              Reporter:
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.