1. 26 Oct, 2021 2 commits
    • Marko Mäkelä's avatar
      Merge 10.6 into 10.7 · c8e309a6
      Marko Mäkelä authored
      c8e309a6
    • 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
  2. 25 Oct, 2021 5 commits
  3. 22 Oct, 2021 7 commits
    • Monty's avatar
    • Marko Mäkelä's avatar
      6bfaa68c
    • Marko Mäkelä's avatar
      Merge 10.6 into 10.7 · 71d4ecf1
      Marko Mäkelä authored
      71d4ecf1
    • 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
    • Marko Mäkelä's avatar
      MDEV-26826 Duplicated computations of buf_pool.page_hash addresses · c091a0bc
      Marko Mäkelä authored
      Since commit bd5a6403 (MDEV-26033)
      we can actually calculate the buf_pool.page_hash cell and latch
      addresses while not holding buf_pool.mutex.
      
      buf_page_alloc_descriptor(): Remove the MEM_UNDEFINED.
      We now expect buf_page_t::hash to be zero-initialized.
      
      buf_pool_t::hash_chain: Dedicated data type for buf_pool.page_hash.array.
      
      buf_LRU_free_one_page(): Merged to the only caller
      buf_pool_t::corrupted_evict().
      c091a0bc
    • Marko Mäkelä's avatar
      MDEV-26828 Spinning on buf_pool.page_hash is wasting CPU cycles · fdae71f8
      Marko Mäkelä authored
      page_hash_latch: Only use the spinlock implementation on
      SUX_LOCK_GENERIC platforms (those for which we do not implement
      a futex-like interface). Use srw_spin_mutex on 32-bit systems
      (except Microsoft Windows) to satisfy the size constraints.
      
      rw_lock::is_read_locked(): Remove. We will use the slightly
      broader assertion is_locked().
      
      srw_lock_: Implement is_locked(), is_write_locked() in a hacky
      way for the Microsoft Windows SRWLOCK. This should be acceptable,
      because we are only using these predicates in debug assertions
      (or later, in lock elision), and false positives should not matter.
      fdae71f8
    • Marko Mäkelä's avatar
      MDEV-26883 InnoDB hang due to table lock conflict · 5caff202
      Marko Mäkelä authored
      In a stress test campaign of a 10.6-based branch by Matthias Leich,
      a deadlock between two InnoDB threads occurred, involving
      lock_sys.wait_mutex and a dict_table_t::lock_mutex.
      
      The cause of the hang is a latching order violation in
      lock_sys_t::cancel(). That function and the latching order
      violation were originally introduced in
      commit 8d16da14 (MDEV-24789).
      
      lock_sys_t::cancel(): Invoke table->lock_mutex_trylock() in order
      to avoid a deadlock. If that fails, release lock_sys.wait_mutex,
      and acquire both latches. In that way, we will be obeying the
      latching order and no hangs will occur.
      
      This hang should mostly affect DDL operations. DML operations will
      acquire only IX or IS table locks, which are compatible with each other.
      5caff202
  4. 21 Oct, 2021 15 commits
  5. 20 Oct, 2021 10 commits
    • Marko Mäkelä's avatar
    • Nikita Malyavin's avatar
      MDEV-20131 Assertion `!pk->has_virtual()' failed · d10c42b4
      Nikita Malyavin authored
      Assertion `!pk->has_virtual()' failed in dict_index_build_internal_clust
      while creating PRIMARY key longer than possible to store in the page.
      
      This happened because the key was wrongly deduced as Long UNIQUE supported,
      however PRIMARY KEY cannot be of that type. The main reason is that
      only 8 bytes are used to store the hash, see HA_HASH_FIELD_LENGTH.
      
      This is also why HA_NOSAME flag is removed (and caused the assertion in
      turn) in open_table_from_share:
            if (key_info->algorithm == HA_KEY_ALG_LONG_HASH)
            {
              key_part_end++;
              key_info->flags&= ~HA_NOSAME;
            }
      
      To make it unique, the additional check is done by
      check_duplicate_long_entries call from ha_write_row, and similar one from
      ha_update_row.
      
      PRIMARY key is already forbidden, which is checked by the first test in
      main.long_unique, however is_hash_field_needed was wrongly deduced to true
      in mysql_prepare_create_table in this particular case.
      
      FIX:
      
      * Improve the check for Key::PRIMARY type
      * Simplify is_hash_field_needed deduction for a more neat reading
      d10c42b4
    • Marko Mäkelä's avatar
      Update libmariadb · 69b3de83
      Marko Mäkelä authored
      69b3de83
    • Marko Mäkelä's avatar
      MDEV-22627 Failing assertion: dict_tf2_is_valid(flags, flags2) · b06e8167
      Marko Mäkelä authored
      create_table_info_t::innobase_table_flags(): Refuse to create
      a PAGE_COMPRESSED table with PAGE_COMPRESSION_LEVEL=0 if also
      innodb_compression_level=0.
      
      The parameter value innodb_compression_level=0 was only somewhat
      meaningful for testing or debugging ROW_FORMAT=COMPRESSED tables.
      For the page_compressed format, it never made any sense, and the
      check in dict_tf_is_valid_not_redundant() that was added in
      72378a25 (MDEV-12873) would cause
      the server to crash.
      b06e8167
    • Nikita Malyavin's avatar
      MDEV-22445 Crash on HANDLER READ NEXT after XA PREPARE · caebe151
      Nikita Malyavin authored
      The assertion is absolutely correct since no data access is possible after
      XA PREPARE.
      
      The check is added in mysql_ha_read.
      caebe151
    • Nikita Malyavin's avatar
      MDEV-26262 frm is corrupted after ER_EXPRESSION_REFERS_TO_UNINIT_FIELD · 1811fd51
      Nikita Malyavin authored
      This is a duplicate of MDEV-18278 89936f11, but I will add an
      additional assertion
      
      Description:
      
      The frm corruption should not be reported during CREATE TABLE. Normally
      it doesn't, and the data to fill TABLE is taken by open_table_from_share
      call. However, the vcol data is stored as SQL string in
      table->s->vcol_defs.str and is anyway parsed on each table open.
      It is impossible [or hard] to avoid, because it's hard to clone the
      expression tree in general (it's easier to parse).
      
      Normally parse_vcol_defs should only fail on semantic errors. If so,
      error_reported is set to true. Any other failure is not expected during
      table creation. There is either unhandled/unacknowledged error, or
      something went really wrong, like memory reject. This all should be
      asserted anyway.
      
      Solution:
      * Set *error_reported=true for the forward references check;
      * Assert for every unacknowledged error during table creation.
      1811fd51
    • Nikita Malyavin's avatar
    • Oleksandr Byelkin's avatar
      MDEV-26647 (reuse info) Include password validation plugin information in the... · 45a376dd
      Oleksandr Byelkin authored
      MDEV-26647 (reuse info) Include password validation plugin information in the error message if the SQL statement is not satisfied password policy
      
      send information about password reusing
      45a376dd
    • Marko Mäkelä's avatar
      MDEV-26554: Stabilize the test · 78dec1f1
      Marko Mäkelä authored
      78dec1f1
    • Daniel Black's avatar
      MDEV-26363 Passwords incorrectly expiring after MySQL5.7 -> MariaDB10.3 -> 10.4+ upgrades · 4590f8b4
      Daniel Black authored
      MySQL-5.7 mysql.user tables have a last_password_changed field.
      
      Because before MariaDB-10.4 remained oblivious to this, the act of creating
      users or otherwise changing a users row left the last_password_field with 0.
      
      Running a MariaDB-10.4 instance on this would work correctly, until mysql_upgrade
      is run, when this 0 value immediately translates to password expired
      state.
      
      MySQL-5.7 relied on the password_expired enum to indicate password
      expiry so we aren't going to activate password that were expired in
      MySQL-5.7.
      
      Thanks Hans Borresen for the bug report and review of the fix.
      4590f8b4
  6. 19 Oct, 2021 1 commit