1. 03 Aug, 2024 1 commit
    • Oleg Smirnov's avatar
      MDEV-34683 Types mismatch when cloning items causes debug assertion · cf202dec
      Oleg Smirnov authored
      New runtime type diagnostic (MDEV-34490) has detected that classes
      Item_func_eq, Item_default_value and Item_date_literal_for_invalid_dates
      incorrectly return an instance of its ancestor classes when being cloned.
      This commit fixes that.
      
      Additionally, it fixes a bug at Item_func_case_simple::do_build_clone()
      which led to an endless loop of cloning functions calls.
      
      Reviewer: Oleksandr Byelkin <sanja@mariadb.com>
      cf202dec
  2. 01 Aug, 2024 2 commits
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-29010 Table cannot be loaded after instant ALTER · 37119cd2
      Thirunarayanan Balathandayuthapani authored
      Reason:
      ======
      - InnoDB fails to load the instant alter table metadata from
      clustered index while loading the table definition.
      The reason is that InnoDB metadata blob has the column length
      exceeds maximum fixed length column size.
      
      Fix:
      ===
      - InnoDB should treat the long fixed length column as variable
      length fields that needs external storage while initializing
      the field map for instant alter operation
      37119cd2
    • Galina Shalygina's avatar
      MDEV-23983: Crash caused by query containing constant having clause · d072a296
      Galina Shalygina authored
      Before this patch the crash occured when a single row dataset is used and
      Item::remove_eq_conds() is called for HAVING. This function is not supposed
      to be called after the elimination of multiple equalities.
      
      To fix this problem instead of Item::remove_eq_conds() Item::val_int() is
      used. In this case the optimizer tries to evaluate the condition for the
      single row dataset and discovers impossible HAVING immediately. So, the
      execution phase is skipped.
      
      Approved by Igor Babaev <igor@maridb.com>
      d072a296
  3. 31 Jul, 2024 2 commits
    • Brandon Nesterenko's avatar
      MDEV-15393: Fix rpl_mysqldump_gtid_slave_pos · 001608de
      Brandon Nesterenko authored
      The slave would try to sync_with_master_gtid.inc,
      but the master never actually saved its gtid position
      so the test would move on too quickly.
      001608de
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-34670 IMPORT TABLESPACE unnecessary traverses tablespace list · 533e6d5d
      Thirunarayanan Balathandayuthapani authored
      Problem:
      ========
      - After the commit ada1074b (MDEV-14398)
      fil_crypt_set_encrypt_tables() iterates through all tablespaces to
      fill the default_encrypt tables list. This was a trigger to
      encrypt or decrypt when key rotation age is set to 0. But import
      tablespace does call fil_crypt_set_encrypt_tables() unnecessarily.
      The motivation for the call is to signal the encryption threads.
      
      Fix:
      ====
      ha_innobase::discard_or_import_tablespace: Remove the
      fil_crypt_set_encrypt_tables() and add the import tablespace
      to the default encrypt list if necessary
      533e6d5d
  4. 30 Jul, 2024 2 commits
  5. 29 Jul, 2024 3 commits
    • Rex's avatar
      MDEV-34506 2nd execution name resolution problem with pushdown into unions · 48b256a7
      Rex authored
      Statements affected by this bug need all the following to be true
      1) a derived table table or view whose specification contains a set
           operation at the top level.
      2) a grouping operator (group by/having) operating on a column alias
           other than in the first select of the union/intersect
      3) an outer condition that will be pushed into all selects in this
           union/intersect, either into the where or having clause
      
      When pushing a condition into all selects of a unit with more than one
      select, pushdown_cond_for_derived() renames items so we can re-use the
      condition being pushed.
      These names need to be saved and reset for correct name resolution on
      second execution of prepared statements.
      
      Reviewed by Igor Babaev (igor@mariadb.com)
      48b256a7
    • Marko Mäkelä's avatar
      MDEV-34502 fixup: Do not cripple MSAN · 7e5c9ccd
      Marko Mäkelä authored
      We need to work around deficiencies of Valgrind, and apparently
      the previous work-around attempts
      (such as d247d649) do not work
      anymore, definitely not on recent clang-based compilers.
      
      MemorySanitizer should be fine; unfortunately we set HAVE_valgrind for it
      as well.
      7e5c9ccd
    • Marko Mäkelä's avatar
      MDEV-34565: SIGILL due to OS not supporting AVX512 · 232d7a5e
      Marko Mäkelä authored
      It is not sufficient to check that the CPU supports the necessary
      instructions. Also the operating system (or virtual machine hypervisor)
      must enable all the AVX registers to be saved and restored on a
      context switch.
      
      Because clang 8 does not support the compiler intrinsic _xgetbv()
      we will require clang 9 or later for enabling the use of VPCLMULQDQ
      and the related AVX512 features.
      232d7a5e
  6. 27 Jul, 2024 1 commit
  7. 25 Jul, 2024 1 commit
  8. 24 Jul, 2024 1 commit
  9. 23 Jul, 2024 1 commit
    • Oleg Smirnov's avatar
      MDEV-34634 Types mismatch when cloning items causes debug assertion · c91aeb37
      Oleg Smirnov authored
      New runtime diagnostic introduced with MDEV-34490 has detected
      that `Item_int_with_ref` incorrectly returns an instance of its ancestor
      class `Item_int`. This commit fixes that.
      
      In addition, this commit reverts a part of the diagnostic related
      to `clone_item()` checks. As it turned out, `clone_item()` is not required
      to return an object of the same class as the cloned one. For example,
      look at `Item_param::clone_item()`: it can return objects of `Item_null`,
      `Item_int`, `Item_string`, etc, depending on the object state.
      So the runtime type diagnostic is not applicable to `clone_item()` and
      is disabled with this commit.
      
      As the similar diagnostic failures are expected to appear again
      in the future, this commit introduces a new test file in the main suite:
      item_types.test, and new test cases may be added to this file
      
      Reviewer: Oleksandr Byelkin <sanja@mariadb.com>
      c91aeb37
  10. 19 Jul, 2024 2 commits
    • Andrei's avatar
      MDEV-15393 gtid_slave_pos duplicate key errors after mysqldump restore · b8f92ade
      Andrei authored
      When mysqldump is run to dump the `mysql` system database, it generates
      INSERT statements into the table `mysql.gtid_slave_pos`.
      After running the backup script
      those inserts did not produce the expected gtid state on slave. In
      particular the maximum of mysql.gtid_slave_pos.sub_id did not make
      into
         rpl_global_gtid_slave_state.last_sub_id
      
      an in-memory object that is supposed to match the current state of the
      table. And that was regardless of whether --gtid option was specified
      or not. Later when the backup recipient server starts as slave
      in *non-gtid* mode this desychronization may lead to a duplicate key
      error.
      
      This effect is corrected for --gtid mode mysqldump/mariadb-dump only
      as the following.  The fixes ensure the insert block of the dump
      script is followed with a "summing-up" SET @global.gtid_slave_pos
      assignment.
      
      For the implemenation part, note a deferred print-out of
      SET-gtid_slave_pos and associated comments is prefered over relocating
      of the entire blocks if (opt_master,slave_data &&
      do_show_master,slave_status) ...  because of compatiblity
      concern. Namely an error inside do_show_*() is handled in the new code
      the same way, as early as, as before.
      
      A regression test can be run in how-to-reproduce mode as well.
      One affected mtr test observed.
      rpl_mysqldump_slave.result "mismatch" shows now the new deferring print
      of SET-gtid_slave_pos policy in action.
      b8f92ade
    • Oleksandr Byelkin's avatar
      Fix view protocol · b8b6cab2
      Oleksandr Byelkin authored
      b8b6cab2
  11. 18 Jul, 2024 1 commit
  12. 17 Jul, 2024 21 commits
    • Brandon Nesterenko's avatar
      MDEV-33921: Fix rpl_xa_empty_transaction.test · a061ae10
      Brandon Nesterenko authored
      The test was missing a save_master_gtid.inc on the master,
      leading to the slave thinking it was in sync after executing
      sync_with_master_gtid.inc, despite not having executed the
      latest transaction. This skipped transaction, XA COMMIT,
      was supposed to error-to-be-ignored because its XID could not
      be found, but be thrown out because the replication filters
      would filter out the target database. However, if the slave
      was able to stop before executing the transaction, then
      the replication filer is reset (to empty), and when the
      slave is later restarted, that transactions error would
      no longer be ignored.
      
      Additionally, as the test cases added in MDEV-33921 rely
      on GTID synchronization, the test cases now force
      master_use_gtid=slave_pos for consistency
      a061ae10
    • Sergei Golubchik's avatar
      MDEV-34353 Revert "don't wait indefinitely for signal handler in --bootstrap" · 36b867ad
      Sergei Golubchik authored
      This reverts commit 938b9293. Not needed after 90d376e0.
      36b867ad
    • Sergei Golubchik's avatar
      MDEV-34539 Invalid "use" and "Schema" in slow query log file with multi-line schema · 8d813f08
      Sergei Golubchik authored
      quote a database name in the slow log
      8d813f08
    • Sergei Golubchik's avatar
      MDEV-34530 dead code in the thr_rwlock.c · f12634f5
      Sergei Golubchik authored
      remove it
      f12634f5
    • Sergei Golubchik's avatar
      MDEV-34434 Hide password passed on commandline from xtrabackup_info · 7ba12d42
      Sergei Golubchik authored
      refine mariadb-backup password zapping check
      7ba12d42
    • Sergei Golubchik's avatar
      d2051816
    • Sergei Golubchik's avatar
      MDEV-34318 mariadb-dump SQL syntax error with MAX_STATEMENT_TIME against Percona MySQL server · d60f5c11
      Sergei Golubchik authored
      protect MariaDB conditional comments from a bug
      in Percona MySQL comment parser
      d60f5c11
    • Sergei Golubchik's avatar
      MDEV-32155 MariaDB Server crashes with ill-formed partitions · dea5746d
      Sergei Golubchik authored
      for ALTER_PARTITION_ADMIN (CHECK/REPAIR/LOAD INDEX/CACHE INDEX/etc)
      partitioning marks affected partitions with PART_ADMIN state.
      
      The assumption is that the server will call a corresponding
      method of ha_partition which will reset the state back to PART_NORMAL.
      
      This assumption is invalid, the server is not required to do so,
      indeed, in CHECK ... FOR UPGRADE the server might decide early that
      the table is fine and won't call ha_partition::check(), leaving
      partitions in the wrong state. It will thus leak into the next
      statement confusing the engine about what it is doing (see
      ha_partition::create_handler_file()), causing a crash later.
      
      Let's force all partitions into PART_NORMAL state after the admin
      operation succeeded, in case it did so without consulting the engine.
      dea5746d
    • Sergei Golubchik's avatar
    • Rucha Deodhar's avatar
      MDEV-32456: incorrect result of gis function in view protocol · 1f28350b
      Rucha Deodhar authored
      There are 3 diff in result:
      1) NULL value from SELECT
      Due to incorrect truncating of the hex value, incorrect value is
      written instead of original value to the view frm. This results in reading
      incorrect value from frm, so eventual result is NULL.
      2) 'Name_exp1' in column name (in gis.test)
      This was because the identifier in SELECT is longer than 64 characters,
      so 'Name_exp1' alias is also written to the view frm.
      3)diff in explain extended
      This was because the query plan for view protocol doesn't
      contain database name. As a fix, disable view protocol for that particular
      query.
      1f28350b
    • Souradeep Saha's avatar
      Refactor import * with only required imports · 4a89f79b
      Souradeep Saha authored
      Import only the required functions instead of all the functions from the
      module to reduce the unnecessary functions in the namespace and prevent
      shadowing. Note: All code changes are non-functional.
      
      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.
      4a89f79b
    • Robin Newhouse's avatar
      GitLab CI Upgrade CentOS 8 to CentOS 9 build · 008bddaa
      Robin Newhouse authored
      > After May 31, 2024, CentOS Stream 8 will be archived and no further
      updates will be provided. [1]
      
      CentOS Stream 8 is now EOL and should be updated to using CentOS Stream
      9 for compatibility testing in GitLab CI.
      
      [1] https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/
      https://www.centos.org/centos-linux-eol/
      
      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.
      008bddaa
    • Oleksandr Byelkin's avatar
      new CC version · e7c2e25b
      Oleksandr Byelkin authored
      e7c2e25b
    • Oleksandr Byelkin's avatar
      new PCRE2-10.44 · 7478fabc
      Oleksandr Byelkin authored
      7478fabc
    • Alexander Barkov's avatar
      MDEV-28345 ASAN: use-after-poison or unknown-crash in my_strtod_int from... · b777b749
      Alexander Barkov authored
      MDEV-28345 ASAN: use-after-poison or unknown-crash in my_strtod_int from charset_info_st::strntod or test_if_number
      
      This patch fixes two problems:
      
      - The code inside my_strtod_int() in strings/dtoa.c could test the byte
        behind the end of the string when processing the mantissa.
        Rewriting the code to avoid this.
      
      - The code in test_if_number() in sql/sql_analyse.cc called my_atof()
        which is unsafe and makes the called my_strtod_int() look behind
        the end of the string if the input string is not 0-terminated.
        Fixing test_if_number() to use my_strtod() instead, passing the correct
        end pointer.
      b777b749
    • Sutou Kouhei's avatar
      MDEV-21166 Add Mroonga initialized check to Mroonga UDFs · 383d53ed
      Sutou Kouhei authored
      Mroonga UDFs can't be used without loading Mroonga.
      383d53ed
    • PinkFreud's avatar
      MDEV-34604 mytop - fix specifying filters in .mytop · 49dff5a4
      PinkFreud authored
      Specifying filters (filter_status, filter_user, etc) in the mytop config
      previously wouldn't work, because any filter specified here was added to
      the config hash as a literal string.
      
      This change fixes that - if filter_* is defined in the config and matches
      an existing filter_* key, then run the value through StringOrRegex() and
      assign to the config hash.
      49dff5a4
    • Yuchen Pei's avatar
      MDEV-30408 Reset explicit_limit in exists2in · 03a35037
      Yuchen Pei authored
      Item_exists_subselect::fix_length_and_dec() sets explicit_limit to 1.
      In the exists2in transformation it resets select_limit to NULL. For
      consistency we should reset explicity_limit too.
      
      This fixes a bug where spider table returns wrong results for queries
      that gets through exists2in transformation when semijoin is off.
      03a35037
    • Yuchen Pei's avatar
      MDEV-32627 [fixup] Spider: Fix conn key length · 8416fd32
      Yuchen Pei authored
      To avoid off-by-one in spider_get_share.
      
      And document conn key and conn key length.
      8416fd32
    • Yuchen Pei's avatar
      MDEV-32627 Distinguish between absence of a keyword and empty value for the keyword · 20d99f3f
      Yuchen Pei authored
      Distinguish them in two place:
      
      when constructing connection key in create_conn_key and
      spider_create_conn for both ordinary queries and spider_direct_sql
      
      For spider_create_conn and spider_udf_direct_sql_create_conn, the
      created conn gets assigned a field from the source object if and only
      if source->field is non-null.
      
      For spider_create_conn_keys and spider_udf_direct_sql_create_conn_key,
      we update the encoding so that absence of keyword and keyword with an
      empty value result in different keys. More specifically, if the i-th
      keyword has a value, the corresponding part in the conn key begins
      with the char \i, followed by the possibly empty value and ends with a
      \0. If the i-th keyword is not specified, then it does not get a
      mention in the conn key.
      
      As part of this change, we also update table param / option parsing to
      recognise a singleton empty string when creating an string list,
      instead of writing it off as NULL.
      20d99f3f
    • Yuchen Pei's avatar
      MDEV-32627 Spider: add tests for connection param overriding · 6f3baec4
      Yuchen Pei authored
      When connection parameters are specified in COMMENT, CONNECTION and
      SERVER, they are overriden in the following order:
      
      COMMENT > CONNECTION > SERVER
      6f3baec4
  13. 16 Jul, 2024 2 commits
    • Tuukka Pasanen's avatar
      MDEV-33837: Workaround chown warnings · 62dfd0c0
      Tuukka Pasanen authored
      Blindly recursive chown is not way to do it.
      This Workaround is not much better than just chown -R but
      there is small adjustment just chown MariaDB statedir and logdir
      then with find only chown those files that are not correctly
      owned.
      
      Fixes lintian warnings:
       * W: mariadb-server: recursive-privilege-change "chown -R" [postinst:*]
       * W: mariadb-server: recursive-privilege-change "chown -R" [postinst:*]
      62dfd0c0
    • Oleg Smirnov's avatar
      MDEV-33010 Crash when pushing condition with CHARSET()/COERCIBILITY() into derived table · 972879f4
      Oleg Smirnov authored
      Based on the current logic, objects of classes Item_func_charset and
      Item_func_coercibility (responsible for CHARSET() and COERCIBILITY()
      functions) are always considered constant.
      However, SQL syntax allows their use in a non-constant manner, such as
      CHARSET(t1.a), COERCIBILITY(t1.a).
      
      In these cases, the `used_tables()` parameter corresponds to table names
      in the function parameters, creating an inconsistency: the item is marked
      as constant but accesses tables. This leads to crashes when
      conditions with CHARSET()/COERCIBILITY() are pushed into derived tables.
      
      This commit addresses the issue by setting `used_tables()` to 0 for
      `Item_func_charset` and `Item_func_coercibility`. Additionally, the items
      now store the return values during the preparation phase and return
      them during the execution phase. This ensures that the items do not call
      its arguments methods during the execution and are truly constant.
      
      Reviewer: Alexander Barkov <bar@mariadb.com>
      972879f4