1. 20 Sep, 2024 1 commit
    • Oleg Smirnov's avatar
      MDEV-34860 Implement MAX_EXECUTION_TIME hint · 99f28694
      Oleg Smirnov authored
      It places a limit N (a timeout value in milliseconds) on how long
      a statement is permitted to execute before the server terminates it.
      
      Syntax:
      SELECT /*+ MAX_EXECUTION_TIME(milliseconds) */ ...
      
      Only top-level SELECT statements support the hint.
      99f28694
  2. 16 Sep, 2024 2 commits
    • Oleg Smirnov's avatar
      MDEV-33281 Make BNL() hint work for join_cache_levels from 0 to 3 · 824c20ae
      Oleg Smirnov authored
      BNL() hint effectively increases join_cache_level up to 4 if it is
      set to value less than 4.
      This commit also makes the BKA() hint override not only
      `join_cache_bka` optimizer switch but `join_cache_level` as well.
      I.e., BKA() hint enables BKA and BKAH join buffers both flat and
      incremental despite `join_cache_level` and `join_cache_bka` setting.
      824c20ae
    • Sergei Petrunia's avatar
      Code cleanup in parser: · a1a91561
      Sergei Petrunia authored
      - Comments in simple_parser.h
      - Rename Optimizer_hint_parser::PARSER to Parser (it's not a template
        argument, don't use caps)
      a1a91561
  3. 11 Sep, 2024 2 commits
  4. 10 Sep, 2024 1 commit
  5. 06 Sep, 2024 1 commit
    • Oleg Smirnov's avatar
      MDEV-33281 Make BNL() hint work for join_cache_level=0 · c8ce9fbb
      Oleg Smirnov authored
      join_cache_level=0 disables join cache buffers, but the hint
      BNL() now allows to employ BNL(H) buffers for particular tables
      or query blocks.
      
      This commit also adds a number of test cases including
      OUTER JOINs to make sure hints do not break the rules of
      join buffers application
      c8ce9fbb
  6. 03 Sep, 2024 2 commits
    • Oleg Smirnov's avatar
      MDEV-33281 Implement optimizer hints · cee6796b
      Oleg Smirnov authored
      Forbid adding optimizer hints to view definitions.
      In the case when optimizer hints are added to the view definition
      at a `CREATE (OR REPLACE) VIEW`/`ALTER VIEW` statement, a warning is
      generated and the hints are ignored.
      
      This commit also disables ps-protocol for test cases where
      `Unresolved table/index name` warnings are generated. The reason
      for this is such warnings are generated during both PREPARE
      and EXECUTE stages. Since opt_hints.test has `--enable_prepare_warnings`,
      running it with `--ps-protocol` causes duplication of warning messages
      cee6796b
    • Oleg Smirnov's avatar
      MDEV-33281 Fix code review comments · 316c3378
      Oleg Smirnov authored
      316c3378
  7. 14 Aug, 2024 4 commits
    • Alexander Barkov's avatar
      MDEV-33281 Implement optimizer hints · 189c8eb9
      Alexander Barkov authored
      - Using Lex_ident_sys to scan identifiers, like the SQL parser does.
      
        This fixes handling of double-quote-delimited and backtick-delimited identifiers,
        as well as handling of non-ASCII identifiers.
      
        Unescaping and converting from the client character set to the system
        character set is now done using Lex_ident_cli_st and Lex_ident_sys,
        like it's done in the SQL tokenizer/parser.
        Adding helper methods to_ident_cli() and to_ident_sys()
        in Optimizer_hint_parser::Token.
      
      - Fixing the hint parser to report a syntax error when an empty identifiers:
          SELECT /*+ BKA(``) */ * FROM t1;
      
      - Moving a part of the code from opt_hints_parser.h to opt_hints_parser.cc
      
        Moving these method definitions:
        - Optimizer_hint_tokenizer::find_keyword()
        - Optimizer_hint_tokenizer::get_token()
      
        to avoid huge pieces of the code in the header file.
      
      - A Lex_ident_cli_st cleanup
        Fixing a few Lex_ident_cli_st methods to return Lex_ident_cli_st &
        instead of void, to use them easier in the caller code.
      
      - Fixing the hint parser to display the correct line number
      
        Adding a new data type Lex_comment_st
        (a combination of LEX_CSTRING and a line number)
        Using it in sql_yacc.yy
      
      - Getting rid of redundant dependencies on sql_hints_parser.h
      
        Moving void LEX::resolve_optimizer_hints() from sql_lex.h to sql_lex.cc
      
        Adding a class Optimizer_hint_parser_output, deriving from
        Optimizer_hint_parser::Hint_list. Fixing the hint parser to
        return a pointer to an allocated instance of Optimizer_hint_parser_output
        rather than an instance of Optimizer_hint_parser::Hint_list.
        This allows to use a forward declaration of Optimizer_hint_parser_output
        in sql_lex.h and thus avoid dependencies on sql_hints_parser.h.
      189c8eb9
    • Oleg Smirnov's avatar
      MDEV-33281 Implement optimizer hints · 64c90152
      Oleg Smirnov authored
          This commit introduces:
          - the infrastructure for optimizer hints;
          - hints for join buffering: BNL(), NO_BNL(), BKA(), NO_BKA();
          - NO_ICP() hint for disabling index condition pushdown;
          - MRR(), MO_MRR() hint for multi-range reads control;
          - NO_RANGE_OPTIMIZATION() for disabling range optimization;
          - QB_NAME() for assigning names for query blocks.
      64c90152
    • Alexander Barkov's avatar
      MDEV-33281 Implement optimizer hints · 8ba71c4c
      Alexander Barkov authored
      Implementing a recursive descent parser for optimizer hints.
      8ba71c4c
    • Alexander Barkov's avatar
      Moving a part of sql_lex.h into other *.h files · 1cb1dad1
      Alexander Barkov authored
      - Lex_ident_cli* into a new file sql/lex_ident_cli.h
      - Lex_ident_sys* into a new file sql/lex_ident_sys.h
      - Well_formed_prefix into include/m_ctype.h
      
      This change is needed to the optimizer hint parser coming soon.
      1cb1dad1
  8. 25 Jul, 2024 1 commit
    • Monty's avatar
      MDEV-33856: Alternative Replication Lag Representation via Received/Executed... · 25b5c639
      Monty authored
      MDEV-33856: Alternative Replication Lag Representation via Received/Executed Master Binlog Event Timestamps
      
      This commit adds 3 new status variables to 'show all slaves status':
      
      - Master_last_event_time ; timestamp of the last event read from the
        master by the IO thread.
      - Slave_last_event_time ; Master timestamp of the last event committed
        on the slave.
      - Master_Slave_time_diff: The difference of the above two timestamps.
      
      All the above variables are NULL until the slave has started and the
      slave has read one query event from the master that changes data.
      
      - Added information_schema.slave_status, which allows us to remove:
         - show_master_info(), show_master_info_get_fields(),
           send_show_master_info_data(), show_all_master_info()
         - class Sql_cmd_show_slave_status.
         - Protocol::store(I_List<i_string_pair>* str_list) as it is not
           used anymore.
      - Changed old SHOW SLAVE STATUS and SHOW ALL SLAVES STATUS to
        use the SELECT code path, as all other SHOW ... STATUS commands.
      
      Other things:
      - Xid_log_time is set to time of commit to allow slave that reads the
        binary log to calculate Master_last_event_time and
        Slave_last_event_time.
        This is needed as there is not 'exec_time' for row events.
      - Fixed that Load_log_event calculates exec_time identically to
        Query_event.
      - Updated RESET SLAVE to reset Master/Slave_last_event_time
      - Updated SQL thread's update on first transaction read-in to
        only update Slave_last_event_time on group events.
      - Fixed possible (unlikely) bugs in sql_show.cc ...old_format() functions
        if allocation of 'field' would fail.
      
      Reviewed By:
      Brandon Nesterenko <brandon.nesterenko@mariadb.com>
      Kristian Nielsen <knielsen@knielsen-hq.org>
      25b5c639
  9. 24 Jul, 2024 1 commit
    • Souradeep Saha's avatar
      Cleanup Whitespace in unittest/ directory · 4dde925f
      Souradeep Saha authored
      Cleanup unnecessary whitespace at the end of lines and end of files
      in the unittest/ directory. Note that all code changes are
      non-functional.
      
      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.
      4dde925f
  10. 17 Jul, 2024 1 commit
  11. 16 Jul, 2024 6 commits
    • Daniel Black's avatar
      MDEV-33988 DELETE single table to support table aliases · 75d354a2
      Daniel Black authored
      Gain MySQL compatibility by allowing table aliases in a single
      table statement.
      
      This now supports the syntax of:
      
      DELETE [delete_opts] FROM tbl_name [[AS] tbl_alias] [PARTITION (partition_name [, partition_name] ...)] ....
      
      The delete.test is from MySQL commit 1a72b69778a9791be44525501960b08856833b8d
      / Change-Id: Iac3a2b5ed993f65b7f91acdfd60013c2344db5c0.
      
      Co-Author: Gleb Shchepa <gleb.shchepa@oracle.com> (for delete.test)
      
      Reviewed by Igor Babaev (igor@mariadb.com)
      75d354a2
    • Brandon Nesterenko's avatar
      MDEV-34571: Fix funcs_1.is_columns_is_embedded · 0cd20e3a
      Brandon Nesterenko authored
      Result file needed re-recording to account for the
      new information_schema columns
      0cd20e3a
    • Vladislav Vaintroub's avatar
      MDEV-33627 : Implement option --dir in mariadb-import · 9e25d6f0
      Vladislav Vaintroub authored
      With that, it is possible to restore the full "instance" from a backup
      made with mariadb-dump --dir
      
      The patch implements executing DDL (tables, views, triggers) using
      statements that are stored in .sql file, created by mariadb-dump
      --dir .
      
      Care is taken of creating triggers correctly after the data is loaded,
      disabling foreign keys and unique key checks etc.
      
      The files are loaded in descending order by datafile size -
      to ensure better work distribution when running with --parallel option.
      
      In addition to --dir option, following options are implemented for
      partial restore
      
      include-only options:
      --database             -  import one or several databases
      --table                -  import one or several tables
      
      exclude options:
      --ignore-database      -. ignore one or several databases when importing
      --ignore-table         -  to ignore one or several tables when importing
      
      All options above are only valid together with --dir option,
      and can be specified multiple times.
      9e25d6f0
    • Vladislav Vaintroub's avatar
      MDEV-33627 refactor threading in mariadb-import · 04988d87
      Vladislav Vaintroub authored
      Use threadpool, instead of one-thread-and-connection-per-table
      04988d87
    • Vladislav Vaintroub's avatar
      MDEV-33627 preparation - tpool fix · c483c5ca
      Vladislav Vaintroub authored
      Fix tpool to not use maintenance timer for fixed pool size.
      c483c5ca
    • Vladislav Vaintroub's avatar
  12. 12 Jul, 2024 1 commit
    • Monty's avatar
      MDEV-34571 Add page accessed and pages read from disk to table_stats · ecc79611
      Monty authored
      Trivial batch, using the handler statistics already collected for
      the slow query log.
      
      The reason for the changes in test cases was mainly to change to use
      select TABLE_SCHEMA ... from information_schema.table_statistics instead
      of 'show table_statistics' to avoid future changes to test results
      if we add more columns to table_statistics.
      ecc79611
  13. 11 Jul, 2024 2 commits
  14. 10 Jul, 2024 2 commits
  15. 09 Jul, 2024 7 commits
  16. 08 Jul, 2024 6 commits
    • Oleksandr Byelkin's avatar
      Merge branch '10.11' into 11.1 · 2447dda2
      Oleksandr Byelkin authored
      2447dda2
    • Alexander Barkov's avatar
      4d71a117
    • Alexander Barkov's avatar
      e56040fe
    • Alexander Barkov's avatar
      MDEV-34305 Redundant truncation errors/warnings with optimizer_trace enabled · d1e5fa89
      Alexander Barkov authored
      my_like_range*() can create longer keys than Field::char_length().
      This caused warnings during print_range().
      
      Fix:
      
      Suppressing warnings in print_range().
      d1e5fa89
    • Alexander Barkov's avatar
      027f1377
    • Anson Chung's avatar
      Refactor GitLab cppcheck and update SAST ignorelists · df35072c
      Anson Chung authored
      Line numbers had to be removed from the ignorelists in order to be
      diffed against since locations of the same findings can differ
      across runs. Therefore preprocessing has to be done on the CI findings
      so that it can be compared to the ignorelist and new findings can be
      outputted. However, since line numbers have to be removed, a situation
      occurs where it is difficult to reference the location of findings
      in code given the output of the CI job.
      
      To lessen this pain, change the cppcheck template to include
      code snippets which make it easier to reference where in the code
      the finding is referring to, even in the absence of line numbers.
      Ignorelisting works as before since locations of the finding may
      change but not the code it is referring to.
      
      Furthermore, due to the innate difficulty in maintaining ignorelists
      across branches and triaging new findings, allow failure as to not
      have constantly failing pipelines as a result of a new findings that
      have not been addressed yet.
      
      Lastly, update SAST ignorelists to match the newly refactored cppcheck
      job and the current state of the codebase.
      
      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.
      df35072c