mariadb/storage
Marko Mäkelä c391fb1ff1 MDEV-35577 Broken recovery after SET GLOBAL innodb_log_file_size
If InnoDB is killed in such a way that there had been no writes
to a newly resized ib_logfile101 after it replaced ib_logfile0
in log_t::write_checkpoint(), it is possible that recovery will
accidentally interpret some garbage at the end of the log as valid.

log_t::write_buf(): To prevent the corruption, write an extra NUL byte
at the end of log_sys.resize_buf, like we always did for the main
log_sys.buf. To remove some conditional branches from a time critical
code path, we instantiate a separate template for the rare case that the
log is being resized. Define as __attribute__((always_inline)) so that
this will be inlined also in the rare case the log is being resized.

log_t::writer: Pointer to the current implementation of
log_t::write_buf(). For quick access, this is located in the
same cache line with log_sys.latch, which protects it.

log_t::writer_update(): Update log_sys.writer.

log_t::resize_write_buf(): Remove ATTRIBUTE_NOINLINE ATTRIBUTE_COLD.
Now that log_t::write_buf() will be instantiated separately for the
rare case of log resizing being in progress, there is no need to forbid
this code from being inlined.

Thanks to Thirunarayanan Balathandayuthapani for finding the
root cause of this bug and suggesting the fix of writing an extra
NUL byte.

Reviewed by: Debarun Banerjee
2024-12-16 11:50:00 +02:00
..
archive
blackhole MDEV-34348: my_hash_get_key fixes 2024-11-23 08:14:22 -07:00
columnstore
connect Merge 10.6 -> 10.11 2024-12-05 10:11:58 +01:00
csv Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
example
federated Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
federatedx Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
heap Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
innobase MDEV-35577 Broken recovery after SET GLOBAL innodb_log_file_size 2024-12-16 11:50:00 +02:00
maria Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
mroonga Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
myisam Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
myisammrg Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
oqgraph Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
perfschema Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
rocksdb Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
sequence
sphinx Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
spider Merge 10.6 -> 10.11 2024-12-05 10:11:58 +01:00
test_sql_discovery