1. 01 Nov, 2021 1 commit
    • Marko Mäkelä's avatar
      MDEV-26933 InnoDB fails to detect page number mismatch · 993b8edf
      Marko Mäkelä authored
      mtr_t::page_lock(): Validate the page number.
      
      ibuf_tree_root_get(): Remove assertions that became redundant.
      
      The assertions in btr_validate_level() are kind of redundant as well,
      but because they are ut_a(), they are also present in release builds,
      while the ones in mtr_t::page_lock() are only present in debug builds.
      
      btr_cur_position(): Do not duplicate an assertion that is part of
      page_cur_position().
      
      dict_load_tablespace(): Introduce a new option
      DICT_ERR_IGNORE_TABLESPACE that will suppress loading a tablespace
      when a table is going to be dropped.
      993b8edf
  2. 29 Oct, 2021 2 commits
    • Marko Mäkelä's avatar
    • Marko Mäkelä's avatar
      MDEV-25683 Atomic DDL: With innodb_force_recovery=3 InnoDB: Trying to load... · dbd6c6dc
      Marko Mäkelä authored
      MDEV-25683 Atomic DDL: With innodb_force_recovery=3 InnoDB: Trying to load index but the index tree has been freed
      
      The purpose of the parameter innodb_force_recovery is to allow some
      data to be dumped from a corrupted database. Its values used to be
      as follows:
      
      innodb_force_recovery=0: normal (default)
      
      innodb_force_recovery=1: ignore (skip log for) corrupted pages or
      missing data files when applying the redo log
      
      innodb_force_recovery=2: additionally, disable background tasks
      (such as the purge of committed undo logs)
      
      innodb_force_recovery=3: additionally, disable the rollback of
      recovered incomplete (not committed or XA PREPARE) transactions
      
      innodb_force_recovery=4: same as 3 (since MDEV-19514 in MariaDB 10.5)
      
      innodb_force_recovery=5: additionally, do not process any undo log,
      disallow any writes, and force READ UNCOMMITTED isolation level
      
      innodb_force_recovery=6: additionally, pretend that ib_logfile0 does
      not exist (prevent any recovery). Never use this!
      
      The bad thing that happens with innodb_force_recovery=3 and
      innodb_force_recovery=4 is that also the rollback of any recovered
      DDL transaction will be skipped. This would break the DDL log recovery
      that was introduced in MDEV-17567.
      
      For one data directory sample, the DDL log recovery would hangs due to
      a conflict on the InnoDB SYS_TABLES table, because the lock holder
      transaction was not rolled back due to innodb_force_recovery=3.
      
      Fix: Make innodb_force_recovery=3 skip the DML transaction rollback only,
      and make innodb_force_recovery=4 (renamed to SRV_FORCE_NO_DDL_UNDO)
      behave like innodb_force_recovery=3 used to (skip the rollback of all
      recovered transactions, both DML and DDL).
      
      Startup with innodb_force_recovery=4 will be unaffected by this change.
      (There may be hangs, possibly preceded by messages about failing to
      load an index.)
      
      Side note: With innodb_force_recovery=5, any DDL log for InnoDB tables
      will be essentially ignored by InnoDB, but the server will start up.
      dbd6c6dc
  3. 28 Oct, 2021 8 commits
  4. 27 Oct, 2021 12 commits
  5. 26 Oct, 2021 9 commits
    • Eugene Kosov's avatar
      MDEV-18543 IMPORT TABLESPACE fails after instant DROP COLUMN · d74d9596
      Eugene Kosov authored
      ALTER TABLE IMPORT doesn't properly handle instant alter metadata.
      This patch makes IMPORT read, parse and apply instant alter metadata at the
      very beginning of operation. So, cases when source table has some metadata
      and destination table doesn't have it now works fine.
      
      DISCARD already removes instant metadata so importing normal table into
      instant table worked fine before this patch.
      
      decrypt_decompress(): decrypts and decompresses page if needed
      
      handle_instant_metadata(): this should be the first thing to read source
      table. Basically, it applies instant metadata to a destination
      dict_table_t object. This is the first thing to read FSP flags so
      all possible checks of it were moved to this function.
      
      PageConverter::update_index_page(): it doesn't now read instant metadata.
      This logic were moved into handle_instant_metadata()
      
      row_import::match_flags(): this is a first part row_import::match_schema().
      As a separate function it's used by handle_instant_metadata().
      
      fil_space_t::is_full_crc32_compressed(): added convenient function
      
      ha_innobase::discard_or_import_tablespace(): do not reload table definition
      to read instant metadata because handle_instant_metadata() does it better.
      The reverted code was originally added in
      4e7ee166
      
      ANONYMOUS_VAR: this is a handy thing to use along with make_scope_exit()
      
      full_crc32_import.test shows different results, because no
      dict_table_close() and dict_table_open_on_id() happens.
      Thus, SHOW CREATE TABLE shows a little bit older table definition.
      d74d9596
    • Alexander Barkov's avatar
      MDEV-26732 Assertion `0' failed in Item::val_native · 49098bfd
      Alexander Barkov authored
      Also fixes MDEV-24619 Wrong result or Assertion `0' in Item::val_native / Type_handler_inet6::Item_val_native_with_conversion
      
      Type_handler_inet6::create_item_copy() created a generic Item_copy_string,
      which does not implement val_native() - it has a dummy implementation
      with DBUG_ASSERT(0), which made the server crash.
      
      Fix:
      
      - Adding a new class Type_handler_inet6
        which implements val_native().
      - Fixing Type_handler_inet6::create_item_copy()
        to make Item_copy_inet6 instead of Item_copy_string.
      49098bfd
    • Diego Dupin's avatar
      MDEV-26868: Session tracking flag in OK_PACKET · d062b690
      Diego Dupin authored
      Take into account client capabilities.
      d062b690
    • Oleksandr Byelkin's avatar
    • Oleksandr Byelkin's avatar
      Safemalloc typo fix found by clang. · 1fb4537e
      Oleksandr Byelkin authored
      1fb4537e
    • Vladislav Vaintroub's avatar
      Try to fix appveyor to prevent occasional failing of mysql_client_test · 20848007
      Vladislav Vaintroub authored
      Sometimes, although not often, it would timeout after 3 minutes.
      20848007
    • Vladislav Vaintroub's avatar
      MDEV-23391 Crash/assertion CREATE OR REPLACE TABLE AS SELECT under LOCK TABLE · 6211c355
      Vladislav Vaintroub authored
      Happens with Innodb engine.
      
      Move unlock_locked_table() past drop_open_table(), and
      rollback current statement, so that we can actually unlock the table.
      
      Anything else results in assertions, in drop, or unlock, or in close_table.
      6211c355
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-26902 Auxilary fts table evicts during DDL · 81b85476
      Thirunarayanan Balathandayuthapani authored
      MDEV-25702(commit 696de6d0) should've
      closed the fts table further. This patch closes the table after
      finishing the bulk insert operation.
      81b85476
    • Marko Mäkelä's avatar
      MDEV-26903: Assertion ctx->trx->state == TRX_STATE_ACTIVE on DROP INDEX · 58fe6b47
      Marko Mäkelä authored
      rollback_inplace_alter_table(): Tolerate a case where the transaction
      is not in an active state. If ha_innobase::commit_inplace_alter_table()
      failed with a deadlock, the transaction would already have been
      rolled back. This omission of error handling was introduced in
      commit 1bd681c8 (MDEV-25506 part 3).
      
      After commit c3c53926 (MDEV-26554)
      it became easier to trigger DB_DEADLOCK during exclusive table lock
      acquisition in ha_innobase::commit_inplace_alter_table().
      
      lock_table_low(): Add DBUG injection "innodb_table_deadlock".
      58fe6b47
  6. 25 Oct, 2021 7 commits
  7. 22 Oct, 2021 1 commit
    • Marko Mäkelä's avatar
      MDEV-26769 InnoDB does not support hardware lock elision · 1f022809
      Marko Mäkelä authored
      This implements memory transaction support for:
      
      * Intel Restricted Transactional Memory (RTM), also known as TSX-NI
      (Transactional Synchronization Extensions New Instructions)
      * POWER v2.09 Hardware Trace Monitor (HTM) on GNU/Linux
      
      transactional_lock_guard, transactional_shared_lock_guard:
      RAII lock guards that try to elide the lock acquisition
      when transactional memory is available.
      
      buf_pool.page_hash: Try to elide latches whenever feasible.
      Related to the InnoDB change buffer and ROW_FORMAT=COMPRESSED
      tables, this is not always possible.
      In buf_page_get_low(), memory transactions only work reasonably
      well for validating a guessed block address.
      
      TMLockGuard, TMLockTrxGuard, TMLockMutexGuard: RAII lock guards
      that try to elide lock_sys.latch and related latches.
      1f022809