1. 07 Mar, 2023 2 commits
  2. 06 Mar, 2023 1 commit
    • Marko Mäkelä's avatar
      MDEV-30567 rec_get_offsets() is not optimal · 66b21ed5
      Marko Mäkelä authored
      rec_init_offsets_comp_ordinary(), rec_init_offsets(),
      rec_get_offsets_reverse(), rec_get_nth_field_offs_old():
      Simplify some bitwise arithmetics to avoid conditional jumps,
      and add branch prediction hints with the assumption that most
      variable-length columns are short.
      
      Tested by: Matthias Leich
      66b21ed5
  3. 03 Mar, 2023 1 commit
  4. 02 Mar, 2023 3 commits
    • Igor Babaev's avatar
      MDEV-30706 Different results of selects from view and CTE with same definition · ccec9b1d
      Igor Babaev authored
      MDEV-30668 Set function aggregated in outer select used in view definition
      
      This patch fixes two bugs concerning views whose specifications contain
      subqueries with set functions aggregated in outer selects.
      Due to the first bug those such views that have implicit grouping were
      considered as mergeable. This led to wrong result sets for selects from
      these views.
      Due to the second bug the aggregation select was determined incorrectly and
      this led to bogus error messages.
      The patch added several test cases for these two bugs and for four other
      duplicate bugs.
      The patch also enables view-protocol for many other test cases.
      
      Approved by Oleksandr Byelkin <sanja@mariadb.com>
      ccec9b1d
    • Oleksandr Byelkin's avatar
      MDEV-26831 fallout: fix problems of name resolution cache · a6a906d7
      Oleksandr Byelkin authored
      - Avoid passing real field cache as a parameter when we check for duplicates.
      
      - Correct cache cleanup (cached field number also have to be reset).
      
      - Name resolution cache simple test added.
      a6a906d7
    • Hugo Wen's avatar
      Fix few vulnerabilities found by Cppcheck · 7bdd878a
      Hugo Wen authored
      While performing SAST scanning using Cppcheck against source code of
      commit 81196469, several code vulnerabilities were found.
      
      Fix following issues:
      
      1. Parameters of `snprintf` function are incorrect.
      
         Cppcheck error:
      
             client/mysql_plugin.c:1228: error: snprintf format string requires 6 parameters but only 5 are given.
      
         It is due to commit 630d7229 introduced option `--lc-messages-dir`
         in the bootstrap command. However the parameter was not even given
         in the `snprintf` after changing the format string.
      
         Fix:
         Restructure the code logic and correct the function parameters for
         `snprintf`.
      
      2. Null pointer is used in a `snprintf` which could cause a crash.
      
         Cppcheck error:
      
             extra/mariabackup/xbcloud.cc:2534: error: Null pointer dereference
      
         The code intended to print the swift_project name, if the
         opt_swift_project_id is NULL but opt_swift_project is not NULL.
         However the parameter of `snprintf` was mistakenly using
         `opt_swift_project_id`.
      
         Fix:
         Change to use the correct string from `opt_swift_project`.
      
      3. Potential double release of a memory
      
         Cppcheck error:
      
             plugin/auth_pam/testing/pam_mariadb_mtr.c:69: error: Memory pointed to by 'resp' is freed twice.
      
         A pointer `resp` is reused and allocated new memory after it has been
         freed. However, `resp` was not set to NULL after freed.
         Potential double release of the same pointer if the call back
         function doesn't allocate new memory for `resp` pointer.
      
         Fix:
         Set the `resp` pointer to NULL after the first free() to make sure
         the same address is not freed twice.
      
      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.
      7bdd878a
  5. 01 Mar, 2023 2 commits
    • Lorna Luo's avatar
      MDEV-22683: Ensure system tables are correctly upgraded in MariaDB 10.4 · acfb5dfd
      Lorna Luo authored
      Running mysql_upgrade should end up with the exact same system tables as fresh
      installations have after running mysql_install_db. To ensure the upgrade is
      correct and complete:
      
      - Remove the redundant modification of thread_id`. On 5.5 version, the
        `general_log` table was created as `CREATE TABLE IF NOT EXISTS general_log
        (..., thread_id INTEGER NOT NULL, ...)`, and starting from 10.0+, the table is
        created as `CREATE TABLE IF NOT EXISTS general_log (..., thread_id BIGINT(21)
        UNSIGNED NOT NULL, ...)`, but mysql_upgrade is not properly upgrading the
        table. It modifies the `thread_id` twice in one query, which could leave the
        table not modified and lead to other potential error when upgrading from
        MariaDB 5.5 or older.
      
      - Update `servers` to ensure `Host` and `User` has correct data type if
        upgrading from 10.1 or older. On versions 10.0 and 10.1, the `servers` table
        was created as `CREATE TABLE IF NOT EXISTS servers (..., Host char(64) NOT
        NULL DEFAULT , ..., Owner char(64) NOT NULL DEFAULT , ...)`, and starting
        from 10.2, the table is created as `CREATE TABLE IF NOT EXISTS servers (...,
        Host varchar(2048) NOT NULL DEFAULT , ..., Owner varchar(512) NOT NULL
        DEFAULT , ...)`.
      
      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.
      acfb5dfd
    • Alexander Barkov's avatar
      MDEV-30746 Regression in ucs2_general_mysql500_ci · 965bdf3e
      Alexander Barkov authored
      1. Adding a separate MY_COLLATION_HANDLER
         my_collation_ucs2_general_mysql500_ci_handler
         implementing a proper order for ucs2_general_mysql500_ci
         The problem happened because ucs2_general_mysql500_ci
         erroneously used my_collation_ucs2_general_ci_handler.
      
      2. Cosmetic changes: Renaming:
         - plane00_mysql500 to my_unicase_mysql500_page00
         - my_unicase_pages_mysql500 to my_unicase_mysql500_pages
         to use the same naming style with:
         - my_unicase_default_page00
         - my_unicase_defaul_pages
      
      3. Moving code fragments from
         - handler::check_collation_compatibility() in handler.cc
         - upgrade_collation() in table.cc
         into new methods in class Charset, to reuse the code easier.
      965bdf3e
  6. 27 Feb, 2023 1 commit
    • Igor Babaev's avatar
      MDEV-28603 Invalid view when its definition uses TVC as single-value subquery · 841e8877
      Igor Babaev authored
      Subselect_single_value_engine cannot handle table value constructor used as
      subquery. That's why any table value constructor TVC used as subquery is
      converted into a select over derived table whose specification is TVC.
      Currently the names  of the columns of the derived table DT are taken from
      the first element of TVC and if the k-th component of the element happens
      to be a subquery the text representation of this subquery serves as the
      name of the k-th column of the derived table. References of all columns of
      the derived table DT compose the select list of the result of the conversion.
      If a definition of a view contained a table value constructor used as a
      subquery and the view was registered after this conversion had been
      applied we could register an invalid view definition if the first element
      of TVC contained a subquery as its component: the name of this component
      was taken from the original subquery, while the name of the corresponding
      column of the derived table was taken from the text representation of the
      subquery produced by the function SELECT_LEX::print() and these names were
      usually differ from each other.
      To avoid registration of such invalid views the function SELECT_LEX::print()
      now prints the original TVC instead of the select in which this TVC has
      been wrapped. Now the specification of registered view looks like as if no
      conversions from TVC to selects were done.
      
      Approved by Oleksandr Byelkin <sanja@mariadb.com>
      841e8877
  7. 23 Feb, 2023 1 commit
  8. 21 Feb, 2023 5 commits
  9. 17 Feb, 2023 9 commits
  10. 16 Feb, 2023 1 commit
  11. 15 Feb, 2023 5 commits
    • Sergei Petrunia's avatar
      MDEV-30218: Incorrect optimization for rowid_filtering, correction · 2e687279
      Sergei Petrunia authored
      Final corrections:
      - Remove incorrect tracing, "rowid_filter_skipped"
      - Put the worst_seeks sanity check back
      2e687279
    • Igor Babaev's avatar
      MDEV-30218 Incorrect optimization for rowid_filtering · d1a46c68
      Igor Babaev authored
      Correction over the last patch for this MDEV.
      d1a46c68
    • Haidong Ji's avatar
      MDEV-29091: Correct event_name in PFS for wait caused by FOR UPDATE · 03c9a4ef
      Haidong Ji authored
      When one session SELECT ... FOR UPDATE and holds the lock, subsequent
      sessions that SELECT ... FOR UPDATE will wait to get the lock.
      Currently, that event is labeled as `wait/io/table/sql/handler`, which
      is incorrect. Instead, it should have been
      `wait/lock/table/sql/handler`.
      
      Two factors contribute to this bug:
      1. Instrumentation interface and the heavy usage of `TABLE_IO_WAIT` in
         `sql/handler.cc` file. See interface [^1] for better understanding;
      2. The balancing act [^2] of doing instrumentation aggregration _AND_
         having good performance. For example, EVENTS_WAITS_SUMMARY... is
         aggregated using EVENTS_WAITS_CURRENT. Aggregration needs to be based
         on the same wait class, and the code was overly aggressive in label a
         LOCK operation as an IO operation in this case.
      
      The proposed fix is pretty simple, but understanding the bug took a
      while. Hence the footnotes below.  For future improvement and
      refactoring, we may want to consider renaming `TABLE_IO_WAIT` and making
      it less coarse and more targeted.
      
      Note that newly added test case, events_waits_current_MDEV-29091,
      initially didn't pass Buildbot CI for embedded build tests.  Further
      research showed that other impacted tests all included not_embedded.inc.
      This oversight was fixed later.
      
      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.
      
      [^1]: To understand `performance_schema` instrumentation interface, I
      found this URL is the most helpful:
      https://dev.mysql.com/doc/dev/mysql-server/latest/PAGE_PFS_PSI.html
      [^2]: The best place to understand instrumentation projection,
      composition, and aggregration is through the source file. Although I
      prefer reading Doxygen produced html file, but for whatever reason, the
      rendering is not ideal. Here is link to 10.6's pfs.cc:
      https://github.com/MariaDB/server/blob/10.6/storage/perfschema/pfs.cc
      03c9a4ef
    • Daniel Black's avatar
      MDEV-30630 locale: Chinese error messages for ZH_CN · fab16653
      Daniel Black authored
      MDEV-28227 added the error messages in simplified characters.
      Lets use these for those running a zh_CN profile.
      
      From Haidong Ji in the MDEV, Taiwan/Hong Kong (zh_TW/zh_HK)
      would expect traditional characters so this is left for when
      we have these.
      fab16653
    • Robin Newhouse's avatar
      Backport GitLab CI to earlier branches · 60f96b58
      Robin Newhouse authored
      Add .gitlab-ci.yml file to earliest supported branch to enable
      automated building and testing for all MariaDB major branches.
      
      For 10.4 we use the bundled SSL to build MariaDB when the platform
      does not have OpenSSL 1.1 available. This requires the installation of
      gnutls-devel as a dependency of MariaDB Connector/C.
      OpenSSL 3.0 support was backported to MariaDB 10.5
      (see https://github.com/MariaDB/server/pull/2036, f0fa40ef, 8a9c1e9c)
      
      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.
      60f96b58
  12. 14 Feb, 2023 3 commits
  13. 10 Feb, 2023 1 commit
  14. 09 Feb, 2023 5 commits
    • Brandon Nesterenko's avatar
      MDEV-30608: rpl.rpl_delayed_parallel_slave_sbm sometimes fails with... · eecd4f14
      Brandon Nesterenko authored
      MDEV-30608: rpl.rpl_delayed_parallel_slave_sbm sometimes fails with Seconds_Behind_Master should not have used second transaction timestamp
      
      One of the constraints added in the MDEV-29639 patch, is that only
      the first event after idling should update last_master_timestamp;
      and as long as the replica has more events to execute, the variable
      should not be updated. The corresponding test,
      rpl_delayed_parallel_slave_sbm.test, aims to verify this; however,
      if the IO thread takes too long to queue events, the SQL thread can
      appear to catch up too fast.
      
      This fix ensures that the relay log has been fully written before
      executing the events.
      
      Note that the underlying cause of this test failure needs to be
      addressed as a bug-fix, this is a temporary fix to stop test
      failures. To track work on the bug-fix for the underlying issue,
      please see MDEV-30619.
      eecd4f14
    • Igor Babaev's avatar
      MDEV-30586 DELETE with aggregation in subquery of WHERE returns bogus error · c6376842
      Igor Babaev authored
      The parser code for single-table DELETE missed the call of the function
      LEX::check_main_unit_semantics(). As a result the the field nested level
      of SELECT_LEX structures remained set 0 for all non-top level selects.
      This could lead to different kind of problems. In particular this did not
      allow to determine properly the selects where set functions had to be
      aggregated when they were used in inner subqueries.
      
      Approved by Oleksandr Byelkin <sanja@mariadb.com>
      c6376842
    • Vicențiu Ciorbaru's avatar
      Apply clang-tidy to remove empty constructors / destructors · 08c85202
      Vicențiu Ciorbaru authored
      This patch is the result of running
      run-clang-tidy -fix -header-filter=.* -checks='-*,modernize-use-equals-default' .
      
      Code style changes have been done on top. The result of this change
      leads to the following improvements:
      
      1. Binary size reduction.
      * For a -DBUILD_CONFIG=mysql_release build, the binary size is reduced by
        ~400kb.
      * A raw -DCMAKE_BUILD_TYPE=Release reduces the binary size by ~1.4kb.
      
      2. Compiler can better understand the intent of the code, thus it leads
         to more optimization possibilities. Additionally it enabled detecting
         unused variables that had an empty default constructor but not marked
         so explicitly.
      
         Particular change required following this patch in sql/opt_range.cc
      
         result_keys, an unused template class Bitmap now correctly issues
         unused variable warnings.
      
         Setting Bitmap template class constructor to default allows the compiler
         to identify that there are no side-effects when instantiating the class.
         Previously the compiler could not issue the warning as it assumed Bitmap
         class (being a template) would not be performing a NO-OP for its default
         constructor. This prevented the "unused variable warning".
      08c85202
    • Vladislav Vaintroub's avatar
      MDEV-30624 HeidiSQL 12.3 · 8dab6614
      Vladislav Vaintroub authored
      8dab6614
    • Vladislav Vaintroub's avatar