1. 05 Mar, 2021 3 commits
    • Krunal Bauskar's avatar
      MDEV-25029: Reduce dict_sys mutex contention for read-only workload · 33cf577a
      Krunal Bauskar authored
      In theory, read-only workload shouldn't have anything to do with
      dict_sys mutex. dict_sys mutex is meant to protect database metadata.
      
      But then why does dict_sys mutex shows up as part of a read-only workload?
      This workload needs to fetch stats for query processing and while reading
      these stats dict_sys mutex is taken.
      
      Is this really needed?
      No. For the traditional reasons, it was the default global mutex used.
      
      Based on 10.6 changes, flow can now use table->lock_mutex to protect
      update/access of these stats. table mutexes being table specific
      global contention arising out of dict_sys is reduced.
      
      Thanks to Marko Makela for his early suggestion around proposed alternative
      and review of the draft patch.
      33cf577a
    • Daniel Black's avatar
      MDEV-6536: mtr main.bind_address_resolution · 7947c549
      Daniel Black authored
      Hopefully temporary disable, cloud init based bb workers
      don't resolve localhost -> ::1.
      
      workers: kvm-asan, kvm-deb-focal-amd64, and kvm-deb-groovy-amd64
      7947c549
    • Daniel Black's avatar
      6b8a8968
  2. 04 Mar, 2021 4 commits
  3. 03 Mar, 2021 3 commits
  4. 02 Mar, 2021 6 commits
    • Marko Mäkelä's avatar
      MDEV-24973 Performance schema duplicates rarely executed code for mutex operations · 80ac9ec1
      Marko Mäkelä authored
      The PERFORMANCE_SCHEMA wrapper for mutex and rw-lock operations is
      causing a lot of unlikely code to be inlined in each invocation.
      The impact of this may have been emphasized in MariaDB 10.6, because
      InnoDB now uses the common implementation of mutexes and condition
      variables (MDEV-21452).
      
      By default, we build with cmake -DPLUGIN_PERFSCHEMA enabled,
      but at runtime no instrumentation will be enabled. Similar to
      commit eba2d10a
      we had better avoid inlining the rarely executed code in order to reduce
      the code size and to improve the efficiency of the instruction cache.
      
      This change was extensively tested by Axel Schwenke with and without
      --enable-performance-schema (with no individual instruments enabled).
      Removing the inline functions did not cause any performance regression
      in either case. There seemed to be a tiny improvement, possibly due
      to reduced code size and better instruction cache hit rate.
      80ac9ec1
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · 33aec68a
      Marko Mäkelä authored
      33aec68a
    • Marko Mäkelä's avatar
      MDEV-24811 Assertion find(table) failed with innodb_evict_tables_on_commit_debug · 18535a40
      Marko Mäkelä authored
      lock_release_try(): Implement innodb_evict_tables_on_commit_debug.
      Before releasing any locks, collect the identifiers of tables to
      be evicted. After releasing all locks, look up for the tables and
      evict them if it is safe to do so.
      
      trx_t::commit_tables(): Remove the eviction logic.
      
      trx_t::commit_in_memory(): Invoke release_locks() only after
      commit_tables().
      18535a40
    • Marko Mäkelä's avatar
      8513007c
    • Marko Mäkelä's avatar
      MDEV-24789: Reduce lock_sys mutex contention further · 8d16da14
      Marko Mäkelä authored
      lock_sys_t::deadlock_check(): Assume that only lock_sys.wait_mutex
      is being held by the caller.
      
      lock_sys_t::rd_lock_try(): New function.
      
      lock_sys_t::cancel(trx_t*): Kill an active transaction that may be
      holding a lock.
      
      lock_sys_t::cancel(trx_t*, lock_t*): Cancel a waiting lock request.
      
      lock_trx_handle_wait(): Avoid acquiring mutexes in some cases,
      and in never acquire lock_sys.latch in exclusive mode.
      This function is only invoked in a semi-consistent read
      (locking a clustered index record only if it matches the search condition).
      Normally, lock_wait() will take care of lock waits.
      
      lock_wait(): Invoke the new function lock_sys_t::cancel() at the end,
      to avoid acquiring exclusive lock_sys.latch.
      
      lock_rec_other_trx_holds_expl(): Use LockGuard instead of LockMutexGuard.
      
      lock_release_autoinc_locks(): Explicitly acquire table->lock_mutex,
      in case only a shared lock_sys.latch is being held. Deadlock::report()
      will still hold exclusive lock_sys.latch while invoking
      lock_cancel_waiting_and_release().
      
      lock_cancel_waiting_and_release(): Acquire trx->mutex in this function,
      instead of expecting the caller to do so.
      
      lock_unlock_table_autoinc(): Only acquire shared lock_sys.latch.
      
      lock_table_has_locks(): Do not acquire lock_sys.latch at all.
      
      Deadlock::check_and_resolve(): Only acquire shared lock_sys.latchm
      for invoking lock_sys_t::cancel(trx, wait_lock).
      
      innobase_query_caching_table_check_low(),
      row_drop_tables_for_mysql_in_background(): Do not acquire lock_sys.latch.
      8d16da14
    • Marko Mäkelä's avatar
      MDEV-25026 Various code paths are accessing freed pages · 01b44c05
      Marko Mäkelä authored
      The test case encryption.innodb_encrypt_freed was failing in
      MemorySanitizer builds.
      
      recv_recover_page(): Mark non-recovered pages as freed.
      
      fil_crypt_rotate_page(): Before comparing the block->frame contents,
      check if the block was marked as freed.
      
      Other places: Whenever using BUF_GET_POSSIBLY_FREED, check the
      block->page.status before accessing the page frame.
      
      (Both uses of BUF_GET_IF_IN_POOL should be correct now.)
      01b44c05
  5. 01 Mar, 2021 3 commits
  6. 26 Feb, 2021 6 commits
  7. 25 Feb, 2021 9 commits
  8. 24 Feb, 2021 6 commits
    • Daniel Black's avatar
      MDEV-23510: arm64 lf_hash alignment of pointers · e0ba68ba
      Daniel Black authored
      Like the 10.2 version 1635686b,
      except C++ on internal functions for my_assume_aligned.
      
      volatile != atomic.
      
      volatile has no memory barrier schemantics, its for mmaped IO
      so lets allow some optimizer gains and stop pretending it helps
      with memory atomicity.
      
      The MDEV lists a SEGV an assumption is made that an address was
      partially read. As C packs structs strictly in order and on arm64 the
      cache line size is 128 bits. A pointer (link - 64 bits), followed
      by a hashnr (uint32 - 32 bits), leaves the following key (uchar *
      64 bits), neither naturally aligned to any pointer and worse, split
      across a cache line which is the processors view of an atomic
      reservation of memory.
      
      lf_dynarray_lvalue is assumed to return a 64 bit aligned address.
      
      As a solution move the 32bit hashnr to the end so we don't get the
      *key pointer split across two cache lines.
      
      Tested by: Krunal Bauskar
      Reviewer: Marko Mäkelä
      e0ba68ba
    • Daniel Black's avatar
      MDEV-23510: arm64 lf_hash alignment of pointers · 1635686b
      Daniel Black authored
      volatile != atomic.
      
      volatile has no memory barrier schemantics, its for mmaped IO
      so lets allow some optimizer gains and stop pretending it helps
      with memory atomicity.
      
      The MDEV lists a SEGV an assumption is made that an address was
      partially read. As C packs structs strictly in order and on arm64 the
      cache line size is 128 bits. A pointer (link - 64 bits), followed
      by a hashnr (uint32 - 32 bits), leaves the following key (uchar *
      64 bits), neither naturally aligned to any pointer and worse, split
      across a cache line which is the processors view of an atomic
      reservation of memory.
      
      lf_dynarray_lvalue is assumed to return a 64 bit aligned address.
      
      As a solution move the 32bit hashnr to the end so we don't get the
      *key pointer split across two cache lines.
      
      Tested by: Krunal Bauskar
      Reviewer: Marko Mäkelä
      1635686b
    • Igor Babaev's avatar
      MDEV-24910 Crash with SELECT that uses table value constructor as a subselect · bf6484e7
      Igor Babaev authored
      This bug caused crashes of the server when processing queries with table
      value constructors (TVC) that contained subqueries and were used itself as
      subselects. For such TVCs the following transformation is applied at the
      prepare stage:
        VALUES (v1), ... (vn) => SELECT * FROM (VALUES (v1), ... (vn)) tvc_x.
      This transformation allows to reduce the problem of evaluation of TVCs used
      as subselects to the problem of evaluation of regular subselects.
      The transformation is implemented in the wrap_tvc(). The code the function
      to mimic the behaviour of the parser when processing the result of the
      transformation. However this imitation was not free of some flaws. First
      the function called the method exclude() that completely destroyed the
      select tree structures below the transformed TVC. Second the function
      used the procedure mysql_new_select to create st_select_lex nodes for
      both wrapping select of the transformation and TVC. This also led to
      constructing of invalid select tree structures.
      The patch actually re-engineers the code of wrap_tvc().
      
      Approved by Oleksandr Byelkin <sanja@mariadb.com>
      bf6484e7
    • Jan Lindström's avatar
      MDEV-24964 : Heap-buffer-overflow on wsrep_schema.cc ::remove_fragments · d1eeb4b8
      Jan Lindström authored
      Problem was that we used heap allocated key using too small
      array. Fixed by using dynamic memory allocation using actual
      needed size.
      d1eeb4b8
    • Marko Mäkelä's avatar
      MDEV-24884 fixup: Remove a bogus assertion · 74281fe1
      Marko Mäkelä authored
      rw_lock::upgrade_trylock(): If the compare-and-swap fails,
      only assert that we are still holding the U lock and that
      no conflicting lock exists. If the upgrade to X would fail due
      to some thread holding an S latch, we will terminate the loop.
      74281fe1
    • Marko Mäkelä's avatar
      MDEV-24951 Assertion m.first->second.valid(trx->undo_no) failed · 5c9229b9
      Marko Mäkelä authored
      trx_t::commit_in_memory(): Invoke mod_tables.clear().
      
      trx_free_at_shutdown(): Invoke mod_tables.clear() for transactions
      that are discarded on shutdown.
      
      Everywhere else, assert mod_tables.empty() on freed transaction objects.
      5c9229b9