1. 06 Oct, 2023 1 commit
  2. 05 Oct, 2023 4 commits
    • Yuchen Pei's avatar
    • Yuchen Pei's avatar
      MDEV-22979 MDEV-27233 MDEV-28218 Fixing spider init bugs · a60cf9c7
      Yuchen Pei authored
      Fix spider init bugs (MDEV-22979, MDEV-27233, MDEV-28218) while
      preventing regression on old ones (MDEV-30370, MDEV-29904)
      
      Two things are changed:
      
      First, Spider initialisation is made fully synchronous, i.e. it no
      longer happens in a background thread. Adapted from the original fix
      by nayuta for MDEV-27233. This change itself would cause failure when
      spider is initialised early, by plugin-load-add, due to dependency on
      Aria and udf function creation, which are fixed in the second and
      third parts below. Requires SQL Service, thus porting earlier versions
      requires MDEV-27595
      
      Second, if spider is initialised before udf_init(), create udf by
      inserting into `mysql.func`, otherwise do it by `CREATE FUNCTION` as
      usual. This change may be generalised in MDEV-31401.
      
      Also factor out some clean-up queries from deinit_spider.inc for use
      of spider init tests.
      
      A minor caveat is that early spider initialisation will fail if the
      server is bootstrapped for the first time, due to missing `mysql`
      database which needs to be created by the bootstrap script.
      a60cf9c7
    • Yuchen Pei's avatar
      MDEV-27095 clean up spd_init_query.h · c6ba81d6
      Yuchen Pei authored
      Removing procedures that were created and dropped during init.
      
      This also fixes a race condition where mtr test with
      plugin-load-add=ha_spider.so causes post test check to fail as it
      expects the procedures to still be there.
      c6ba81d6
    • Yuchen Pei's avatar
      MDEV-27095 installing one spider plugin should not trigger others · fc2548c8
      Yuchen Pei authored
      There are several plugins in ha_spider: spider, spider_alloc_mem,
      spider_wrapper_protocols, spider_rewrite etc.
      
      INSTALL PLUGIN foo SONAME ha_spider causes all the other ones to be
      installed by the init queries where foo is any of the plugins.
      
      This introduces unnecessary complexiy. For example it reads
      mysql.plugins to find all other plugins, causing the hack of moving
      spider plugin init to a separate thread.
      
      To install all spider related plugins, install soname ha_spider should
      be used instead.
      
      This also fixes spurious rows in mysql.plugin when installing say only
      the spider plugin with `plugin-load-add=SPIDER=ha_spider.so`:
      
      select * from mysql.plugin;
      name	dl
      spider_alloc_mem	ha_spider.so # should not be here
      spider_wrapper_protocols	ha_spider.so # should not be here
      
      Adapted from part of the reverted commit
      c160a115.
      fc2548c8
  3. 02 Oct, 2023 1 commit
  4. 24 Sep, 2023 1 commit
  5. 08 Sep, 2023 1 commit
  6. 29 Aug, 2023 1 commit
  7. 28 Aug, 2023 2 commits
  8. 25 Aug, 2023 1 commit
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-31835 Remove unnecessary extra HA_EXTRA_IGNORE_INSERT call · bf3b787e
      Thirunarayanan Balathandayuthapani authored
      - This commit is different from 10.6 commit c4382848.
      Due to Commit 045757af (MDEV-24621),
      InnoDB does buffer and pre-sort the records for each index, and build
      the indexes one page at a time.
      
      Multiple large insert ignore statment aborts the server during bulk
      insert operation. Problem is that InnoDB merge record exceeds
      the page size. To avoid this scenario, InnoDB should catch
      too big record while buffering the insert operation itself.
      
      row_merge_buf_encode(): returns length of the encoded index record
      
      row_merge_buf_write(): Catches the DB_TOO_BIG_RECORD earlier and
      returns error
      bf3b787e
  9. 18 Aug, 2023 1 commit
  10. 16 Aug, 2023 3 commits
    • Sergei Petrunia's avatar
      MDEV-31432 tmp_table field accessed after free · 8aaacb55
      Sergei Petrunia authored
      Before this patch, the code in Item_field::print() used
      this convention (described in sql_explain.h:ExplainDataStructureLifetime):
      
      - By default, the table that Item_field refers to is accessible.
      - ANALYZE and SHOW {EXPLAIN|ANALYZE} may print Items after some
        temporary tables have been dropped. They use
        QT_DONT_ACCESS_TMP_TABLES flag. When it is ON, Item_field::print
        will not access the table it refers to, if it is a temp.table
      
      The bug was that EXPLAIN statement also may compute subqueries (depending
      on subquery context and @@expensive_subquery_limit setting). After the
      computation, the subquery calls JOIN::cleanup(true) which drops some of
      its temporary tables. Calling Item_field::print() that refer to such table
      will cause an access to free'd memory.
      
      In this patch, we take into account that query optimization can compute
      a subquery and discard its temporary tables. Item_field::print() now
      assumes that any temporary table might have already been dropped.
      This means QT_DONT_ACCESS_TMP_TABLES flag is not needed - we imply it is
      always present.
      
      But we also make one exception: derived tables are not freed in
      JOIN::cleanup() call. They are freed later in close_thread_tables(),
      at the same time when regular tables are closed.
      Because of that, Item_field::print may assume that temp.tables
      representing derived tables are available.
      
      Initial patch by: Rex Jonston
      Reviewed by: Monty <monty@mariadb.org>
      8aaacb55
    • Marko Mäkelä's avatar
      Merge 10.6 into 10.10 · 9cd29895
      Marko Mäkelä authored
      9cd29895
    • Alexander Barkov's avatar
      After-merge cleanup for MDEV-27207 + MDEV-31719 · 88dd50b8
      Alexander Barkov authored
      Something went wrong during a merge (from 10.5 to 10.6)
      of 68403eed
      (fixing bugs MDEV-27207 and MDEV-31719).
      
      Originally (in 10.5) the fix was done in_inet6::set() in
      plugin/type_inet/sql_type_inet.cc.
      In 10.6 this code resides in a different place:
      in the method in_fbt::set() of a template class
      in sql/sql_type_fixedbin.h.
      
      During the merge:
      - the fix did not properly migrate to in_fbt::set()
      - the related MTR tests disappeared
      
      This patch fixes in_fbt::set() properly and restores MTR tests.
      88dd50b8
  11. 15 Aug, 2023 17 commits
    • Monty's avatar
      MDEV-9938 Prepared statement return wrong result (missing row) · ca5c122a
      Monty authored
      The problem is that the first execution of the prepared statement makes
      a permanent optimization of converting the LEFT JOIN to an INNER JOIN.
      
      This is based on the assumption that all the user parameters (?) are
      always constants and that parameters to Item_cond() will not change value
      from true and false between different executions.
      
      (The example was using IS NULL, which will change value if parameter
      depending on if the parameter is NULL or not).
      
      The fix is to change Item_cond::fix_fields() and
      Item_cond::eval_not_null_tables() to not threat user parameters as
      constants. This will ensure that we don't do the LEFT_JOIN -> INNER
      JOIN conversion that causes problems.
      
      There is also some things that needs to be improved regarding
      calculations of not_null_tables_cache as we get a different value for
      WHERE 1 or t1.a=1
      compared to
      WHERE t1.a= or 1
      
      Changes done:
      - Mark Item_param with the PARAM flag to be able to quickly check
        in Item_cond::eval_not_null_tables() if an item contains a
        prepared statement parameter (just like we check for stored procedure
        parameters).
      - Fixed that Item_cond::not_null_tables_cache is not depending on
        order of arguments.
      - Don't call item->eval_const_cond() for items that are NOT on the top
        level of the WHERE clause. This removed a lot of unnecessary
        warnings in the test suite!
      - Do not reset not_null_tables_cache for not top level items.
      - Simplified Item_cond::fix_fields by calling eval_not_null_tables()
        instead of having duplication of all the code in
        eval_not_null_tables().
      - Return an error if Item_cond::fix_field() generates an error
        The old code did generate an error in some cases, but not in all
         cases.
        - Fixed all handling of the above error in make_cond_for_tables().
          The error handling by the callers did not exists before which
          could lead to asserts in many different places in the old code).
        - All changes in sql_select.cc are just checking the return value of
          fix_fields() and make_cond_for_tables() and returning an error
          value if fix_fields() returns true or make_cond_for_tables()
          returns NULL and is_error() is set.
      - Mark Item_cond as const_item if all arguments returns true for
        can_eval_in_optimize().
      
      Reviewer: Sergei Petrunia <sergey@mariadb.com>
      ca5c122a
    • Kristian Nielsen's avatar
      (Null) Merge 10.5 -> 10.6 · f6dd1308
      Kristian Nielsen authored
      Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
      f6dd1308
    • Kristian Nielsen's avatar
      Merge 10.4 into 10.5 · 7c9837ce
      Kristian Nielsen authored
      Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
      7c9837ce
    • Kristian Nielsen's avatar
      MDEV-31482: Lock wait timeout with INSERT-SELECT, autoinc, and statement-based replication · 805e0668
      Kristian Nielsen authored
      Remove the exception that InnoDB does not report auto-increment locks waits
      to the parallel replication.
      
      There was an assumption that these waits could not cause conflicts with
      in-order parallel replication and thus need not be reported. However, this
      assumption is wrong and it is possible to get conflicts that lead to hangs
      for the duration of --innodb-lock-wait-timeout. This can be seen with three
      transactions:
      
      1. T1 is waiting for T3 on an autoinc lock
      2. T2 is waiting for T1 to commit
      3. T3 is waiting on a normal row lock held by T2
      
      Here, T3 needs to be deadlock killed on the wait by T1.
      Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
      805e0668
    • Kristian Nielsen's avatar
      MDEV-31655: Parallel replication deadlock victim preference code errorneously removed · 18acbaf4
      Kristian Nielsen authored
      Restore code to make InnoDB choose the second transaction as a deadlock
      victim if two transactions deadlock that need to commit in-order for
      parallel replication. This code was erroneously removed when VATS was
      implemented in InnoDB.
      
      Also add a test case for InnoDB choosing the right deadlock victim.
      Also fixes this bug, with testcase that reliably reproduces:
      
      MDEV-28776: rpl.rpl_mark_optimize_tbl_ddl fails with timeout on sync_with_master
      Reviewed-by: default avatarMarko Mäkelä <marko.makela@mariadb.com>
      Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
      18acbaf4
    • Kristian Nielsen's avatar
      MDEV-31655: Parallel replication deadlock victim preference code errorneously removed · 900c4d69
      Kristian Nielsen authored
      Restore code to make InnoDB choose the second transaction as a deadlock
      victim if two transactions deadlock that need to commit in-order for
      parallel replication. This code was erroneously removed when VATS was
      implemented in InnoDB.
      
      Also add a test case for InnoDB choosing the right deadlock victim.
      Also fixes this bug, with testcase that reliably reproduces:
      
      MDEV-28776: rpl.rpl_mark_optimize_tbl_ddl fails with timeout on sync_with_master
      
      Note: This should be null-merged to 10.6, as a different fix is needed
      there due to InnoDB locking code changes.
      Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
      900c4d69
    • Kristian Nielsen's avatar
      MDEV-31482: Lock wait timeout with INSERT-SELECT, autoinc, and statement-based replication · 920789e9
      Kristian Nielsen authored
      Remove the exception that InnoDB does not report auto-increment locks waits
      to the parallel replication.
      
      There was an assumption that these waits could not cause conflicts with
      in-order parallel replication and thus need not be reported. However, this
      assumption is wrong and it is possible to get conflicts that lead to hangs
      for the duration of --innodb-lock-wait-timeout. This can be seen with three
      transactions:
      
      1. T1 is waiting for T3 on an autoinc lock
      2. T2 is waiting for T1 to commit
      3. T3 is waiting on a normal row lock held by T2
      
      Here, T3 needs to be deadlock killed on the wait by T1.
      
      Note: This should be null-merged to 10.6, as a different fix is needed
      there due to InnoDB lock code changes.
      Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
      920789e9
    • Marko Mäkelä's avatar
      Remove the often-hanging test innodb.alter_rename_files · b4ace139
      Marko Mäkelä authored
      The test innodb.alter_rename_files rather frequently hangs in
      checkpoint_set_now. The test was removed in MariaDB Server 10.5
      commit 37e7bde1 when the code that
      it aimed to cover was simplified. Starting with MariaDB Server 10.5
      the page flushing and log checkpointing is much simpler, handled
      by the single buf_flush_page_cleaner() thread.
      
      Let us remove the test to avoid occasional failures. We are not going
      to fix the cause of the failure in MariaDB Server 10.4.
      b4ace139
    • Marko Mäkelä's avatar
      Merge 10.6 into 10.10 · 17f5f1cb
      Marko Mäkelä authored
      17f5f1cb
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · 3fee1b44
      Marko Mäkelä authored
      3fee1b44
    • Marko Mäkelä's avatar
      Merge mariadb-10.10.6 into 10.10 · 5bbe2118
      Marko Mäkelä authored
      5bbe2118
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · 599c4d9a
      Marko Mäkelä authored
      599c4d9a
    • Marko Mäkelä's avatar
      Merge mariadb-10.4.31 into 10.4 · 6fdc6846
      Marko Mäkelä authored
      6fdc6846
    • Marko Mäkelä's avatar
      Merge mariadb-10.5.22 into 10.5 · 2e78465d
      Marko Mäkelä authored
      2e78465d
    • Marko Mäkelä's avatar
      Merge mariadb-10.6.15 into 10.6 · fc78b253
      Marko Mäkelä authored
      fc78b253
    • Alexander Barkov's avatar
      MDEV-24797 Column Compression - ERROR 1265 (01000): Data truncated for column · 9c8ae6dc
      Alexander Barkov authored
      Fix issue was earlier fixed by MDEV-31724. Only adding MTR tests.
      9c8ae6dc
    • Alexander Barkov's avatar
      MDEV-31724 Compressed varchar values lost on joins when sorting on columns from joined table(s) · 1fa7c9a3
      Alexander Barkov authored
      Field_varstring::get_copy_func() did not take into account
      that functions do_varstring1[_mb], do_varstring2[_mb] do not support
      compressed data.
      
      Changing the return value of Field_varstring::get_copy_func()
      to `do_field_string` if there is a compresion and truncation
      at the same time. This fixes the problem, so now it works as follows:
      - val_str() uncompresses the data
      - The prefix is then calculated on the uncompressed data
      
      Additionally, introducing two new copying functions
      - do_varstring1_no_truncation()
      - do_varstring2_no_truncation()
      
      Using new copying functions in cases when:
      - a Field_varstring with length_bytes==1 is changing to a longer
          Field_varstring with length_bytes==1
      - a Field_varstring with length_bytes==2 is changing to a longer
          Field_varstring with length_bytes==2
      
      In these cases we don't care neither of compression nor
      of multi-byte prefixes: the entire data gets fully copied
      from the source column to the target column as is.
      
      This is a kind of new optimization, but this also was needed
      to preserve existing MTR test results.
      1fa7c9a3
  12. 14 Aug, 2023 5 commits
  13. 11 Aug, 2023 1 commit
  14. 10 Aug, 2023 1 commit