1. 04 Jan, 2022 3 commits
    • Marko Mäkelä's avatar
      Merge 10.6 into 10.7 · 7dfaded9
      Marko Mäkelä authored
      7dfaded9
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · 3f572676
      Marko Mäkelä authored
      3f572676
    • Marko Mäkelä's avatar
      MDEV-27416 InnoDB hang in buf_flush_wait_flushed(), on log checkpoint · 4c3ad244
      Marko Mäkelä authored
      InnoDB could sometimes hang when triggering a log checkpoint. This is
      due to commit 7b1252c0 (MDEV-24278),
      which introduced an untimed wait to buf_flush_page_cleaner().
      
      The hang was noticed by occasional failures of IMPORT TABLESPACE tests,
      such as innodb.innodb-wl5522, which would (unnecessarily) invoke
      log_make_checkpoint() from row_import_cleanup().
      
      The reason of the hang was that buf_flush_page_cleaner() would enter
      untimed sleep despite buf_flush_sync_lsn being set. The exact failure
      scenario is unclear, because buf_flush_sync_lsn should actually be
      protected by buf_pool.flush_list_mutex. We prevent the hang by
      invoking buf_pool.page_cleaner_set_idle(false) whenever we are
      setting buf_flush_sync_lsn and signaling buf_pool.do_flush_list.
      
      The bulk of these changes was originally developed as a preparation
      for MDEV-26827, to invoke buf_flush_list() from fewer threads,
      and tested on 10.6 by Matthias Leich.
      
      This fix was tested by running 100 repetitions of 100 concurrent instances
      of the test innodb.innodb-wl5522 on a RelWithDebInfo build, using ext4fs
      and innodb_flush_method=O_DIRECT on a SATA SSD with 4096-byte block size.
      During the test, the call to log_make_checkpoint() in row_import_cleanup()
      was present.
      
      buf_flush_list(): Make static.
      
      buf_flush_wait(): Wait for buf_pool.get_oldest_modification()
      to reach a target, by work done in the buf_flush_page_cleaner.
      If buf_flush_sync_lsn is going to be set, we will invoke
      buf_pool.page_cleaner_set_idle(false).
      
      buf_flush_ahead(): If buf_flush_sync_lsn or buf_flush_async_lsn
      is going to be set and the page cleaner woken up, we will invoke
      buf_pool.page_cleaner_set_idle(false).
      
      buf_flush_wait_flushed(): Invoke buf_flush_wait().
      
      buf_flush_sync(): Invoke recv_sys.apply() at the start in case
      crash recovery is active. Invoke buf_flush_wait().
      
      buf_flush_sync_batch(): A lower-level variant of buf_flush_sync()
      that is only called by recv_sys_t::apply().
      
      buf_flush_sync_for_checkpoint(): Do not trigger log apply
      or checkpoint during recovery.
      
      buf_dblwr_t::create(): Only initiate a buffer pool flush, not
      a checkpoint.
      
      row_import_cleanup(): Do not unnecessarily invoke log_make_checkpoint().
      Invoking buf_flush_list_space() before starting to generate redo log
      for the imported tablespace should suffice.
      
      srv_prepare_to_delete_redo_log_file():
      Set recv_sys.recovery_on in order to prevent
      buf_flush_sync_for_checkpoint() from initiating a checkpoint
      while the log is inaccessible. Remove a wait loop that is already
      part of buf_flush_sync().
      Do not invoke fil_names_clear() if the log is being upgraded,
      because the FILE_MODIFY record is specific to the latest format.
      
      create_log_file(): Clear recv_sys.recovery_on only after calling
      log_make_checkpoint(), to prevent buf_flush_page_cleaner from
      invoking a checkpoint.
      
      innodb_shutdown(): Simplify the logic in mariadb-backup --prepare.
      
      os_aio_wait_until_no_pending_writes(): Update the function comment.
      Apart from row_quiesce_table_start() during FLUSH TABLES...FOR EXPORT,
      this is being called by buf_flush_list_space(), which is invoked
      by ALTER TABLE...IMPORT TABLESPACE as well as some encryption operations.
      4c3ad244
  2. 03 Jan, 2022 6 commits
  3. 31 Dec, 2021 1 commit
  4. 28 Dec, 2021 1 commit
  5. 27 Dec, 2021 2 commits
  6. 26 Dec, 2021 1 commit
  7. 25 Dec, 2021 1 commit
  8. 24 Dec, 2021 2 commits
  9. 23 Dec, 2021 7 commits
    • Nayuta Yanagisawa's avatar
      MDEV-27184 Assertion `(old_top == initial_top (av) && old_size == 0) ||... · dc74d234
      Nayuta Yanagisawa authored
      MDEV-27184 Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed, Assertion `str.alloced_length() >= str.length() + data_len' failed
      
      Spider crashes on a query that inserts some rows including float.
      This is because Spider allocates a string of insufficient length.
      dc74d234
    • Julius Goryavsky's avatar
      MDEV-24097: galera[_3nodes] suite tests in MTR sporadically fails · b5cbe506
      Julius Goryavsky authored
      This is the first part of the fixes for MDEV-24097. This commit
      contains the fixes for instability when testing Galera and when
      restarting nodes quickly:
      
      1) Protection against a "stuck" old SST process during the execution
         of the new SST (after restarting the node) is now implemented for
         mariabackup / xtrabackup, which should help to avoid almost all
         conflicts due to the use of the same ports - both during testing
         with mtr, so and when restarting nodes quickly in a production
         environment.
      2) Added more protection to scripts against unexpected return of
         the rc != 0 (in the commands for deleting temporary files, etc).
      3) Added protection against unexpected crashes during binlog transfer
         (in SST scripts for rsync).
      4) Spaces and some special characters in binlog filenames shouldn't
         be a problem now (at the script level).
      5) Daemon process termination tracking has been made more robust
         against crashes due to unexpected termination of the previous SST
         process while new scripts are running.
      6) Reading ssl encryption parameters has been moved from specific
         SST scripts to a common wsrep_sst_common.sh script, which allows
         unified error handling, unified diagnostics and simplifies script
         revisions in the future.
      7) Improved diagnostics of errors related to the use of openssl.
      8) Corrections have been made for xtrabackup-v2 (both in tests and in
         the script code) that restore the work of xtrabackup with updated
         versions of innodb.
      9) Fixed some tests for galera_3nodes, although the complete solution
         for the problem of starting three nodes at the same time on fast
         machines will be done in a separate commit.
      
      No additional tests are required as this commit fixes problems with
      existing tests.
      b5cbe506
    • Julius Goryavsky's avatar
      Merge branch 10.2 into 10.3 · 3376668c
      Julius Goryavsky authored
      3376668c
    • Sergei Petrunia's avatar
      Fix typos in optimizer trace output · 4b020bfd
      Sergei Petrunia authored
      4b020bfd
    • Sergei Petrunia's avatar
      MDEV-27238: Assertion `got_name == named_item_expected()' failed in Json_writer · 397f5cf7
      Sergei Petrunia authored
      make_join_select() calls const_cond->val_int(). There are edge cases
      where const_cond may have a not-yet optimized subquery.
      
      (The subquery will have used_tables() covered by join->const_tables. It
      will still have const_item()==false, so other parts of the optimizer
      will not try to evaluate it.  We should probably mark such subqueries
      as constant but that is outside the scope of this MDEV)
      397f5cf7
    • Leandro Pacheco's avatar
      result of wsrep logic in queue_for_group_commit was being ignored · 0165a063
      Leandro Pacheco authored
      This could cause out of order wsrep checkpoints due wsrep specific leader
      code not being executed in `MYSQL_BIN_LOG::write_transaction_to_binlog_events`.
      Move original result assignment to before wsrep logic to prevent that.
      Reviewed-by: default avatarJan Lindström <jan.lindstrom@mariadb.com>
      0165a063
    • Monty's avatar
      Only apply wsrep_trx_fragment_size to InnoDB tables · ca2ea4ff
      Monty authored
      MDEV-22617 Galera node crashes when trying to log to slow_log table in
      streaming replication mode
      
      Other things:
      - Changed name of wsrep_after_row(two arguments) to
        wsrep_after_row_internal(one argument) to not depended on the
        function signature with unused arguments.
      Reviewed-by: default avatarJan Lindström <jan.lindstrom@mariadb.com>
      	     Added test case
      ca2ea4ff
  10. 22 Dec, 2021 5 commits
    • Brandon Nesterenko's avatar
      MDEV-26919: binlog.binlog_truncate_active_log fails in bb with valgrind,... · be20b3b0
      Brandon Nesterenko authored
      MDEV-26919: binlog.binlog_truncate_active_log fails in bb with valgrind, Conditional jump or move depends on uninitialised value
      
      Problem:
      ========
      When writing an XA based event to the binary log, an assert was
      always referencing thd->lex->xa_opt. This variable, however, is
      only set when using XA START, XA END, and XA COMMIT. When an
      XA PREPARE statement is being processed, it is not guaranteed that
      the xa_opt variable will be set (e.g. if existing within a stored
      procedure). This caused valgrind to complain about accessing an
      uninitialized variable.
      
      Solution:
      ========
      Before referencing xa_opt, ensure the context is valid such that
      it is set.
      
      Reviewed By:
      ============
      Andrei Elkin <andrei.elkin@mariadb.com>
      be20b3b0
    • Daniel Black's avatar
      MDEV-23175: my_timer_milliseconds clock_gettime for multiple platfomrs · 4eec6b99
      Daniel Black authored
      Small postfix to MDEV-23175 to ensure faster option on FreeBSD
      and compatibility to Solaris that isn't high resolution.
      
      ftime is left as a backup in case an implementation doesn't
      contain any of these clocks.
      
      FreeBSD
          $ ./unittest/mysys/my_rdtsc-t
          1..11
          # ----- Routine ---------------
          # myt.cycles.routine          :             5
          # myt.nanoseconds.routine     :            11
          # myt.microseconds.routine    :            13
          # myt.milliseconds.routine    :            11
          # myt.ticks.routine           :            17
          # ----- Frequency -------------
          # myt.cycles.frequency        :    3610295566
          # myt.nanoseconds.frequency   :    1000000000
          # myt.microseconds.frequency  :       1000000
          # myt.milliseconds.frequency  :           899
          # myt.ticks.frequency         :           136
          # ----- Resolution ------------
          # myt.cycles.resolution       :             1
          # myt.nanoseconds.resolution  :             1
          # myt.microseconds.resolution :             1
          # myt.milliseconds.resolution :             7
          # myt.ticks.resolution        :             1
          # ----- Overhead --------------
          # myt.cycles.overhead         :            26
          # myt.nanoseconds.overhead    :         19140
          # myt.microseconds.overhead   :         19036
          # myt.milliseconds.overhead   :           578
          # myt.ticks.overhead          :         21544
          ok 1 - my_timer_init() did not crash
          ok 2 - The cycle timer is strictly increasing
          ok 3 - The cycle timer is implemented
          ok 4 - The nanosecond timer is increasing
          ok 5 - The nanosecond timer is implemented
          ok 6 - The microsecond timer is increasing
          ok 7 - The microsecond timer is implemented
          ok 8 - The millisecond timer is increasing
          ok 9 - The millisecond timer is implemented
          ok 10 - The tick timer is increasing
          ok 11 - The tick timer is implemented
      4eec6b99
    • Daniel Black's avatar
      MDEV-23175: my_timer_milliseconds clock_gettime for multiple platfomrs · 12087d67
      Daniel Black authored
      Small postfix to MDEV-23175 to ensure faster option on FreeBSD
      and compatibility to Solaris that isn't high resolution.
      
      ftime is left as a backup in case an implementation doesn't
      contain any of these clocks.
      
      FreeBSD
          $ ./unittest/mysys/my_rdtsc-t
          1..11
          # ----- Routine ---------------
          # myt.cycles.routine          :             5
          # myt.nanoseconds.routine     :            11
          # myt.microseconds.routine    :            13
          # myt.milliseconds.routine    :            11
          # myt.ticks.routine           :            17
          # ----- Frequency -------------
          # myt.cycles.frequency        :    3610295566
          # myt.nanoseconds.frequency   :    1000000000
          # myt.microseconds.frequency  :       1000000
          # myt.milliseconds.frequency  :           899
          # myt.ticks.frequency         :           136
          # ----- Resolution ------------
          # myt.cycles.resolution       :             1
          # myt.nanoseconds.resolution  :             1
          # myt.microseconds.resolution :             1
          # myt.milliseconds.resolution :             7
          # myt.ticks.resolution        :             1
          # ----- Overhead --------------
          # myt.cycles.overhead         :            26
          # myt.nanoseconds.overhead    :         19140
          # myt.microseconds.overhead   :         19036
          # myt.milliseconds.overhead   :           578
          # myt.ticks.overhead          :         21544
          ok 1 - my_timer_init() did not crash
          ok 2 - The cycle timer is strictly increasing
          ok 3 - The cycle timer is implemented
          ok 4 - The nanosecond timer is increasing
          ok 5 - The nanosecond timer is implemented
          ok 6 - The microsecond timer is increasing
          ok 7 - The microsecond timer is implemented
          ok 8 - The millisecond timer is increasing
          ok 9 - The millisecond timer is implemented
          ok 10 - The tick timer is increasing
          ok 11 - The tick timer is implemented
      12087d67
    • Marko Mäkelä's avatar
      MDEV-27181 fixup: Replace symlinks · 3c1cde86
      Marko Mäkelä authored
      Some tools on Microsoft Windows refuse to work with symbolic links.
      Let us simply copy the relatively small files instead.
      3c1cde86
    • Alexander Barkov's avatar
      MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields · a5ef74e7
      Alexander Barkov authored
      The old code erroneously used default_charset_info to compare field names.
      default_charset_info can point to any arbitrary collation,
      including ucs2*, utf16*, utf32*, including those that do not
      support strcasecmp().
      
      my_charset_utf8mb4_unicode_ci, which is used in this scenario:
      
      CREATE TABLE t1 ENGINE=InnoDB WITH SYSTEM VERSIONING AS SELECT 0;
      
      does not support strcasecmp().
      
      Fixing the code to use Lex_ident::streq(), which uses
      system_charset_info instead of default_charset_info.
      a5ef74e7
  11. 21 Dec, 2021 7 commits
    • Marko Mäkelä's avatar
      MDEV-27336 Crash on DROP DATABASE due to out-of-bounds result from InnoDB SUBSTR() · 14521992
      Marko Mäkelä authored
      eval_substr(): Do not allow the string buffer of the first argument
      to be extended. Trim the length of the returned result if it would
      exceed the end of the buffer.
      14521992
    • Alexander Barkov's avatar
      MDEV-27307 main.ctype_utf8mb4_uca_allkeys tests fail with Valgrind/MSAN · 6487b8e3
      Alexander Barkov authored
      In case when filesort does not use addon field packing (because of
      too small potential savings) and uses fixed width addon fields instead,
      the field->pack() call can store less bytes when the field maximum
      possible field length, e.g. in case of VARCHAR().
      The memory between the packed length and addonf->length (the maximum length)
      stayed uninitialized, which was reported by Valgrind/MSAN.
      
      The problem was introduced by f52bf920 in 10.5,
      which removed the tail initialization (probably unintentionally).
      
      Restoring the bzero() in the fixed length branch,
      so in case when pack() stores less bytes than addonf->length says,
      the trailing bytes gets initialized.
      
      Note, before f52bf920, the bzero()
      was under HAVE_valgrind conditional compilation. Now it's being added
      unconditionally:
      - MSAN also reported the problem, so it's not only Valgrind specific.
      - As Serg proposed, conditional initialization is bad - it can have
        potentional security problems as the non-initialized memory fragments
        can store various pieces of essential information, e.g. passwords.
      6487b8e3
    • Sergei Golubchik's avatar
      bump up server's maturity · 1b8f0d4b
      Sergei Golubchik authored
      1b8f0d4b
    • Sergei Golubchik's avatar
      db0ea46e
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-27322 Test innodb.doublewrite crashes when using innodb_flush_method=O_DIRECT · 8e5f09a6
      Thirunarayanan Balathandayuthapani authored
       - InnoDB fails to write the page0 while trying to attempt recover
      the page0 from doublewrite buffer and incorrect size is being passed
      to the os_file_write(). Fix is that InnoDB should
      proper close the parenthesis for function os_file_write() in
      deferred_dblwr() and InnoDB should free the newly created tablespace
      in case of error in deferred_dblwr().
      8e5f09a6
    • sjaakola's avatar
      MDEV-27297 wsrep error log messages drop last character · 61a66d81
      sjaakola authored
      vsnprintf takes the space need for trailing '\0' in consideration, and copies only n-1 characters to destination buffer.
      With the old code, only sizeof(buf)-2 characters were copied, this caused that last character of message could be lost.
      Reviewed-by: default avatarJan Lindström <jan.lindstrom@mariadb.com>
      61a66d81
    • Marko Mäkelä's avatar
      MDEV-27332 SIGSEGV in fetch_data_into_cache() · 3b33593f
      Marko Mäkelä authored
      Since commit fb335b48 we may have
      a null pointer in purge_sys.query when fetch_data_into_cache() is
      invoked and innodb_force_recovery>4. This is because the call to
      purge_sys.create() would be skipped.
      
      fetch_data_into_cache(): Load the purge_sys pseudo transaction pointer
      to a local variable (null pointer if purge_sys is not initialized).
      3b33593f
  12. 20 Dec, 2021 2 commits
  13. 19 Dec, 2021 1 commit
    • Sergei Petrunia's avatar
      MDEV-27306: SET STATEMENT optimizer_trace=1 Doesn't save the trace · 32692140
      Sergei Petrunia authored
      In mysql_execute_command(), move optimizer trace initialization to be
      after run_set_statement_if_requested() call.
      
      Unfortunately, mysql_execute_command() code uses "goto error" a lot, and
      this means optimizer trace code cannot use RAII objects. Work this around
      by:
      - Make Opt_trace_start a non-RAII object, add init() method.
      - Move the code that writes the top-level object and array into
        Opt_trace_start::init().
      32692140
  14. 17 Dec, 2021 1 commit