1. 25 Oct, 2022 3 commits
    • Sergei Golubchik's avatar
      cleanup: put casts in a separate statement · 72e79eaa
      Sergei Golubchik authored
      remove useless if()
      72e79eaa
    • Lawrin Novitsky's avatar
      MDEV-29490 Renaming internally used client API to avoid name conflicts · 1ff476b4
      Lawrin Novitsky authored
      with C/C.
      The patch introduces mariadb_capi_rename.h which is included into
      mysql.h. The hew header contains macro definitions for the names being
      renamed. In versions 10.6+(i.e. where sql service exists) the renaming
      condition in the mariadb_capi_rename.h should be added with
      && !defined(MYSQL_DYNAMIC_PLUGIN)
      and look like
      The patch also contains removal of mysql.h from the api check.
      
      Disabling false_duper-6543 test for embedded.
      
      ha_federated.so uses C API. C API functions are being renamed in the server,
      but not renamed in embedded, since embedded server library should have proper
      C API, as expected by programs using it.
      Thus the same ha_federated.so cannot work both for server and embedded
      server library.
      
      As all federated tests are already disabled for embedded,
      federated isn't supposed to work for embedded anyway, and thus the test
      is being disabled.
      1ff476b4
    • Vladislav Vaintroub's avatar
      MDEV-29811 server advertises ssl even if it's unusable. · 32158be7
      Vladislav Vaintroub authored
      Abort startup, if SSL setup fails.
      Also, for the server always check that certificate matches private key
      (even if ssl_cert is not set, OpenSSL will try to use default one)
      32158be7
  2. 24 Oct, 2022 4 commits
  3. 22 Oct, 2022 8 commits
  4. 21 Oct, 2022 5 commits
  5. 19 Oct, 2022 4 commits
  6. 18 Oct, 2022 3 commits
    • Daniel Black's avatar
      MDEV-29540 Incorrect sequence values in INSERT SELECT · 8c389393
      Daniel Black authored
      The population of default values in INSERT SELECT was being
      performed twice. With sequences, this resulted in every
      second sequence value being used.
      
      With SELECT INSERT we remove the second invokation of
      table->update_default_fields(). This was already performed
      in store_values() invoking fill_record_n_invoke_before_triggers()
      which invoked update_default_fields() previously.
      
      We do need to return an error on duplicate values, so the
      ::store_values is extended to take the ignore option.
      8c389393
    • Marko Mäkelä's avatar
    • Anel Husakovic's avatar
      MDEV-28455: CREATE TEMPORARY TABLES privilege is insufficient for SHOW COLUMNS · 64f822c1
      Anel Husakovic authored
      =========== Problem =============
      - `show columns` is not working for temporary tables, even though there
      is enough privilege `create temporary tables`.
      =========== Solution =============
      - Append `TMP_TABLE_ACLS` privilege when running `show columns` for temp
      tables.
      - Additionally `check_access()` for database only once, not for each
      field
      =========== Additionally =============
      - Update comments for function `check_table_access` arguments
      
      Reviewed by: <vicentiu@mariadb.org>
      64f822c1
  7. 17 Oct, 2022 1 commit
    • Dmitry Shulga's avatar
      MDEV-16128: Server crash in Item_func::print_op on 2nd execution of PS · bd9274fa
      Dmitry Shulga authored
      For some queries that involve tables with different but convertible
      character sets for columns taking part in the query, repeatable
      execution of such queries in PS mode or as part of a stored routine
      would result in server abnormal termination.
      
      For example,
        CREATE TABLE t1 (a2 varchar(10));
        CREATE TABLE t2 (u1 varchar(10) CHARACTER SET utf8);
        CREATE TABLE t3 (u2 varchar(10) CHARACTER SET utf8);
        PREPARE stmt FROM
          "SELECT t1.* FROM (t1 JOIN t2 ON (t2.u1 = t1.a2))
           WHERE (EXISTS (SELECT 1 FROM t3 WHERE t3.u2 = t1.a2))";
      
        EXECUTE stmt;
        EXECUTE stmt; <== Running this prepared statement the second time
                          results in server crash.
      
      The reason of server crash is that an instance of the class
      Item_func_conv_charset, that created for conversion of a column
      from one character set to another, is allocated on execution
      memory root but pointer to this instance is stored in an item
      placed on prepared statement memory root. Below is calls trace to
      the place where an instance of the class Item_func_conv_charset
      is created.
      
      setup_conds
       Item_func::fix_fields
        Item_bool_rowready_func2::fix_length_and_dec
         Item_func::setup_args_and_comparator
          Item_func_or_sum::agg_arg_charsets_for_comparison
           Item_func_or_sum::agg_arg_charsets
            Item_func_or_sum::agg_item_set_converter
             Item::safe_charset_converter
      
      And the following trace shows the place where a pointer to
      the instance of the class Item_func_conv_charset is passed
      to the class Item_func_eq, that is created on a memory root of
      the prepared statement.
      
      Prepared_statement::execute
       mysql_execute_command
        execute_sqlcom_select
         handle_select
          mysql_select
           JOIN::optimize
            JOIN::optimize_inner
             convert_join_subqueries_to_semijoins
              convert_subq_to_sj
      
      To fix the issue, switch to the Prepared Statement memory root
      before calling the method Item_func::setup_args_and_comparator
      in order to place any created Items on permanent memory root.
      It may seem that such approach would result in a memory
      leakage in case the parameter marker '?' is used in the query
      as in the following example
        PREPARE stmt FROM
          "SELECT t1.* FROM (t1 JOIN t2 ON (t2.u1 = t1.a2))
           WHERE (EXISTS (SELECT 1 FROM t3 WHERE t3.u2 = ?))";
        EXECUTE stmt USING convert('A' using latin1);
      but it wouldn't since for such case any of the parameter markers
      is treated as a constant and no subquery to semijoin optimization
      is performed.
      bd9274fa
  8. 16 Oct, 2022 3 commits
  9. 15 Oct, 2022 1 commit
  10. 14 Oct, 2022 3 commits
  11. 13 Oct, 2022 1 commit
  12. 12 Oct, 2022 2 commits
    • Nikita Malyavin's avatar
      MDEV-29753 An error is wrongly reported during INSERT with vcol index · 128356b4
      Nikita Malyavin authored
      See also commits aa8a31da and 64678c for a Bug #22990029 fix.
      
      In this scenario INSERT chose to check if delete unmarking is available for
      a just deleted record. To build an update vector, it needed to calculate
      the vcols as well. Since this INSERT was not IGNORE-flagged, recalculation
      failed.
      
      Solutiuon: temporarily set abort_on_warning=true, while calculating the
      column for delete-unmarked insert.
      128356b4
    • Nikita Malyavin's avatar
      MDEV-29299 SELECT from table with vcol index reports warning · 3cd2c1e8
      Nikita Malyavin authored
      As of now innodb does not store trx_id for each record in secondary index.
      The idea behind is following: let us store only per-page max_trx_id, and
      delete-mark the records when they are deleted/updated.
      
      If the read starts, it rememders the lowest id of currently active
      transaction. Innodb refers to it as trx->read_view->m_up_limit_id.
      See also ReadView::open.
      
      When the page is fetched, its max_trx_id is compared to m_up_limit_id.
      If the value is lower, and the secondary index record is not delete-marked,
      then this page is just safe to read as is. Else, a clustered index could be
      needed ato access. See page_get_max_trx_id call in row_search_mvcc, and the
      corresponding switch (row_search_idx_cond_check(...)) below.
      
      Virtual columns are required to be updated in case if the record was
      delete-marked. The motivation behind it is documented in
      Row_sel_get_clust_rec_for_mysql::operator() near
      row_sel_sec_rec_is_for_clust_rec call.
      
      This was basically a description why virtual column computation can
      normally happen during SELECT, and, generally, a vcol index access.
      
      Sometimes stats tables are updated by innodb. This starts a new
      transaction, and it can happen that it didn't finish to the moment of
      SELECT execution, forcing virtual columns recomputation. If the result was
      a something that normally outputs a warning, like division by zero, then
      it could be outputted in a racy manner.
      
      The solution is to suppress the warnings when a column is computed
      for the described purpose.
      ignore_wrnings argument is added innobase_get_computed_value.
      Currently, it is only true for a call from
      row_sel_sec_rec_is_for_clust_rec.
      3cd2c1e8
  13. 11 Oct, 2022 2 commits