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

Incorrect undo logging for indexes on virtual columns whose index ID does not fit in 32 bits

    XMLWordPrintable

Details

    Description

      MySQL 8.0.42 includes the following change:
      Bug #36993445 virtual index unstable after rollback when index_id is greater than max uint32 (fixup)
      This fixes an old bug that had been introduced in MySQL 5.7. I knew about that at least since 2016 (and in 2020 as part of fixing MDEV-23672 we added FIXME comments about it) but I was reluctant to fix it, because I wanted to preserve compatibility with MySQL 5.7 data files.

      The fix in MySQL 8.0.42 is changing the encoding, The original variable-length encoding was as follows:

      encoding range
      0b0xxxxxxx 0‥(1<<7)-1
      0b10xxxxxxxxxxxxxx 1<<8…(1<<14)-1
      0b110xxxxxxxxxxxxxxxxxxxxx 1<<14…(1<<21)-1
      0b1110xxxxxxxxxxxxxxxxxxxxxxxxxxxx 1<<21‥(1<<28)-1
      0b11110000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1<<28‥(1<<32)-1

      The fix is replacing mach_write_compressed() with mach_u64_write_much_compressed(), which produces an identical encoding for 32-bit unsigned values. Any 64-bit unsigned integer that does not fit in 32 bits would be encoded as the octet 0xff followed by two the variable-length encoded 32-bit halves of the integer. This encoding would occupy 1+2·3 to 1+2·5 bytes (4 to 11 bytes). So, instead of the original 1‥5-byte encoding we would encode 1‥11 bytes.

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              1 Vote for this issue
              Watchers:
              3 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.