• unknown's avatar
    WL#3072 - Maria recovery · 644361af
    unknown authored
    maria_read_log used to always print a warning message at startup
    to say it is unsafe if ALTER TABLE was used. Now it prints it only
    if the log does show the problem (=ALTER TABLE or CREATE SELECT, which
    both disable logging of REDO_INSERT*).
    For that, when ha_maria::external_lock() disables transactionality
    it writes a LOGREC_INCOMPLETE_LOG to the log, which "maria_read_log -a"
    picks up to write a warning.
    REPAIR TABLE also disables those REDO_INSERT* but as maria_read_log
    executes LOGREC_REDO_REPAIR no warning is needed.
    
    
    storage/maria/ha_maria.cc:
      as we now log a record when disabling transactionility, we need the
      TRN to be set up first
    storage/maria/ma_blockrec.c:
      comment
    storage/maria/ma_loghandler.c:
      new type of log record
    storage/maria/ma_loghandler.h:
      new type of log record
    storage/maria/ma_recovery.c:
      * maria_apply_log() now returns a count of warnings. What currently
      produces warnings is:
      - skipping applying UNDOs though there are some (=> inconsistent table)
      - replaying log (in maria_read_log) though the log contains some
      ALTER TABLE or CREATE SELECT (log misses REDO_INSERT* for those
      and is so incomplete).
      Count of warnings affects the final message of maria_read_log and
      recovery (though in recovery none of the two conditions above should
      happen).
      * maria_read_log used to always print a warning message at startup
      to say it is unsafe if ALTER TABLE was used. Now it prints it only
      if the log does show the problem, i.e. ALTER TABLE or CREATE SELECT
      was used (both disable logging of REDO_INSERT* as those records are
      not needed for recovery; those missing records in turn make
      recreation-from-scratch, via maria_read_log, impossible). For that,
      when ha_maria::external_lock() disables transactionality,
      _ma_tmp_disable_logging_for_table() writes a LOGREC_INCOMPLETE_LOG to
      the log, which maria_apply_log() picks up to write a warning.
    storage/maria/ma_recovery.h:
      maria_apply_log() returns a count of warnings
    storage/maria/maria_def.h:
      _ma_tmp_disable_logging_for_table() grows so becomes a function
    storage/maria/maria_read_log.c:
      maria_apply_log can now return a count of warnings, to temper the
      "SUCCESS" message printed in the end by maria_read_log.
      Advise users to make a backup first.
    644361af
ma_recovery.c 85 KB