• Guilhem Bichot's avatar
    Fix for BUG#41493 "Maria: two recovery failures (wrong logging of BLOB pages)"... · a955efc4
    Guilhem Bichot authored
    Fix for BUG#41493 "Maria: two recovery failures (wrong logging of BLOB pages)" and some more debugging
    output related to this.
    
    mysql-test/suite/maria/r/maria-recovery3.result:
      result update
    mysql-test/suite/maria/t/maria-recovery3.test:
      Test for bug; before the fix, the "CHECK TABLE EXTENDED" would mention a bad bitmap, because the
      REDO_INSERT_ROW_BLOBS was containing a page number which was actually the one of a tail, so execution of this
      record would mark the tail page as full in bitmap (like if it were a blob page), though it wasn't full.
      Also, the assertion added around ma_blockrec.c:6580 in the present revision fired.
    storage/maria/ma_blockrec.c:
      - fix for BUG#41493: if we found out that logging was not needed at this point (blob_length==0 i.e. tail page),
      then we forgot to increment tmp_block, so in the second iteration (assuming two BLOB columns), we would log the
      page range of the first iteration (i.e. the tail page's number) for this second BLOB, which would cause
      Recovery to overwrite the tail page with the second BLOB.
      - assert when marking the table corrupted during REDO phase; this catches some problems earlier
      otherwise they get caught only when a later record wants to use the table.
      - _ma_apply_redo_insert_row_blobs() now fills some synthetic info about the blobs and pages involved
      in a REDO_INSERT_ROW_BLOBS record, for inclusion into maria_recovery.trace: number of blobs, of ranges,
      first and last page (does not tell about any gaps in the middle, but good enough for now). It also asserts
      that it's not overwriting a tail/head page (which happened in the bug).
    storage/maria/ma_blockrec.h:
      new prototype for _ma_apply_redo_insert_row_blobs
    storage/maria/ma_recovery.c:
      Print info got from _ma_apply_redo_insert_row_blobs() to maria_recovery.trace (so far this file had mentioned
      what head and tail pages a record touched, but not blob pages).
    a955efc4
ma_blockrec.h 13.3 KB