1. 05 Aug, 2024 2 commits
    • Oleksandr Byelkin's avatar
      MDEV-34704 Quick mode produces the bug for mariadb client · 186aa192
      Oleksandr Byelkin authored
        --quick-max-column-width parameter added to limit field
          width in --quick mode.
      186aa192
    • Hugo Wen's avatar
      Extend Unix socket authentication to support authentication_string · 9e1923ca
      Hugo Wen authored
      Before this change the unix socket auth plugin returned true only when
      the OS socket user id matches the MariaDB user name.
      The authentication string was ignored.
      
      Now if an authentication string is defined with in `unix_socket`
      authentication rule, then the authentication string will be used to
      compare with the socket's user name, and the plugin will return a
      positive if matching.
      
      Make the plugin to fill in the @@external_user variable.
      
      This change is similar to MySQL commit of
      https://github.com/mysql/mysql-server/commit/6ddbc58e.
      However there's one difference with above commit:
      
      - For MySQL, both Unix user matches DB user name and Unix user matches the
        authentication string will be allowed to connect.
      - For MariaDB, we only allows the Unix user matches the authentication
        string to connect, if the authentication string is defined.
        This is because allowing both Unix user names has risks and couldn't
        handle the case that a customer only wants to allow one single Unix user
        to connect which doesn't matches the DB user name.
      
      If DB user is created with multiple unix_socket options for example:
      `create user A identified via unix_socket as 'B' or unix_socket as 'C';`
      Then both Unix user of B and C are accepted.
      
      Existing MTR test of `plugins.unix_socket` is not impacted.
      Also add a new MTR test to verify authentication with authentication
      string. See the MTR test cases for supported/unsupported cases.
      
      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.
      9e1923ca
  2. 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
  3. 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
  4. 17 Jul, 2024 1 commit
  5. 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
  6. 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
  7. 11 Jul, 2024 2 commits
  8. 10 Jul, 2024 2 commits
  9. 09 Jul, 2024 7 commits
  10. 08 Jul, 2024 10 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
    • Anson Chung's avatar
      Perform simple fixes for cppcheck findings · 215fab68
      Anson Chung authored
      Rectify cases of mismatched brackets and address
      possible cases of division by zero by checking if
      the denominator is zero before dividing.
      
      No functional changes were made.
      
      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.
      215fab68
    • Robin Newhouse's avatar
      Delete unused global variables from mysqld.h · becc8372
      Robin Newhouse authored
      Several variables declared in mysqld.h appear to be old system variables
      that have been left over after deprecation. Delete them using IDE
      refactoring to automatically search for other uses. Most cases had no
      other uses in the code.
      
      slave_allow_batching had a test that was effectively unused, as the
      result was only
      -ERROR HY000: Unknown system variable 'slave_allow_batching'
      so that was deleted as well.
      
      Build and test still works without issue as expected.
      
      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.
      becc8372
    • Alexander Barkov's avatar
      8f4ec79d
    • Marko Mäkelä's avatar
      MDEV-34510: UBSAN: overflow on adding an unsigned offset · 72ceae73
      Marko Mäkelä authored
      crc32_avx512(): Explicitly cast ssize_t(size) to make it clear that
      we are indeed applying a negative offset to a pointer.
      72ceae73
  11. 07 Jul, 2024 1 commit
    • Monty's avatar
      MDEV-34522 Index for (specific) Aria table is created as corrupted · 33964984
      Monty authored
      The issue was that when repairing an Aria table of row format PAGE and
      the data file was bigger the 4G, the data file length was cut short
      because of wrong parameters to MY_ALIGN().
      
      The effect was that ALTER TABLE, OPTIMIZE TABLE or REPAIR TABLE would fail
      on these tables, possibly corrupting them.
      The MDEV also exposed a bug where error state was not propagated properly
      to the upper level if the number of rows in the table changed.
      33964984
  12. 06 Jul, 2024 3 commits
    • Monty's avatar
      6e4f95a0
    • Monty's avatar
      Fixed core dump when using --debug · 29d94676
      Monty authored
      The problem was using safe_table_name() instead of safe_table_name().str
      with DBUG_PRINT
      29d94676
    • Brandon Nesterenko's avatar
      MDEV-33465: an option to enable semisync recovery · eb4458e9
      Brandon Nesterenko authored
      The current semi-sync binlog fail-over recovery process uses
      rpl_semi_sync_slave_enabled==TRUE as its condition to truncate a
      primary server’s binlog, as it is anticipating the server to re-join
      a replication topology as a replica. However, for servers configured
      with both rpl_semi_sync_master_enabled=1 and
      rpl_semi_sync_slave_enabled=1, if a primary is just re-started (i.e.
      retaining its role as master), it can truncate its binlog to drop
      transactions which its replica(s) has already received and executed.
      If this happens, when the replica reconnects, its gtid_slave_pos can
      be ahead of the recovered primary’s gtid_binlog_pos, resulting in an
      error state where the replica’s state is ahead of the primary’s.
      
      This patch changes the condition for semi-sync recovery to truncate
      the binlog to instead use the configuration variable
      --init-rpl-role, when set to SLAVE. This allows for both
      rpl_semi_sync_master_enabled and rpl_semi_sync_slave_enabled to be
      set for a primary that is restarted, and no transactions will be
      lost, so long as --init-rpl-role is not set to SLAVE.
      
      Reviewed By:
      ============
      Sergei Golubchik <serg@mariadb.com>
      eb4458e9
  13. 05 Jul, 2024 3 commits
    • Brandon Nesterenko's avatar
      MDEV-25607: Auto-generated DELETE from HEAP table can break replication · cbc1898e
      Brandon Nesterenko authored
      The special logic used by the memory storage engine
      to keep slaves in sync with the master on a restart can
      break replication. In particular, after a restart, the
      master writes DELETE statements in the binlog for
      each MEMORY-based table so the slave can empty its
      data. If the DELETE is not executable, e.g. due to
      invalid triggers, the slave will error and fail, whereas
      the master will never see the problem.
      
      Instead of DELETE statements, use TRUNCATE to
      keep slaves in-sync with the master, thereby bypassing
      triggers.
      
      Reviewed By:
      ===========
      Kristian Nielsen <knielsen@knielsen-hq.org>
      Andrei Elkin <andrei.elkin@mariadb.com>
      cbc1898e
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-34519 innodb_log_checkpoint_now crashes when innodb_read_only is enabled · 834c013b
      Thirunarayanan Balathandayuthapani authored
      During read only mode, InnoDB doesn't allow checkpoint to happen.
      So InnoDB should throw the warning when InnoDB tries to
      force the checkpoint when innodb_read_only = 1 or
      innodb_force_recovery = 6.
      834c013b
    • Hugo Wen's avatar
      Fix a stack overflow in pinbox allocator · 9e8546e2
      Hugo Wen authored
      MariaDB supports a "wait-free concurrent allocator based on pinning addresses".
      In `lf_pinbox_real_free()` it tries to sort the pinned addresses for better
      performance to use binary search during "real free". `alloca()` was used to
      allocate stack memory and copy addresses.
      
      To prevent a stack overflow when allocating the stack memory the function checks
      if there's enough stack space. However, the available stack size was calculated
      inaccurately which eventually caused database crash due to stack overflow.
      
      The crash was seen on MariaDB 10.6.11 but the same code defect exists on all
      MariaDB versions.
      
      A similar issue happened previously and the fix in fc2c1e43 was to add a
      `ALLOCA_SAFETY_MARGIN` which is 8192 bytes. However, that safety margin is not
      enough during high connection workloads.
      
      MySQL also had a similar issue and the fix
      https://github.com/mysql/mysql-server/commit/b086fda was to remove the use of
      `alloca` and replace qsort approach by a linear scan through all pointers (pins)
      owned by each thread.
      
      This commit is mostly the same as it is the only way to solve this issue as:
      1. Frame sizes in different architecture can be different.
      2. Number of active (non-null) pinned addresses varies, so the frame
         size for the recursive sorting function `msort_with_tmp` is also hard
         to predict.
      3. Allocating big memory blocks in stack doesn't seem to be a very good
         practice.
      
      For further details see the mentioned commit in MySQL and the inline comments.
      
      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.
      9e8546e2