Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.11, 11.4, 11.8
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
- blocks
-
MDEV-36614 Merge applicable changes from InnoDB 8.0.42
-
- Closed
-
- relates to
-
MDEV-5800 indexes on virtual (not materialized) columns
-
- Closed
-
- links to