1. 19 Oct, 2023 6 commits
    • Monty's avatar
      MDEV-32476 LeakSanitizer errors in get_quick_select or Assertion ... · 6a674c31
      Monty authored
      Problem was that JOIN_TAB::cleanup() was not run because
      JOIN::top_join_tab_count was not set in case of early errors.
      
      Fixed by setting JOIN::tab_join_tab_count when JOIN_TAB's are allocated.
      
      Something that should eventually be fixed:
      - Cleaning up JOIN_TAB's is now done in 3 different loops.
        JOIN_TAB::cleanup() is only doing a partial cleanup. Other cleanups
        are done outside of JOIN_TAB::cleanup().
      
      The above should be fixed so that JOIN_TAB::cleanup() is freeing
      everything related to it's own memory, including all its sub JOIN_ TAB's.
      JOIN::cleanup() should only loop over all it's top JOIN_TAB's and call
      JOIN_TAB::cleanup() on these.
      This will greatly simplify and speedup the current code (as we now do some
      cleanup's twice).
      6a674c31
    • Monty's avatar
      Fixed crash in is_stat_table() when using hash joins. · a1b6befc
      Monty authored
      Other usage if persistent statistics is checking 'stats_is_read' in
      caller, which is why this was not noticed earlier.
      
      Other things:
      - Simplified no_stat_values_provided
      a1b6befc
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · 6991b1c4
      Marko Mäkelä authored
      6991b1c4
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-31851 After crash recovery, undo tablespace fails to open · 85751ed8
      Thirunarayanan Balathandayuthapani authored
      srv_all_undo_tablespaces_open(): While opening the extra unused
      undo tablespaces, InnoDB should use ULINT_UNDEFINED instead of
      SRV_SPACE_ID_UPPER_BOUND.
      85751ed8
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-31851 After crash recovery, undo tablespace fails to open · dbba1bb1
      Thirunarayanan Balathandayuthapani authored
      recv_recovery_from_checkpoint_start(): InnoDB should add the
      redo log block header + trailer size while checking the	log
      sequence number in log file with log sequence number in the
      system tablespace first page.
      dbba1bb1
    • Marko Mäkelä's avatar
      MDEV-32144 fixup · 2d6dc65d
      Marko Mäkelä authored
      In commit 384eb570 the debug check
      was relaxed in trx_undo_header_create(), not in the intended function
      trx_undo_write_xid().
      2d6dc65d
  2. 18 Oct, 2023 2 commits
    • Marko Mäkelä's avatar
      MDEV-32511: Race condition between checkpoint and page write · cfd17881
      Marko Mäkelä authored
      fil_aio_callback(): Invoke fil_node_t::complete_write() before
      releasing any page latch, so that in case a log checkpoint is
      executed roughly concurrently with the first write into a file
      since the previous checkpoint, we will not miss a fdatasync()
      or fsync() call to make the write durable.
      cfd17881
    • Marko Mäkelä's avatar
      MDEV-32511 Assertion !os_aio_pending_writes() failed · bf7c6fc2
      Marko Mäkelä authored
      In MemorySanitizer builds of 10.10 and 10.11, we would rather often
      have the assertion fail in innodb_init() during mariadb-backup --prepare.
      The assertion could also fail during InnoDB startup, but less often.
      
      Before commit 685d958e in 10.8 the
      log file cleanup after a successfully applied backup is different,
      and the os_aio_pending_writes() assertion is in srv0start.cc.
      
      IORequest::write_complete(): Invoke node->complete_write() before
      releasing the page latch, so that a log checkpoint that is about to
      execute concurrently will not miss a fdatasync() or fsync() on the
      file, in case this was the first write since the last such call.
      
      create_log_file(), srv_start(): Replace the debug assertion with
      a debug check. For all intents and purposes, all writes could have
      been completed but some write_io_callback() may not have invoked
      io_slots::release() yet.
      bf7c6fc2
  3. 17 Oct, 2023 1 commit
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-31851 After crash recovery, undo tablespace fails to open · 3da5d047
      Thirunarayanan Balathandayuthapani authored
      Problem:
      ========
      - InnoDB fails to open undo tablespace when page0 is corrupted
      and fails to throw error.
      
      Solution:
      =========
      - InnoDB throws DB_CORRUPTION error when InnoDB encounters
      page0 corruption of undo tablespace.
      
      - InnoDB restores the page0 of undo tablespace from
      doublewrite buffer if it encounters page corruption
      
      - Moved Datafile::restore_from_doublewrite() to
      recv_dblwr_t::restore_first_page(). So that undo
      tablespace and system tablespace can use this function
      instead of duplicating the code
      
      srv_undo_tablespace_open(): Returns 0 if file doesn't exist
      or ULINT_UNDEFINED if page0 is corrupted.
      3da5d047
  4. 16 Oct, 2023 2 commits
  5. 14 Oct, 2023 3 commits
  6. 13 Oct, 2023 4 commits
  7. 12 Oct, 2023 3 commits
  8. 10 Oct, 2023 4 commits
  9. 08 Oct, 2023 6 commits
    • Monty's avatar
      Fixed that log_slow.test works with view_protocol · b04af648
      Monty authored
      Part of the test did not work with view_protocol as the query written
      to the slow_log table is changed because of view_protocol.
      b04af648
    • Monty's avatar
      Fixed compiler warnings in connect/odbconn.cpp · 1dd6d9a0
      Monty authored
      1dd6d9a0
    • Monty's avatar
      MDEV-22243 type_test.type_test_double fails with 'NUMERIC_SCALE NULL' · 9d19b652
      Monty authored
      There where several reasons why the test failed:
      - Constructors for Field_double and Field_float changed an argument
        to the constructor instead of a the correct class variable.
      - gcc 7.5.0 produced wrong code when inlining Field_double constructor
        into Field_test_double constructor.
      
      Fixed by changing the correct class variable and make the constructors
      not inline to go around the gcc bug.
      9d19b652
    • Otto Kekalainen's avatar
      Fix merge commit 5ea5291d: No test file or result files should be executable · 8941bdc4
      Otto Kekalainen authored
      In commit 5ea5291d @sanja-byelkin for unknown reason switched the file mode
      for 3 Galera tzinfo related test files from 644 -> 755. This exists only
      from branch 10.6 onward:
      
          $ git checkout 10.5
          $ find mysql-test -executable -name *.test -or -executable -name *.result
          (no results)
          $ git checkout 10.6
          $ find mysql-test -executable -name *.test -or -executable -name *.result
          mysql-test/suite/galera/t/mysql_tzmysql-test/suite/galera/t/mysql_tzinfo_to_sql.test
          mysql-test/suite/galera/t/mariadb_tzinfo_to_sql.test
          mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.resultinfo_to_sql.test
      
      mysql-test/suite/galera/t/mariadb_tzinfo_to_sql.test
      mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result
      
      No test file nor test result file should be executable, so run chmod -x
      on them.
      
      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.
      8941bdc4
    • Monty's avatar
      MDEV-31349 test maria.maria-purge failed on 'aria_log.00000002 not found' · 185591c1
      Monty authored
      The bug was in the test case.
      The problem was that maria_empty_logs.inc deleted aria log files before
      the server was properly shutdown.
      Fixed by waiting for pid file to disappear before starting to delete log
      files.
      
      Other things:
      - Fixed that translog_purge_at_flush() will not stop deleting files even
        if one file could not be deleted.
      185591c1
    • Monty's avatar
      Fixed randomly failing test main.order_by_optimizer_innodb · 424a7a26
      Monty authored
      The problem was that sometimes InnoDB returned sligtly wrong record count
      for table, which causes the optimizer to disregard the result from
      the range optimizer. The end result was that the optimizer choosed a
      ref access instead of a range access which caused errors in buildbot.
      
      Fixed by adding more rows to the table to ensure that table scan is
      more costly than range scan of the given interval.
      424a7a26
  10. 06 Oct, 2023 4 commits
  11. 04 Oct, 2023 2 commits
    • Vladislav Vaintroub's avatar
      MDEV-31095 tpool - do not create new worker, if thread creation is pending. · 9e62ab7a
      Vladislav Vaintroub authored
      Use an std::atomic_flag to track thread creation in progress.
      This is mainly a cleanup, the effect of this change was not measureable
      in my tests.
      9e62ab7a
    • Vladislav Vaintroub's avatar
      MDEV-31095 tpool - restrict threadpool concurrency during bufferpool load · e33e2fa9
      Vladislav Vaintroub authored
      Add threadpool functionality to restrict concurrency during "batch"
      periods (where tasks are added in rapid succession).
      This will throttle thread creation more agressively than usual, while
      keeping performance at least on-par.
      
      One of these cases is bufferpool load, where async read IOs are executed
      without any throttling. There can be as much as 650K read IOs for
      loading 10GB buffer pool.
      
      Another one is recovery, where "fake read" IOs are executed.
      
      Why there are more threads than we expect?
      Worker threads are not be recognized as idle, until they return to the
      standby list, and to return to that list, they need to acquire
      mutex currently held in the submit_task(). In those cases, submit_task()
      has no worker to wake, and would create threads until default concurrency
      level (2*ncpus) is satisfied. Only after that throttling would happen.
      e33e2fa9
  12. 03 Oct, 2023 3 commits
    • Michael Widenius's avatar
      MDEV-32164 Server crashes in JOIN::cleanup after erroneous query with view · 9ba8dc14
      Michael Widenius authored
      The problem was that we did not handle errors properly in
      JOIN::get_best_combination. In case an early error, JOIN->join_tab would
      contain unintialized values, which would cause errors on cleanup().
      
      The error in question was reported earlier, but not noticed until later.
      One cause of this is that most of the sql_select.cc code just checks
      thd->fatal_error and not thd->is_error().
      Fixed by changing of checks of fatal_error to is_error().
      9ba8dc14
    • Monty's avatar
      Change SEL_ARG::MAX_SEL_ARGS to a user defined variable optimizer_max_sel_args · d4347177
      Monty authored
      This allows a user to to change the default value of MAX_SEL_ARGS (16000)
      in the rare case where they neeed more generated SEL_ARGS (as part of
      the range optimizer)
      d4347177
    • Monty's avatar
      MDEV-32203 Raise notes when an index cannot be used on data type mismatch · 4e9322e2
      Monty authored
      Raise notes if indexes cannot be used:
      - in case of data type or collation mismatch (diferent error messages).
      - in case if a table field was replaced to something else
        (e.g. Item_func_conv_charset) during a condition rewrite.
      
      Added option to write warnings and notes to the slow query log for
      slow queries.
      
      New variables added/changed:
      
      - note_verbosity, with is a set of the following options:
        basic            - All old notes
        unusable_keys    - Print warnings about keys that cannot be used
                           for select, delete or update.
        explain          - Print unusable_keys warnings for EXPLAIN querys.
      
      The default is 'basic,explain'. This means that for old installations
      the only notable new behavior is that one will get notes about
      unusable keys when one does an EXPLAIN for a query. One can turn all
      of all notes by either setting note_verbosity to "" or setting sql_notes=0.
      
      - log_slow_verbosity has a new option 'warnings'. If this is set
        then warnings and notes generated are printed in the slow query log
        (up to log_slow_max_warnings times per statement).
      
      - log_slow_max_warnings   - Max number of warnings written to
                                  slow query log.
      
      Other things:
      - One can now use =ALL for any 'set' variable to set all options at once.
        For example using "note_verbosity=ALL" in a config file or
        "SET @@note_verbosity=ALL' in SQL.
      - mysqldump will in the future use @@note_verbosity=""' instead of
        @sql_notes=0 to disable notes.
      - Added "enum class Data_type_compatibility" and changing the return type
        of all Field::can_optimize*() methods from "bool" to this new data type.
      
      Reviewer & Co-author: Alexander Barkov <bar@mariadb.com>
      - The code that prints out the notes comes mainly from Alexander
      4e9322e2