• Guilhem Bichot's avatar
    Fix for BUG#37876 "Importing Maria table from other server via binary copy does not work": · 60b88ce4
    Guilhem Bichot authored
    - after auto-zerofill (ha_maria::check_and_repair()) kepts its state's LSNs unchanged, which could
    be the same as the create_rename_lsn of another pre-existing table, which would break versioning as this LSN
    serves as unique identifier in the versioning code (in maria_open()). Even the state pieces which
    maria_zerofill() did change were lost (because they didn't go to disk).
    - after this fix, if two tables were auto-zerofilled at the same time (by _ma_mark_changed())
    they could receive the same create_rename_lsn, which would break versioning again. Fix is to write a log
    record each time a table is imported.
    - Print state's LSNs (create_rename_lsn, is_of_horizon, skip_redo_lsn) and UUID in maria_chk -dvv.
    
    mysql-test/r/maria-autozerofill.result:
      result
    mysql-test/t/maria-autozerofill.test:
      Test for auto-zerofilling
    storage/maria/ha_maria.cc:
      The state changes done by auto-zerofilling never reached disk.
    storage/maria/ma_check.c:
      When zerofilling a table, including its pages' LSNs, new state LSNs are needed next time the table
      is imported into a Maria instance.
    storage/maria/ma_create.c:
      Write LOGREC_IMPORTED_TABLE when importing a table. This is informative and ensures
      that the table gets a unique create_rename_lsn even though multiple tables
      are imported by concurrent threads (it advances the log's end LSN).
    storage/maria/ma_key_recover.c:
      comment
    storage/maria/ma_locking.c:
      instead of using translog_get_horizon() for state's LSNs of imported table,
      use the LSN of to-be-written LOGREC_IMPORTED_TABLE.
    storage/maria/ma_loghandler.c:
      New type of log record
    storage/maria/ma_loghandler.h:
      New type of log record
    storage/maria/ma_loghandler_lsn.h:
      New name for constant as can be used not only by maria_chk but auto-zerofill now too.
    storage/maria/ma_open.c:
      instead of using translog_get_horizon() for state's LSNs of imported table,
      use the LSN of to-be-written LOGREC_IMPORTED_TABLE.
    storage/maria/ma_recovery.c:
      print content of LOGREC_IMPORTED_TABLE in maria_read_log.
    storage/maria/maria_chk.c:
      print info about LSNs of the table's state, and UUID, when maria_chk -dvv
    storage/maria/maria_pack.c:
      new name for constant
    storage/maria/unittest/ma_test_recovery.pl:
      Now that maria_chk -dvv shows state LSNs and UUID those need to be filtered out,
      as maria_read_log -a does not use the same as at original run.
    60b88ce4
ma_test_recovery.pl 14.7 KB