• Marko Mäkelä's avatar
    MDEV-27931: buf_page_is_corrupted() wrongly claims corruption · 303448bc
    Marko Mäkelä authored
    In commit 437da7bc (MDEV-19534),
    the default value of the global variable srv_checksum_algorithm
    in innochecksum was changed from SRV_CHECKSUM_ALGORITHM_INNODB
    to implied 0 (innodb_checksum_algorithm=crc32). As a result,
    the function buf_page_is_corrupted() would by default invoke
    buf_calc_page_crc32() in innochecksum, and crc32_inited would hold.
    
    This would cause "innochecksum" to fail on a particular page.
    
    The actual problem is older, introduced in 2011 in
    mysql/mysql-server@17e497bdb793bc6b8360aa1c626dcd8bb5cfad1b
    (MySQL 5.6.3). It should affect the validation of pages of old
    data files that were written with innodb_checksum_algorithm=innodb.
    When using innodb_checksum_algorithm=crc32 (the default setting
    since MariaDB Server 10.2), some valid pages would be rejected
    only because exactly one of the two checksum fields accidentally
    matches the innodb_checksum_algorithm=crc32 value.
    
    buf_page_is_corrupted(): Simplify the logic of non-strict
    checksum validation, by always invoking buf_calc_page_crc32().
    Remove a bogus condition that if only one of the checksum fields
    contains the value returned by buf_calc_page_crc32(), the page
    is corrupted.
    303448bc
buf0buf.cc 202 KB