• unknown's avatar
    Maria: · 38812255
    unknown authored
    * Don't modify share->base.born_transactional; now it is a value carved
    in stone at creation time. share->now_transactional is what can be
    modified: it starts at born_transactional, can become false during
    ALTER TABLE (when we want no logging), and restored later.
    * Not resetting create_rename_lsn to 0 during delete_all or repair.
    * when we temporarily disable transactionality, we also change
    the page type to PAGECACHE_PLAIN_PAGE: it bypasses some work in the
    page cache (optimization), and avoids assertions related to LSNs.
    * Disable INSERT DELAYED for transactional tables, because
    durability could not be guaranteed (insertion may even not happen)
    
    
    mysys/mf_keycache.c:
      comment
    storage/maria/ha_maria.cc:
      * a transactional table cannot do INSERT DELAYED
      * ha_maria::save_transactional not needed anymore, as now instead
      we don't modify MARIA_SHARE::MARIA_BASE_INFO::born_transactional
      (born_transactional plays the role of save_transactional), and modify
      MARIA_SHARE::now_transactional.
      * REPAIR_TABLE log record is now logged by maria_repair()
      * comment why we rely on born_transactional to know if we should
      skipping a transaction.
      * putting together two if()s which test for F_UNLCK
    storage/maria/ha_maria.h:
      ha_maria::save_transactional not needed anymore (moved to the C layer)
    storage/maria/ma_blockrec.c:
      * For the block record's code (writing/updating/deleting records),
      all that counts is now_transactional, not born_transactional.
      * As we now set the page type to PAGECACHE_PLAIN_PAGE for tables
      which have now_transactional==FALSE, pagecache will not expect
      a meaningful LSN for them in pagecache_unlock_by_link(), so
      we can pass it LSN_IMPOSSIBLE.
    storage/maria/ma_check.c:
      * writing LOGREC_REPAIR_TABLE moves from ha_maria::repair()
      to maria_repair(), sounds cleaner (less functions to export).
      * when opening a table during REPAIR, don't use the realpath-ed name,
      as this may fail if the table has symlinked files (maria_open()
      would try to find the data and index file in the directory
      of unique_file_name, it would fail if data and index files are in
      different dirs); use the unresolved name, open_file_name, which is
      the argument which was passed to the maria_open() which created 'info'.
    storage/maria/ma_close.c:
      assert that when a statement is done with a table, it cleans up
    storage/maria/ma_create.c:
      new name
    storage/maria/ma_delete_all.c:
      * using now_transactional
      * no reason to reset create_rename_lsn during delete_all (a bug);
      also no reason to do it during repair: it was put there because
      a positive create_rename_lsn caused a call to check_and_set_lsn()
      which asserted in DBUG_ASSERT(block->type == PAGECACHE_LSN_PAGE);
      first solution was to use LSN_IMPOSSIBLE in _ma_unpin_all_pages() if
      not transactional; but then in the case of ALTER TABLE, with
      transactionality temporarily disabled, it asserted in
      DBUG_ASSERT(LSN_VALID(lsn)) in pagecache_fwrite() (PAGECACHE_LSN_PAGE
      page with zero LSN - bad). The additional solution is to use
      PAGECACHE_PLAIN_PAGE when we disable transactionality temporarily: this
      avoids checks on the LSN, and also bypasses (optimization) the "flush
      log up to LSN" call when the pagecache flushes our page (in other
      words, no WAL needed).
    storage/maria/ma_delete_table.c:
      use now_transactional
    storage/maria/ma_locking.c:
      assert that when a statement is done with a table, it cleans up.
    storage/maria/ma_loghandler.c:
      * now_transactional should be used to test if we want a log record.
      * Assertions to make sure dummy_transaction_object is not spoilt
      by its many users.
    storage/maria/ma_open.c:
      base.transactional -> base.born_transactional
    storage/maria/ma_pagecache.c:
      missing name for page's type. Comment for future.
    storage/maria/ma_rename.c:
      use now_transactional
    storage/maria/maria_chk.c:
      use born_transactional
    storage/maria/maria_def.h:
      MARIA_BASE_INFO::transactional renamed to born_transactional.
      MARIA_SHARE::now_transactional introduced.
      _ma_repair_write_log_record() is made local to ma_check.c.
      Macros to temporarily disable, and re-enable, transactionality for a
      table.
    storage/maria/maria_read_log.c:
      assertions and using the new macros. Adding a forgotten resetting
      when we finally close all tables.
    38812255
ha_maria.cc 69.5 KB