1. 18 Jun, 2023 7 commits
    • Anel Husakovic's avatar
      MDEV-28343: sys.create_synonym_db fails with ER_VIEW_SELECT_TMPTABLE when... · 1c6d6317
      Anel Husakovic authored
      MDEV-28343: sys.create_synonym_db fails with ER_VIEW_SELECT_TMPTABLE when schema contains temporary tables
      
      - MDEV-28342 raised the error in case temporary table shadows base table
      - Now we are allowed to shadow base tables with temporary tables and
      `sys.create_synonym_db()` can easily check for existance of temporary table and
      ignore view creation, since it is not supported to create view from
      temporary table.
      Reviewed-by: default avatar&lt;monty@mariadb.org&gt;, <vicentiu@mariadb.org>
      1c6d6317
    • Monty's avatar
      MDEV-28351 Assertion `this->file->children_attached' failed in ha_myisammrg::info · b3919368
      Monty authored
      Reviewed-by: <vicentiu@mariadb.org>
      b3919368
    • Anel Husakovic's avatar
      MDEV-12459 Patch sysschema · d26001e3
      Anel Husakovic authored
      This commit updates sysschema to work with the new behaviour of show
      tables and information_schema.tables table showing temporary tables for
      current connection.
      Co-authored-by: default avatarMonty <monty@mariadb.org>
      Reviewer: <vicentiu@mariadb.org>
      d26001e3
    • Anel Husakovic's avatar
      MDEV-12459 Get temporary tables visible to the IS.tables for current connection · c654eba6
      Anel Husakovic authored
      Additionally fixes the bugs uncovered in:
        - `MDEV-28332: Alter on temporary table causes ER_TABLE_EXISTS_ERROR note`
          Since there is no `warning` issued by shadowing of base table, this MDEV
          is irrelevant. Keeping for review purposes and for future development
          in case shadowing is going to be implemented
        - `MDEV-28334: SHOW TABLE STATUS shows all temporary tables ignoring database and conditions`
        - `MDEV-28453: SHOW commands are inconsistent for temporary tables`
      
      Reviewed by: <monty@mariadb.org>,
                   <vicentiu@mariadb.org>
      c654eba6
    • Anel Husakovic's avatar
      Cosmetic fixes · 07f1b8d7
      Anel Husakovic authored
      Reviewer: <vicentiu@mariadb.org>
      07f1b8d7
    • Yuchen Pei's avatar
      MDEV-26137 Improve import tablespace workflow. · 056c83cc
      Yuchen Pei authored
      Allow ALTER TABLE ... IMPORT TABLESPACE without creating the table
      followed by discarding the tablespace.
      
      That is, assuming we want to import table t1 to t2, instead of
      
      CREATE TABLE t2 LIKE t1;
      ALTER TABLE t2 DISCARD TABLESPACE;
      FLUSH TABLES t1 FOR EXPORT;
      --copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg
      --copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd
      UNLOCK TABLES;
      ALTER TABLE t2 IMPORT TABLESPACE;
      
      We can simply do
      
      FLUSH TABLES t1 FOR EXPORT;
      --copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg
      --copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t2.frm
      --copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd
      UNLOCK TABLES;
      ALTER TABLE t2 IMPORT TABLESPACE;
      
      We achieve this by creating a "stub" table in the second scenario
      while opening the table, where t2 does not exist but needs to import
      from t1. The "stub" table is similar to a table that is created but
      then instructed to discard its tablespace.
      
      We include tests with various row formats, encryption, with indexes
      and auto-increment.
      Signed-off-by: default avatarYuchen Pei <yuchen.pei@mariadb.com>
      056c83cc
    • Sergei Golubchik's avatar
      MDEV-30188: fixes for 32-bit · 8ca18cc9
      Sergei Golubchik authored
      8ca18cc9
  2. 12 Jun, 2023 1 commit
    • Zhibo Zhang's avatar
      MDEV-30188: Ensure all binlog* variables are visible as system variables · bdee0de5
      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.
      bdee0de5
  3. 11 Jun, 2023 1 commit
  4. 08 Jun, 2023 16 commits
  5. 07 Jun, 2023 15 commits
    • Oleksandr Byelkin's avatar
      Merge branch '10.6' into 10.6.14 · 04f0b955
      Oleksandr Byelkin authored
      04f0b955
    • Monty's avatar
      MDEV-30944 Range_rowid_filter::fill() leaves file->keyread at MAX_KEY · ded4ed32
      Monty authored
      This test case exposed 2 different bugs:
      - When replacing a range with an index scan on a covering key
        in test_if_skip_sort_order() we didn't disable filtering.
        Filtering does not make much sense in this case.
        - Fixed by disabling filtering in this case.
      - Range_rowid_filter::fill() did not take into account that keyread
        could already active, which caused an assert when it tried to
        activate another keyread.
        - Fixed by remembering old keyread state at start and restoring it
          at end.
      
      Other things:
      - ha_start_keyread() allowed multiple calls. This is wrong, especially
        as we do no check if the index changed!
        I added an assert() to ensure that we don't call it there is already
        an active keyread.
      - ha_end_keyread() always called ha_extra(), even if keyread was not
        active.  Added a check to avoid the extra call.
      ded4ed32
    • Monty's avatar
      3ea8f306
    • Monty's avatar
      MDEV-31356: Range cost calculations does not take into account join_buffer · 07b02ab4
      Monty authored
      This patch also fixes
      MDEV-31391 Assertion `((best.records_out) == 0.0 ... failed
      
      Cost changes caused by this change:
      - range queries with join buffer now have a notable smaller cost.
      - range ranges are bit more expensive as the MULTI_RANGE_COST is now
        properly applied to it in all cases (this extra cost is equal to a
        key lookup).
      - table scan cost is slight smaller as we now assume data is cached in
        the engine after the first scan pass. (We did this before for range
        scans and other access methods).
      - partition tables had wrong values for max_row_blocks and
        max_index_blocks.  Correcting this, causes range access on
        partitioned tables to have slightly higher cost because of the
        increased estimated IO.
      - Using first match + join buffer caused 'filtered' to be calcualted
        wrong.  (Only affected EXPLAIN, not query costs).
      - Added cost_without_join_buffer to optimizer_trace.
      - check_quick_select() adjusted the number of rows according to persistent
        statistics, but did not adjust cost. Now fixed.
      
      The big change in the patch are:
      
      - In best_access_path(), where we now are using storing the cost in
        'ALL_READ_COST cost' and only converting it to a double at the end.
         This allows us to more exactly calculate the effect of the join_cache.
      - In JOIN_TAB::estimate_scan_time(), store the cost also in a
        ALL_READ_COST object.
      
      One of effect if this change is that when joining very small tables:
      
      t1    some_access_method
      t2    range
      t3    ALL         Use join buffer
      
      This is swiched to
      
      t1      some_access_method
      t3      ALL
      t2      range      use join buffer
      
      Both plans has the same cost, but as table scan in this case has less
      cost than rang, the table scan will be considered first and thus have
      precidence.
      
      Test case changes:
      - optimizer_trace          - Addition of cost_without_join_buffer
      - subselect_mat_cost_bugs  - Small tables and scan versus range
      - range & range_mrr_icp    - Range + join_cache is faster than ref
      - optimizer_trace          - cost_without_join_buffer, smaller scan cost,
                                   range setup cost.
      - mrr                      - range+join_buffer used as smaller cost
      07b02ab4
    • Daniel Bartholomew's avatar
    • Daniel Bartholomew's avatar
      bump the VERSION · 5b0fe277
      Daniel Bartholomew authored
      5b0fe277
    • Daniel Bartholomew's avatar
    • Daniel Bartholomew's avatar
      bump the VERSION · d6335d42
      Daniel Bartholomew authored
      d6335d42
    • Marko Mäkelä's avatar
      Merge mariadb-10.5.21 into 10.5 · 609b4e99
      Marko Mäkelä authored
      609b4e99
    • Daniel Bartholomew's avatar
      bump the VERSION · a2aaf26a
      Daniel Bartholomew authored
      a2aaf26a
    • Daniel Bartholomew's avatar
      bump the VERSION · 68b52ae3
      Daniel Bartholomew authored
      68b52ae3
    • Daniel Bartholomew's avatar
      bump the VERSION · 7b353805
      Daniel Bartholomew authored
      7b353805
    • Daniel Bartholomew's avatar
      bump the VERSION · a77939ec
      Daniel Bartholomew authored
      a77939ec
    • Daniel Bartholomew's avatar
      bump the VERSION · 91367e82
      Daniel Bartholomew authored
      91367e82
    • Marko Mäkelä's avatar
      Merge 10.10 into 10.11 · c04284e7
      Marko Mäkelä authored
      c04284e7