• unknown's avatar
    WL#3072 Maria recovery · e27890ca
    unknown authored
    * create page cache before initializing engine and not after, because
    Maria's recovery needs a page cache
    * make the creation of a bitmap page more crash-resistent
    * bugfix (see ma_blockrec.c)
    * back to old way: create an 8k bitmap page when creating table
    * preparations for the UNDO phase: recreate TRNs
    * preparations for Checkpoint: list of dirty pages, testing
    of rec_lsn to know if page should be skipped during Recovery
    (unused in this patch as no Checkpoint module pushed yet)
    * maria_chk tags repaired table with a special LSN
    * reworking all around in ma_recovery.c (less duplication)
    
    
    mysys/my_realloc.c:
      noted an issue in my_realloc()
    sql/mysqld.cc:
      page cache needs to be created before engines are initialized,
      because Maria's initialization may do a recovery which needs
      the page cache.
    storage/maria/ha_maria.cc:
      update to new prototype
    storage/maria/ma_bitmap.c:
      when creating the first bitmap page we used chsize to 8192 bytes then 
      pwrite (overwrite) the last 2 bytes (8191-8192). If crash between
      the two operations, this leaves a bitmap page full without its end
      marker. A later recovery may try to read this page and find it
      exists and misses a marker and conclude it's corrupted and fail.
      Changing the chsize to only 8190 bytes: recovery will then find
      the page is too short and recreate it entirely.
    storage/maria/ma_blockrec.c:
      Fix for a bug: when executing a REDO, if the data page is created,
      data_file_length was increased before _ma_bitmap_set():
      _ma_bitmap_set() called _ma_read_bitmap_page() which, due to the
      increased data_file_length, expected to find a bitmap page on disk
      with a correct end marker; if the bitmap page didn't exist already
      in fact, this failed. Fixed by increasing data_file_length only after
      _ma_read_bitmap_page() has created the new bitmap page correctly.
      This bug could happen every time a REDO is about creating a new
      bitmap page.
    storage/maria/ma_check.c:
      empty data file has a bitmap page
    storage/maria/ma_control_file.c:
      useless parameter to ma_control_file_create_or_open(), just
      test if this is recovery.
    storage/maria/ma_control_file.h:
      new prototype
    storage/maria/ma_create.c:
      Back to how it was before: maria_create() creates an 8k bitmap page.
      Thus (bugfix) data_file_length needs to reflect this instead of being 0.
    storage/maria/ma_loghandler.c:
      as ma_test1 and ma_test2 now use real transactions and not
      dummy_transaction_object, REDO for INSERT/UPDATE/DELETE are always
      about real transactions, can assert this.
      A function for Recovery to assign a short id to a table.
    storage/maria/ma_loghandler.h:
      new function
    storage/maria/ma_loghandler_lsn.h:
      maria_chk tags repaired tables with this LSN
    storage/maria/ma_open.c:
      * enforce that DMLs on transactional tables use real transactions
      and not dummy_transaction_object.
      * test if table was repaired with maria_chk (which has to been
      seen as an import of an external table into the server), test
      validity of create_rename_lsn (header corruption detection)
      * comments.
    storage/maria/ma_recovery.c:
      * preparations for the UNDO phase: recreate TRNs
      * preparations for Checkpoint: list of dirty pages, testing
      of rec_lsn to know if page should be skipped during Recovery
      (unused in this patch as no Checkpoint module pushed yet)
      * reworking all around (less duplication)
    storage/maria/ma_recovery.h:
      a parameter to say if the UNDO phase should be skipped
    storage/maria/maria_chk.c:
      tag repaired tables with a special LSN
    storage/maria/maria_read_log.c:
      * update to new prototype
      * no UNDO phase in maria_read_log for now
    storage/maria/trnman.c:
      * a function for Recovery to create a transaction (TRN), needed
      in the UNDO phase
      * a function for Recovery to grab an existing transaction, needed
      in the UNDO phase (rollback all existing transactions)
    storage/maria/trnman_public.h:
      new functions
    e27890ca
ma_loghandler.h 11.6 KB