1. 09 Feb, 2023 4 commits
    • 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
  2. 08 Feb, 2023 2 commits
  3. 07 Feb, 2023 3 commits
    • Daniel Black's avatar
      MDEV-30554 RockDB libatomic linking on riscv64 · 17423c6c
      Daniel Black authored
      The existing storage/rocksdb/CMakeCache.txt defined
      ATOMIC_EXTRA_LIBS when atomics where required. This was
      determined by the toplevel configure.cmake test
      (HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC).
      
      As build_rocksdb.cmake is included after ATOMIC_EXTRA_LIBS
      was set, we just need to use it. As such no riscv64
      specific macro is needed in build_rocksdb.cmake.
      
      As highlighted by Gianfranco Costamagna (@LocutusOfBorg)
      in #2472 overwriting SYSTEM_LIBS was problematic.
      This is corrected in case in future SYSTEM_LIBS is changed
      elsewhere.
      
      Closes #2472.
      17423c6c
    • Daniel Black's avatar
      MDEV-30492 Crash when use mariabackup.exe with config 'innodb_flush_method=async_unbuffered' · ecc93c98
      Daniel Black authored
      Normalize innodb_flush_method, the same as the service, before
      attempting to print it.
      ecc93c98
    • Daniel Black's avatar
      MDEV-30558: ER_KILL_{,QUERY_}DENIED_ERROR - normalize id type · 762fe015
      Daniel Black authored
      The error string from ER_KILL_QUERY_DENIED_ERROR took a different
      type to ER_KILL_DENIED_ERROR for the thread id. This shows
      up in differences on 32 big endian arches like powerpc (Deb notation).
      
      Normalize the passing of the THD->id to its real type of my_thread_id,
      and cast to (long long) on output. As such normalize the
      ER_KILL_QUERY_DENIED_ERROR to that convention too.
      
      Note for upwards merge, convert the type to %lld on new translations
      of ER_KILL_QUERY_DENIED_ERROR.
      762fe015
  4. 06 Feb, 2023 3 commits
  5. 03 Feb, 2023 2 commits
  6. 30 Jan, 2023 2 commits
  7. 28 Jan, 2023 3 commits
  8. 27 Jan, 2023 1 commit
  9. 25 Jan, 2023 2 commits
    • Daniel Black's avatar
      CREDITS: re-instate Tencent Cloud · 765291d6
      Daniel Black authored
      This was an accidential deletion looking at an outdated list.
      765291d6
    • Yuchen Pei's avatar
      MDEV-30370 Fixing spider hang when server aborts · 284810b3
      Yuchen Pei authored
      This is Kentoku's patch for MDEV-22979 (e6e41f04 + 22a00977),
      which fixes 30370.
      
      It changes the wait to a timed wait for the first sts thread, which
      waits on server start to execute the init queries for spider. It also
      flips the flag init_command to false when the sts thread is being
      freed. With these changes the sts thread can check the flag regularly
      and abort the init_queries when it finds out the init_command is
      false. This avoids the deadlock that causes the problem in MDEV-30370.
      
      It also fixes MDEV-22979 for 10.4, but not 10.5. I have not tested
      higher versions for MDEV-22979.
      
      A test has also been done on MDEV-29904 to avoid regression, given
      MDEV-27233 is a similar problem and its patch caused the
      regression. The test passes for 10.4-11.0.
      
      However, this adhoc test only works consistently when placed in the
      main testsuite. We should not place spider tests in the main suite, so
      we do not include it in this commit. A patch for MDEV-27912 should fix
      this problem and allow a proper test for MDEV-29904. See comments in
      the jira ticket MDEV-30370/29904 for the adhoc testcase used for this
      commit.
      284810b3
  10. 24 Jan, 2023 7 commits
    • Vladislav Vaintroub's avatar
      MDEV-30457 Windows, signtool error "No file digest algorithm specified." · 2279ddda
      Vladislav Vaintroub authored
      Add /fd parameter. It is now mandatory for the recent versions of
      signtool
      2279ddda
    • Andrei's avatar
      MDEV-30323 Some DDLs like ANALYZE can complete on parallel slave out of order · 7fe93244
      Andrei authored
      ANALYZE was observed to race over a preceding in binlog order DML
      in updating the binlog and slave gtid states.
      
      Tagging ANALYZE and other admin class commands in binlog by the fixes
      of MDEV-17515 left a flaw allowing such race leading to
      the gtid mode out-of-order error.
      This is fixed now to observe by ADMIN commands the ordered access to
      the slave gtid status variables and binlog.
      7fe93244
    • Andrei's avatar
      MDEV-30010 Slave (additional info): Commit failed due to failure of an earlier... · 3aa04c0d
      Andrei authored
      MDEV-30010 Slave (additional info): Commit failed due to failure of an earlier commit on which this one depends Error_code: 1964
      
      This commit merely adds is a Read-Committed version MDEV-30225 test
      solely to prove the RC isolation yields ROW binlog format as it is
      supposed to per docs.
      3aa04c0d
    • Igor Babaev's avatar
      MDEV-30081 Crash with splitting from constant mergeable derived table · f513d715
      Igor Babaev authored
      This bug manifested itself in very rare situations when splitting
      optimization was applied to a materialized derived table with group clause
      by key over a constant meargeable derived table that was in inner part of
      an outer join. In this case the used tables for the key to access the
      split table incorrectly was evaluated to a not empty table map.
      
      Approved by Oleksandr Byelkin <sanja@mariadb.com>
      f513d715
    • Brandon Nesterenko's avatar
      MDEV-29639: Seconds_Behind_Master is incorrect for Delayed, Parallel Replicas · d69e8357
      Brandon Nesterenko authored
      Problem
      ========
      On a parallel, delayed replica, Seconds_Behind_Master will not be
      calculated until after MASTER_DELAY seconds have passed and the
      event has finished executing, resulting in potentially very large
      values of Seconds_Behind_Master (which could be much larger than the
      MASTER_DELAY parameter) for the entire duration the event is
      delayed. This contradicts the documented MASTER_DELAY behavior,
      which specifies how many seconds to withhold replicated events from
      execution.
      
      Solution
      ========
      After a parallel replica idles, the first event after idling should
      immediately update last_master_timestamp with the time that it began
      execution on the primary.
      
      Reviewed By
      ===========
      Andrei Elkin <andrei.elkin@mariadb.com>
      d69e8357
    • Sergei Petrunia's avatar
      2ed598ea
    • Ian Gilfillan's avatar
      Update 10.3 HELP tables · c4563032
      Ian Gilfillan authored
      c4563032
  11. 23 Jan, 2023 3 commits
    • Ian Gilfillan's avatar
      Update 10.4 HELP tables · 801c0b4b
      Ian Gilfillan authored
      801c0b4b
    • Igor Babaev's avatar
      MDEV-30248 Infinite sequence of recursive calls when processing embedded CTE · 074bef4d
      Igor Babaev authored
      This patch fixes the patch for bug MDEV-30248 that unsatisfactorily
      resolved the problem of resolution of references to CTE. In some cases
      when such a reference has the same table name as the name of one of
      CTEs containing this reference the reference could be resolved incorrectly
      that led to an invalid select tree where units could be mutually dependent.
      This in its turn could lead to an infinite sequence of recursive calls or
      to falls into infinite loops.
      
      The patch also removes LEX::resolve_references_to_cte_in_hanging_cte() as
      with the new code for resolution of CTE references the call of this
      function is not needed anymore.
      
      Approved by Oleksandr Byelkin <sanja@mariadb.com>
      074bef4d
    • Sergei Petrunia's avatar
      MDEV-15178: Filesort::make_sortorder: Assertion `pos->field != __null | · f18c2b6c
      Sergei Petrunia authored
      (Initial patch by Varun Gupta. Amended and added comments).
      
      When the query has both
      1. Aggregate functions that require sorting data by group, and
      2. Window functions
      
      we need to use two temporary tables. The first temp.table will hold the
      join output.  Then it is passed to filesort(). Reading it in sorted
      order allows to compute the aggregate functions.
      
      Then, we need to write their values into the second temp. table. Then,
      Window Function computation step can pass that to filesort() and read
      them in the order it needs.
      
      Failure to create the second temp. table would cause an assertion
      failure: window function could would not find where to get the values
      of the aggregate functions.
      f18c2b6c
  12. 20 Jan, 2023 8 commits
    • Sergei Golubchik's avatar
    • Sergei Golubchik's avatar
      MDEV-26817 runtime error: index 24320 out of bounds for type... · 0c275599
      Sergei Golubchik authored
      MDEV-26817 runtime error: index 24320 out of bounds for type 'json_string_char_classes [128] *and* ASAN: global-buffer-overflow on address ... READ of size 4 on SELECT JSON_VALID
      
      protect from out-of-bound array access
      
      it was already done in all other places, this one was the only one missed
      0c275599
    • Sergei Golubchik's avatar
      MDEV-29199 Unique hash key is ignored upon INSERT ... SELECT into non-empty MyISAM table · fc292f42
      Sergei Golubchik authored
      disable bulk insert optimization if long uniques are used, because they
      need to read the table (index_read) after every inserted now. And bulk
      insert optimization might disable indexes.
      
      bulk insert is already disabled in other cases when there are chances
      that the table will be read duing the bulk insert.
      fc292f42
    • Sergei Golubchik's avatar
      MDEV-27631 Assertion `global_status_var.global_memory_used == 0' failed in mysqld_exit · db50919f
      Sergei Golubchik authored
      plugin_vars_free_values() was walking plugin sysvars and thus
      did not free memory of plugin PLUGIN_VAR_NOSYSVAR vars.
      
      * change it to walk all plugin vars
      * add the pluginname_ prefix to NOSYSVARS var names too,
        so that plugin_vars_free_values() would be able to find their
        bookmarks
      db50919f
    • Vicențiu Ciorbaru's avatar
      Fix connect bson.cpp warning · 00150ff8
      Vicențiu Ciorbaru authored
      The ptyp variable is unused.
      00150ff8
    • Vicențiu Ciorbaru's avatar
      Fix mroonga warning of use-after-free · 244bf37c
      Vicențiu Ciorbaru authored
      244bf37c
    • Mikhail Chalov's avatar
      Minimize unsafe C functions usage - replace strcat() and strcpy() (and... · 567b6812
      Mikhail Chalov authored
      Minimize unsafe C functions usage - replace strcat() and strcpy() (and strncat() and strncpy()) with custom safe_strcat() and safe_strcpy() functions
      
      The MariaDB code base uses strcat() and strcpy() in several
      places. These are known to have memory safety issues and their usage is
      discouraged. Common security scanners like Flawfinder flags them. In MariaDB we
      should start using modern and safer variants on these functions.
      
      This is similar to memory issues fixes in 19af1890
      and 9de9f105 but now replace use of strcat()
      and strcpy() with safer options strncat() and strncpy().
      
      However, add '\0' forcefully to make sure the result string is correct since
      for these two functions it is not guaranteed what new string will be null-terminated.
      
      Example:
      
          size_t dest_len = sizeof(g->Message);
          strncpy(g->Message, "Null json tree", dest_len); strncat(g->Message, ":",
          sizeof(g->Message) - strlen(g->Message)); size_t wrote_sz = strlen(g->Message);
          size_t cur_len = wrote_sz >= dest_len ? dest_len - 1 : wrote_sz;
          g->Message[cur_len] = '\0';
      
      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
      
      -- Reviewer and co-author Vicențiu Ciorbaru <vicentiu@mariadb.org>
      -- Reviewer additions:
      * The initial function implementation was flawed. Replaced with a simpler
        and also correct version.
      * Simplified code by making use of snprintf instead of chaining strcat.
      * Simplified code by removing dynamic string construction in the first
        place and using static strings if possible. See connect storage engine
        changes.
      567b6812
    • Jan Lindström's avatar