1. 30 Jun, 2023 6 commits
  2. 28 Jun, 2023 4 commits
  3. 27 Jun, 2023 5 commits
  4. 26 Jun, 2023 5 commits
  5. 25 Jun, 2023 9 commits
  6. 21 Jun, 2023 3 commits
    • Brandon Nesterenko's avatar
      MDEV-29894: Calling a function from a different database in a slave side trigger crashes · c2d44ecb
      Brandon Nesterenko authored
      When opening and locking tables, if triggers will be invoked in a
      separate database, thd->set_db() is invoked, thus freeeing the memory
      and headers which thd->db had previously pointed to. In row based
      replication, the event execution logic initializes thd->db to point
      to the database which the event targets, which is owned by the
      corresponding table share (introduced in d9898c9a for MDEV-7409).
      The problem then, is that during the table opening and locking
      process for a row event, memory which belongs to the table share
      would be freed, which is not valid.
      
      This patch replaces the thd->reset_db() calls to thd->set_db(),
      which copies-by-value, rather than by reference. Then when the
      memory is freed, our copy of memory is freed, rather than memory
      which belongs to a table share.
      
      Notes:
        1. The call to change thd->db now happens on a higher-level, in
      Rows_log_event::do_apply_event() rather than ::do_exec_row(), in the
      call stack. This is because do_exec_row() is called within a loop,
      and each invocation would redundantly set and unset the db to the
      same value.
        2. thd->set_db() is only used if triggers are to be invoked, as
      there is no vulnerability in the non-trigger case, and copying
      memory would be an unnecessary inefficiency.
      
      Reviewed By:
      ============
      Andrei Elkin <andrei.elkin@mariadb.com>
      c2d44ecb
    • Monty's avatar
      MDEV-31375 Assertion `dbl_records <= s->records' failed with optimizer_use_condition_selectivity=1 · 3d617fdc
      Monty authored
      The reason for the crash wad that 'best splitting' optimization
      predicted less rows to be found than what opt_range did.
      This code in apply_selectivity_for_table(), when using use_cond_selectivity=1,
      was not prepared for this case which caused an assert in debug builds.
      Production builds is not affected.
      
      The fix is to choose the smaller of the two row counts. It will have a
      minimum on costs when using use_cond_selectivity=1 and should not cause
      any problems in production.
      3d617fdc
    • Monty's avatar
      MDEV-31494 Server crashes in ha_partition::index_blocks / get_key_scans_params · d3c81804
      Monty authored
      MDEV-31445 Server crashes in ha_partition::index_blocks / cost_for_index_read
      
      The crash happened in the case where partition pruning finds 0
      partitions.
      d3c81804
  7. 20 Jun, 2023 1 commit
  8. 19 Jun, 2023 3 commits
    • Tuukka Pasanen's avatar
      MDEV-31242: Make sure every Debian post/pre script is using bash · 01e9e395
      Tuukka Pasanen authored
      Make sure that every post and pre script are using bash
      and have set -e in next to shebang.
      
      Command set -e makes sure that if script fails in
      one command it will fail whole script.
      01e9e395
    • Meng-Hsiu Chiang's avatar
      Fix compiler warnings · 774dee9a
      Meng-Hsiu Chiang authored
      -Wdeprecated-declarations:
        Replace deprecated xmlXPathInit() with xmlInitParser()[1]
      
      -Wmaybe-uninitialized:
        `fil1` was initialized to 0 in commit 0138220f to fix compiler
        warnings, but `fil2` was missed.
      
      ref:
      [1]: https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathInit
      774dee9a
    • Zhibo Zhang's avatar
      MDEV-30188: Ensure all binlog* variables are visible as system variables · 34bbf37f
      Zhibo Zhang authored
      Turn the remaining three `binlog*` options binlog_do_db, binlog_ignore_db,
      binlog_rows_event_max_size into global variables so that they can be
      visible from the SQL user level. This is for audit / secure
      configuration check purposes.
      
      Create new MTR tests to make sure that the newly created global
      variables can be visible from the command line interface.
      
      Behavior before the code change:
      
          MariaDB [(none)]> SHOW GLOBAL VARIABLES WHERE
              -> Variable_name LIKE 'binlog_do_db' OR
              -> Variable_name LIKE 'binlog_ignore_db' OR
              -> Variable_name LIKE 'binlog_row_event_max_size';
          Empty set (0.001 sec)
      
      Behavior after the code change:
      
          MariaDB [(none)]> SHOW GLOBAL VARIABLES WHERE
              -> Variable_name LIKE 'binlog_do_db' OR
              -> Variable_name LIKE 'binlog_ignore_db' OR
              -> Variable_name LIKE 'binlog_row_event_max_size';
          +---------------------------+-------+
          | Variable_name             | Value |
          +---------------------------+-------+
          | binlog_do_db              |       |
          | binlog_ignore_db          |       |
          | binlog_row_event_max_size | 8192  |
          +---------------------------+-------+
          3 rows in set (0.001 sec)
      
      Note:
      
      For `binlog_do_db` and `binlog_ignore_db`, we add a new class
      `Sys_var_binlog_filter` to handle the dynamically-composable command line
      options for `binlog_do_db` and `binlog_ignore_db`. Below
      is the motivation:
      
      When the users start the server with the option
          --binlog-do-db="database1" --binlog-do-db="database2"
      The expected behavior is that the system should allow replication for
      both `database1` and `database2`, which is the logic of the original
      code.
      
      However, when turning the variables into system variables, the
      functionality does not exist any more, since system variables will only
      handle the last occurrence of the option, and in this case, the system
      will only be able to handle `database2`.
      
      Copyright:
      
      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.
      34bbf37f
  9. 18 Jun, 2023 1 commit
  10. 16 Jun, 2023 1 commit
  11. 15 Jun, 2023 1 commit
  12. 14 Jun, 2023 1 commit
    • Sergei Petrunia's avatar
      MDEV-31479: Inconsistency between MRR and SQL layer costs can cause poor query plan · 0e2e70c4
      Sergei Petrunia authored
      (Same as
      TODO-3938: best_access_path shows negative costs for mrr=on)
      
      best_access_path() assumes that quick select cost includes
      (quick->rows/TIME_FOR_COMPARE) as a cost of checking the attached
      part of the WHERE condition.
      
      It calls adjust_quick_cost() to subtract addition from quick's cost.
      
      The problem was that DS-MRR cost formula didn't include this cost.
      For very large tables, adjust_quick_cost() would produce a negative
      cost which would cause assert in debug build or bad query plan choice
      in release builds.
      Approved-by: default avatarMonty <monty@mariadb.org>
      0e2e70c4