1. 21 Apr, 2023 7 commits
    • Marko Mäkelä's avatar
      MDEV-26782 InnoDB temporary tablespace: reclaiming of free space does not work · 51e62cb3
      Marko Mäkelä authored
      The motivation of this change is to allow undo pages for temporary tables
      to be marked free as often as possible, so that we can avoid buf_pool.LRU
      eviction (and writes) of undo pages that contain data that is
      no longer needed. For temporary tables, no MVCC or purge of history
      is needed, and reusing cached undo log pages might not help that much.
      
      It is possible that this may cause some performance regression due to
      more frequent allocation and freeing of undo log pages, but I only
      measured a performance improvement.
      
      trx_write_serialisation_history(): Never cache temporary undo log pages.
      
      trx_undo_reuse_cached(): Assert that the rollback segment is persistent.
      
      trx_undo_assign_low(): Add template<bool is_temp>. Never invoke
      trx_undo_reuse_cached() for temporary tables.
      
      Tested by: Matthias Leich
      51e62cb3
    • Marko Mäkelä's avatar
      Cleanup: MONITOR_EXISTING trx_undo_slots_used, trx_undo_slots_cached · 204e7225
      Marko Mäkelä authored
      Let us remove explicit updates of MONITOR_NUM_UNDO_SLOT_USED
      and MONITOR_NUM_UNDO_SLOT_CACHED, and let us compute the rough values
      from trx_sys.rseg_array[] on demand.
      204e7225
    • Marko Mäkelä's avatar
      MDEV-29593 Purge misses a chance to free not-yet-reused undo pages · 86767bcc
      Marko Mäkelä authored
      trx_purge_truncate_rseg_history(): If all other conditions for
      invoking trx_purge_remove_log_hdr() hold, but the state is
      TRX_UNDO_CACHED instead of TRX_UNDO_TO_PURGE, detach and free it.
      
      Tested by: Matthias Leich
      86767bcc
    • Marko Mäkelä's avatar
      MDEV-26827 fixup: hangs and !os_aio_pending_writes() assertion failures · 40eff3f8
      Marko Mäkelä authored
      buf_LRU_get_free_block(): Always wake up the page cleaner if needed
      before exiting the inner loop.
      
      srv_prepare_to_delete_redo_log_file():
      Replace a debug assertion with a wait in debug builds.
      Starting with commit 7e31a8e7
      the debug assertion ut_ad(!os_aio_pending_writes())
      could occasionally fail, while it would hold in core dumps of crashes.
      The failure can be reproduced more easily by adding a sleep to the
      write completion callback function, right before releasing to
      write_slots.
      
      srv_start(): Remove a bogus debug assertion
      ut_ad(!os_aio_pending_writes()) that could fail in
      mariadb-backup --prepare. In an rr replay trace, we had
      buf_pool.flush_list.count==0 but write_slots->m_cache.m_pos==1
      and buf_page_t::write_complete() was executing u_unlock().
      40eff3f8
    • Marko Mäkelä's avatar
      MDEV-31084 assert(waiting) failed in TP_connection_generic::wait_end · e55e761e
      Marko Mäkelä authored
      buf_flush_wait_flushed(): Correct the logic for registering a wait
      around buf_flush_wait() that
      commit a091d6ac
      recently broke. This should be easily repeatable when using a
      non-default startup parameter:
      
      	thread-handling=pool-of-threads
      e55e761e
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · abe4c7bf
      Marko Mäkelä authored
      abe4c7bf
    • Marko Mäkelä's avatar
      MDEV-30753 fixup: Unsafe buffer page restoration · c6e58a8d
      Marko Mäkelä authored
      trx_purge_free_segment(): The buffer-fix only prevents a block from
      being freed completely from the buffer pool, but it will not prevent
      the block from being evicted. Recheck the page identifier after
      acquiring an exclusive page latch. If it has changed, backtrack and
      invoke buf_page_get_gen() to look up the page normally.
      c6e58a8d
  2. 20 Apr, 2023 3 commits
  3. 19 Apr, 2023 6 commits
  4. 18 Apr, 2023 4 commits
    • Marko Mäkelä's avatar
      MDEV-30863 Server freeze, all threads in trx_assign_rseg_low() · 485a1b1f
      Marko Mäkelä authored
      trx_assign_rseg_low(): Simplify the debug check.
      
      trx_rseg_t::reinit(): Reset the skip_allocation() flag.
      This logic was broken in the merge
      commit 3e2ad0e9
      of commit 0de3be8c
      (that is, innodb_undo_log_truncate=ON would never be "completed").
      
      Tested by: Matthias Leich
      485a1b1f
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · c28d1a6f
      Marko Mäkelä authored
      c28d1a6f
    • Sergei Petrunia's avatar
      MDEV-30605: Wrong result while using index for group-by · be7ef656
      Sergei Petrunia authored
      A GROUP BY query which uses "MIN(pk)" and has "pk<>const" in the
      WHERE clause would produce wrong result when handled with "Using index
      for group-by".  Here "pk" column is the table's primary key.
      
      The problem was introduced by fix for MDEV-23634. It made the range
      optimizer to not produce ranges for conditions in form "pk != const".
      
      However, LooseScan code requires that the optimizer is able to
      convert the condition on the MIN/MAX column into an equivalent range.
      The range is used to locate the row that has the MIN/MAX value.
      
      LooseScan checks this in check_group_min_max_predicates(). This fix
      makes the code in that function to take into account that "pk != const"
      does not produce a range.
      be7ef656
    • Daniel Lenski's avatar
      [MDEV-30854] Do not use " as string delimiter in mariadb-tzinfo-to-sql · 1995c626
      Daniel Lenski authored
      If SQL_MODE contains ANSI_QUOTES (https://mariadb.com/kb/en/sql-mode/), then
      the double-quote character (") is not a legal string delimiter.
      
      In https://github.com/MariaDB/server/commit/13e77930e615f05cc74d408110e887b00e1abcc9#diff-a333d4ebb2d73b6361ef7dfebc86d883f7e19853b4a9eb85984b039058fae47cR2431-R2435,
      Daniel Black introduced a case where the double-quote character would be used as
      a string delimiter in the SQL queries generated by mariadb-tzinfo-to-sql.
      
      This tool tool generates SQL queries which should be able to run on any
      MariaDB server of the matching version.  Therefore, it should be extremely
      conservative in the SQL that it outputs, in order to maximize the chance
      that it can run regardless of the build or execution environment of the
      server.
      
      See MDEV-18778, MDEV-28263, and MDEV-28782 for previous cases where MariaDB
      has FAILED TO ENSURE that the generated timezone.sql actually works in
      different build and execution environments.  More test coverage is clearly
      needed here.
      
      All new code of the whole pull request, including one or several files that are
      either new files or modified ones, are contributed under the BSD-new license. I
      am contributing on behalf of my employer Amazon Web Services, Inc.
      1995c626
  5. 17 Apr, 2023 2 commits
  6. 14 Apr, 2023 2 commits
    • Vlad Lesin's avatar
      MDEV-31049 fil_delete_tablespace() returns wrong file handle if tablespace was... · 71f16c83
      Vlad Lesin authored
      MDEV-31049 fil_delete_tablespace() returns wrong file handle if tablespace was closed by parallel thread
      
      fil_delete_tablespace() stores file handle in local variable and calls
      mtr_t::commit_file()=>fil_system_t::detach(..., detach_handle=true), which
      sets space->chain.start->handle = OS_FILE_CLOSED. fil_system_t::detach()
      is invoked under fil_system.mutex.
      
      But before the mutex is acquired some parallel thread can change
      space->chain.start->handle. fil_delete_tablespace() returns value, stored
      in local variable, i.e. wrong value.
      
      File handle can be closed, for example, from buf_flush_space() when the
      limit of innodb_open_files exceded and fil_space_t::get() causes
      fil_space_t::try_to_close() call.
      
      fil_space_t::try_to_close() is executed under fil_system.mutex. And
      mtr_t::commit_file() locks it for fil_system_t::detach() call.
      fil_system_t::detach() returns detached file handle if its argument
      detach_handle is true. The fix is to let mtr_t::commit_file() to pass
      that detached file handle to fil_delete_tablespace().
      71f16c83
    • Vlad Lesin's avatar
      MDEV-30775 Performance regression in fil_space_t::try_to_close() introduced in MDEV-23855 · 0cca8166
      Vlad Lesin authored
      Post-push fix.
      
      10.5 MDEV-30775 fix inserts just opened tablespace just after the element
      which fil_system.space_list_last_opened points to.
      
      In MDEV-25223 fil_system_t::space_list was changed from UT_LIST to
      ilist. ilist<...>::insert(iterator pos, reference value) inserts element
      to list before pos.
      
      But it was not taken into account during 10.5->10.6 merge in
      85cbfaef, and the fix
      does not work properly, i.e. it inserted just opened tablespace to the
      position preceding fil_system.space_list_last_opened.
      0cca8166
  7. 13 Apr, 2023 5 commits
    • Tuukka Pasanen's avatar
      MDEV-30687: Make small facelifting to autobake-debs.sh · f2fde3f6
      Tuukka Pasanen authored
      Currently autobake-debs.sh does not pass shellcheck
      it fails making errors:
      
       * SC1091 when using shellcheck -x it needs to know where to
         find ./VERSION. As this is not needed we just specify it
         as /dev/null as mentioned in shellcheck documentation:
         https://www.shellcheck.net/wiki/SC1091
      
       * SC2086 make sure that there is no globbing or word splitting
         in dpkg-buidpackage string. This not big problem or about to happen
         but now extra parameter parsing is more Bash compliant with
         using array.
         Change BUILDPACKAGE_PREPEND to BUILDPACKAGE_DPKGCMD which holds
         'eatmydata' if it's available and needed 'dpkg-buildpackage'
         https://www.shellcheck.net/wiki/SC2086
      
      Fix small script indentation problem.
      f2fde3f6
    • Sergei Petrunia's avatar
      Fix compilation on gcc 11.2.0 · 6c196090
      Sergei Petrunia authored
      It is used in the out-of date Ubuntu 21.10 Impish.
      6c196090
    • Tuukka Pasanen's avatar
      MDEV-31045: Fix regression building on Ubuntu 18.04 · 1e4eef5c
      Tuukka Pasanen authored
      Github PR #2424 regressed Ubuntu 18.04 building
      other than x86_64 machines. Architecture that are
      impacted are PPC64 and ARM64.
      This was because of changes in debian/rules file
      which caused removing dependency to package 'libpmem-dev'
      and CMake which '-DWITH_PMEM' removing not working
      correctly. Package libpmem-dev was removed but
      it still required to have PMEM with CMake which.
      Commit make change that -DWITH_PMEM is correctly removed
      if it's not wanted.
      1e4eef5c
    • Marko Mäkelä's avatar
      MDEV-31048 PERFORMANCE_SCHEMA lakcs InnoDB read_slots and write_slots · f50abab1
      Marko Mäkelä authored
      tpool::cache::m_mtx: Add PERFORMANCE_SCHEMA instrumentation
      (wait/synch/mutex/innodb/tpool_cache_mutex). This covers the
      InnoDB read_slots and write_slots for asynchronous data page I/O.
      f50abab1
    • Marko Mäkelä's avatar
      MDEV-28974 fixup: Fix error and warning messages · c0eeb725
      Marko Mäkelä authored
      fil_name_process(): Starting with
      commit 212994f7
      the name is not guaranteed to be NUL terminated.
      c0eeb725
  8. 12 Apr, 2023 2 commits
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-29273 Race condition between drop table and closing of table · 2ddfb838
      Thirunarayanan Balathandayuthapani authored
      - This issue caused by race condition between drop thread
      and fil_encrypt_thread. fil_encrypt_thread closes
      the tablespace if the number of opened files
      exceeds innodb_open_files. fil_node_open_file()
      closes the tablespace which are open and it doesn't
      have pending operations. At that time, InnoDB drop tries
      to write the redo log for the file delete operation.
      It throws the bad file descriptor error.
      
      - When trying to close the file, InnoDB should check
      whether the table is going to be dropped.
      2ddfb838
    • Marko Mäkelä's avatar
      MDEV-26827 fixup: Do not duplicate io_slots::pending_io_count() · a091d6ac
      Marko Mäkelä authored
      os_aio_pending_reads_approx(), os_aio_pending_reads(): Replaces
      buf_pool.n_pend_reads.
      
      os_aio_pending_writes(): Replaces buf_dblwr.pending_writes().
      
      buf_dblwr_t::write_cond, buf_dblwr_t::writes_pending: Remove.
      a091d6ac
  9. 11 Apr, 2023 2 commits
  10. 06 Apr, 2023 1 commit
  11. 05 Apr, 2023 1 commit
  12. 04 Apr, 2023 5 commits