1. 26 Jul, 2022 1 commit
    • Monty's avatar
      Improve pruning in greedy_search by sorting tables during search · b3c74bdc
      Monty authored
      MDEV-28073 Slow query performance in MariaDB when using many tables
      
      The faster we can find a good query plan, the more options we have for
      finding and pruning (ignoring) bad plans.
      
      This patch adds sorting of plans to best_extension_by_limited_search().
      The plans, from best_access_path() are sorted according to the numbers
      of found rows.  This allows us to faster find 'good tables' and we are
      thus able to eliminate 'bad plans' faster.
      
      One side effect of this patch is that if two tables have equal cost,
      the table that which was used earlier in the query is preferred.
      This allows users to improve plans by reordering eq_ref tables in the
      order they would like them to be uses.
      
      Result changes caused by the patch:
      - Traces are different as now we print the cost for using tables before
        we start considering them in the plan.
      - Table order are changed for some plans. In most cases this is because
        the plans are equal and tables are in this case sorted according to
        their usage in the original query.
      - A few plans was changed as the optimizer was able to find a better
        plan (that was pruned by the original code).
      
      Other things:
      
      - Added a new statistic variable: "optimizer_join_prefixes_check_calls",
        which counts number of calls to best_extension_by_limited_search().
        This can be used to check the prune efficiency in greedy_search().
      - Added variable "JOIN_TAB::embedded_dependent" to be able to handle
        XX IN (SELECT..) in the greedy_optimizer.  The idea is that we
        should prune a table if any of the tables in embedded_dependent is
        not yet read.
      - When using many tables in a query, there will be some additional
        memory usage as we need to pre-allocate table of
        table_count*table_count*sizeof(POSITION) objects (POSITION is 312
        bytes for now) to hold the pre-calculated best_access_path()
        information.  This memory usage is offset by the expected
        performance improvement when using many tables in a query.
      - Removed the code from an earlier patch to keep the table order in
        join->best_ref in the original order.  This is not needed anymore as we
        are now sorting the tables for each best_extension_by_limited_search()
        call.
      b3c74bdc
  2. 25 Jul, 2022 1 commit
    • Sergei Petrunia's avatar
      Revert the commit with MDEV-28926: Add time spent on query optimizer to JSON ANALYZE · 213772f9
      Sergei Petrunia authored
      It will go into 10.11.
      
      Author: Luis Eduardo Oliveira Lizardo <108760288+mariadb-LuisLizardo@users.noreply.github.com>
      Date:   Mon Jul 18 17:48:01 2022 +0200
      
          MDEV-28926 Add time spent on query optimizer to JSON ANALYZE (#2193)
      
          * Add query optimizer timer to ANALYZE FORMAT=JSON
      
          * Adapt tests and results
      
          * Change logic to always close the writer after printing query blocks
      213772f9
  3. 18 Jul, 2022 1 commit
  4. 08 Jul, 2022 1 commit
  5. 29 Jun, 2022 5 commits
  6. 28 Jun, 2022 8 commits
  7. 27 Jun, 2022 20 commits
    • Alexander Barkov's avatar
    • Nayuta Yanagisawa's avatar
    • Marko Mäkelä's avatar
      MDEV-26979 heap-use-after-free or SIGSEGV when accessing INNODB_SYS_TABLESTATS during DDL · 1ae81607
      Marko Mäkelä authored
      i_s_dict_fill_sys_tablestats(): Read all fields of dict_table_t
      while holding dict_sys.latch.
      
      dict_sys_t::allow_eviction(): Remove.
      1ae81607
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · 20cf63fe
      Marko Mäkelä authored
      20cf63fe
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · 773f1dad
      Marko Mäkelä authored
      773f1dad
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · b922ae5f
      Marko Mäkelä authored
      b922ae5f
    • Marko Mäkelä's avatar
      MDEV-26577 InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2) during ADD COLUMN · f339ef3f
      Marko Mäkelä authored
      prepare_inplace_alter_table_dict(): If the table will not be rebuilt,
      preserve all of the original ROW_FORMAT, including the compressed
      page size flags related to ROW_FORMAT=COMPRESSED.
      f339ef3f
    • Marko Mäkelä's avatar
      MDEV-28389 fixup: Fix compiler warnings · a75ad735
      Marko Mäkelä authored
      hex_to_ascii(): Add #if around the definition to avoid
      clang -Wunused-function. Avoid GCC 5 -Wconversion with a cast.
      a75ad735
    • Marko Mäkelä's avatar
      MDEV-28950 Assertion `*err == DB_SUCCESS' failed in btr_page_split_and_insert · 39f45f6f
      Marko Mäkelä authored
      btr_root_raise_and_insert(), btr_lift_page_up(),
      rtr_page_split_and_insert(): Reset DB_FAIL from a failure to
      copy records on a ROW_FORMAT=COMPRESSED page to DB_SUCCESS
      before retrying.
      
      This fixes a regression that was introduced by
      commit 0b47c126 (MDEV-13542).
      
      btr_root_raise_and_insert(): Remove a redundant condition.
      btr_page_split_and_insert() will invoke btr_page_split_and_insert()
      if needed.
      39f45f6f
    • Alexander Barkov's avatar
      MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER · 0bed4d72
      Alexander Barkov authored
      Now INSERT, UPDATE, ALTER statements involving incompatible data type pairs, e.g.:
      
          UPDATE TABLE t1 SET col_inet6=col_int;
          INSERT INTO t1 (col_inet6) SELECT col_in FROM t2;
          ALTER TABLE t1 MODIFY col_inet6 INT;
      
      consistently return an error at the statement preparation time:
      
          ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET'
      
      and abort the statement before starting interating rows.
      
      This error is the same with what is raised for queries like:
          SELECT col_inet6 FROM t1 UNION SELECT col_int FROM t2;
          SELECT COALESCE(col_inet6, col_int) FROM t1;
      
      Before this change the error was caught only during the execution time,
      when a Field_xxx::store_xxx() was called for the very firts row.
      The behavior was not consistent between various statements and could do different things:
      - abort the statement
      - set a column to the data type default value (e.g. '::' for INET6)
      - set a column to NULL
      
      A typical old error was:
      
          ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`a` at row 1
      
      EXCEPTION:
      
      Note, there is an exception: a multi-row INSERT..VALUES, e.g.:
          INSERT INTO t1 (col_a,col_b) VALUES (a1,b1),(a2,b2);
      checks assignment compability at the preparation time for the very first row only:
          (col_a,col_b) vs (a1,b1)
      
      Other rows are still checked at the execution time and return the old warnings
      or errors in case of a failure. This is done because catching all rows at the
      preparation time would change behavior significantly. So it still works
      according to the STRICT_XXX_TABLES sql_mode flags and the table transaction ability.
      
      This is too late to change this behavior in 10.7.
      There is no a firm decision yet if a multi-row INSERT..VALUES
      behavior will change in later versions.
      0bed4d72
    • Marko Mäkelä's avatar
      Suppress a message that may be emitted on slow systems · 7d92c9d2
      Marko Mäkelä authored
      On FreeBSD, tests run on persistent storage, and no asynchronous I/O
      has been implemented. Warnings about 205-second waits on dict_sys.latch
      may occur.
      7d92c9d2
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · 87bd79b1
      Marko Mäkelä authored
      87bd79b1
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · ea847cbe
      Marko Mäkelä authored
      ea847cbe
    • Marko Mäkelä's avatar
      Fix GCC -Og -Wmaybe-uninitialized · 03174cab
      Marko Mäkelä authored
      03174cab
    • Marko Mäkelä's avatar
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · 01d75703
      Marko Mäkelä authored
      01d75703
    • Marko Mäkelä's avatar
      MDEV-28389: Simplify the InnoDB corrupted page output · c86b1389
      Marko Mäkelä authored
      buf_page_print(): Dump the buffer page 32 bytes (64 hexadecimal digits)
      per line. In this way, the limitation in mtr
      ("Data too long for column 'line'") will not be triggered.
      
      Also, do not bother decoding the page contents, because everything
      is present in the hexadecimal output.
      
      dict_index_find_on_id_low(): Merge to dict_index_get_if_in_cache_low().
      The direct call in buf_page_print() was prone to crashing, in case the
      table definition was concurrently evicted or dropped from the
      data dictionary cache.
      c86b1389
    • Hirokazu Hata's avatar
      MDEV-28854 Disallow INSERT DELAYED on Spider table · 2c1aaa66
      Hirokazu Hata authored
      Spider supports (or at least allows) INSERT DELAYED but the
      documentation does not specify spider as a storage engine that supports
      "INSERT DELAYED".
      Also, although not mentioned in the documentation, "INSERT DELAYED" is
      not intended to be executed inside a transaction, as can be seen from
      the list of supported storage engines.
      The current implementation allows executing a delayed insert on a
      remote transactional table and this breaks the consistency ensured by
      the transaction.
      
      We too remove "internal_delayed", one of the Spider table parameters.
      Documentation says,
      
      > Whether to transmit existence of delay to remote servers when
      > executing an INSERT DELAYED statement on local server.
      
      This table parameter is only used for "INSERT DELAYED".
      
      Reviewed by: Nayuta Yanagisawa
      2c1aaa66
    • Nayuta Yanagisawa's avatar
      MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection · 925999bb
      Nayuta Yanagisawa authored
      When the variable, spider_semi_table_lock, is 1, Spider sends
      LOCK TABLES before each SQL execution. The feature is for
      non-transactional remote tables and adds some overhead to query
      executions.
      
      We change the default value of the plugin variable to 0 and then
      deprecate the variable because it is rare to use non-transactional
      engines these days and the variable complicates the code.
      
      The variable, spider_semi_table_lock_connection, should be too
      deprecated because it is for tweaking the semi-table locking.
      925999bb
    • Nayuta Yanagisawa's avatar
      MDEV-28479 Deprecate Spider's high availability feature · 8e6c8967
      Nayuta Yanagisawa authored
      Deprecate the high availability feature of Spider as the feature is
      beyond the scope of the federated storage engine and it complicates
      the implementation of Spider.
      8e6c8967
  8. 24 Jun, 2022 2 commits
  9. 23 Jun, 2022 1 commit
    • Vladislav Vaintroub's avatar
      MDEV-28935 crash in io_slots::release · d96436c9
      Vladislav Vaintroub authored
      Revert "TSAN: data race on vptr (ctor/dtor vs virtual call)"
      
      This reverts commit 78084fa7.
      
      This commit was done to please TSAN, which falsely reported an error
      where there was none.
      Yet as consequence, it could cause a real error, a crash in os_aio_free on
      shutdown
      d96436c9