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

Recovery or backup of INSERT may be incorrect

Details

    Description

      mleich 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

            marko Marko Mäkelä created issue -
            marko Marko Mäkelä made changes -
            Field Original Value New Value
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            marko Marko Mäkelä made changes -
            Fix Version/s 10.5.17 [ 27509 ]
            Fix Version/s 10.6.9 [ 27507 ]
            Fix Version/s 10.7.5 [ 27505 ]
            Fix Version/s 10.8.4 [ 27503 ]
            Fix Version/s 10.9.2 [ 27115 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.7 [ 24805 ]
            Fix Version/s 10.8 [ 26121 ]
            Fix Version/s 10.9 [ 26905 ]
            Fix Version/s 10.10 [ 27530 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            marko Marko Mäkelä made changes -

            People

              marko Marko Mäkelä
              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.