1. 19 Apr, 2023 4 commits
  2. 18 Apr, 2023 2 commits
    • Daniele Sciascia's avatar
      MDEV-30955 Explicit locks released too early in rollback path · feeeacc4
      Daniele Sciascia authored
      Assertion `thd->mdl_context.is_lock_owner()` fires when a client is
      disconnected, while transaction and and a table is opened through
      `HANDLER` interface.
      Reason for the assertion is that when a connection closes, its ongoing
      transaction is eventually rolled back in
      `Wsrep_client_state::bf_rollback()`. This method also releases explicit
      which are expected to survive beyond the transaction lifetime.
      This patch also removes calls to `mysql_ull_cleanup()`. User level
      locks are not supported in combination with Galera, making these calls
      unnecessary.
      feeeacc4
    • Daniele Sciascia's avatar
      MDEV-30862 Assertion `mode_ == m_high_priority' failed · bc3bfcf9
      Daniele Sciascia authored
      CREATE TABLE AS SELECT is not supported in combination with streaming
      replication.
      bc3bfcf9
  3. 17 Apr, 2023 1 commit
    • Florian Weimer's avatar
      rocksdb: Define _GNU_SOURCE during fallocate CMake probe · f575de39
      Florian Weimer authored
      The glibc headers declare fallocate only if _GNU_SOURCE is defined.
      Without this change, the probe fails with C compilers which do not
      support implicit function declarations even if the system does in
      fact support the fallocate function.
      
      Upstream rocksdb does not need this because the probe is run with the
      C++ compiler, and current g++ versions define _GNU_SOURCE
      automatically.
      f575de39
  4. 13 Apr, 2023 2 commits
    • Daniel Black's avatar
      alloca() fix · 2e1c532b
      Daniel Black authored
      Corrections from 1e58b8af.
      * Re-add #pragma alloca for AIX - now in my_alloca.h
      2e1c532b
    • Julius Goryavsky's avatar
      MDEV-30402: Encrypted mariabackup SST breaks on distributions with newer socat · d1a4315f
      Julius Goryavsky authored
      This commit adds a new 'no-sni' option to socat which is required to
      properly authenticate with newer socat versions (after version 1.7.4+).
      This option is needed to disable the automatic use of the SNI feature
      (Server Name Indication) since the SST script directly specifies the
      commonname if necessary and automatic activation of the SNI feature
      is unnecessary in such scenarios.
      d1a4315f
  5. 12 Apr, 2023 2 commits
    • Igor Babaev's avatar
      MDEV-20773 Error from UPDATE when estimating selectivity of a range · ef4d0994
      Igor Babaev authored
      This bug could affect multi-update statements as well as single-table
      update statements processed as multi-updates when the where condition
      contained a range condition over a non-indexed varchar column. The
      optimizer calculates selectivity of such range conditions using histograms.
      For each range the buckets containing endpoints of the the range are
      determined with a procedure that stores the values of the endpoints in the
      space of the record buffer where values of the columns are usually stored.
      For a range over a varchar column the value of a endpoint may exceed the
      size of the buffer and in such case the value is stored with truncation.
      This truncations cannot affect the result of the calculation of the range
      selectivity as the calculation employes only the beginning of the value
      string. However it can trigger generation of an unexpected error on this
      truncation if an update statement is processed.
      This patch prohibits truncation messages when selectivity of a range
      condition is calculated for a non-indexed column.
      
      Approved by Oleksandr Byelkin <sanja@mariadb.com>
      ef4d0994
    • Alexander Barkov's avatar
      MDEV-31039 mariadb-backup: remove global variables ds_data and ds_meta · 7bcfa00a
      Alexander Barkov authored
      This is a non-functional change.
      
      simplifying the code logic:
      - removing global variables ds_data and ds_meta
      - passing these variables as parameters to functions instead
      - adding helper classes: Datasink_free_list and Backup_datasinks
      - moving some function accepting a ds_ctxt parameter
        as methods to ds_ctxt.
      7bcfa00a
  6. 11 Apr, 2023 1 commit
  7. 10 Apr, 2023 1 commit
  8. 06 Apr, 2023 2 commits
  9. 05 Apr, 2023 1 commit
    • Sergei Golubchik's avatar
      MDEV-25887 "Got notification message from PID xxxx, but reception only... · 79e27a6b
      Sergei Golubchik authored
      MDEV-25887 "Got notification message from PID xxxx, but reception only permitted for main PID yyyy" in systemd during SST
      
      server has systemd support and calls sd_notify() to communicate
      the status to systemd.
      
      mariabackup links the whole server in, but it should not notify
      systemd, because it's not started or managed by systemd.
      79e27a6b
  10. 04 Apr, 2023 3 commits
    • Jan Lindström's avatar
      MDEV-29602 : Galera debug build crashes when the spider plugin is enabled · 06393cd8
      Jan Lindström authored
      Spider system tables should be created so that wsrep_on=OFF.
      Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
      06393cd8
    • Alexander Barkov's avatar
    • Alexander Barkov's avatar
      MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations · 8020b1bd
      Alexander Barkov authored
      - Adding a new argument "flag" to MY_COLLATION_HANDLER::strnncollsp_nchars()
        and a flag MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES.
        The flag defines if strnncollsp_nchars() should emulate trailing spaces
        which were possibly trimmed earlier (e.g. in InnoDB CHAR compression).
        This is important for NOPAD collations.
      
        For example, with this input:
         - str1= 'a '    (Latin letter a followed by one space)
         - str2= 'a  '   (Latin letter a followed by two spaces)
         - nchars= 3
        if the flag is given, strnncollsp_nchars() will virtually restore
        one trailing space to str1 up to nchars (3) characters and compare two
        strings as equal:
        - str1= 'a  '  (one extra trailing space emulated)
        - str2= 'a  '  (as is)
      
        If the flag is not given, strnncollsp_nchars() does not add trailing
        virtual spaces, so in case of a NOPAD collation, str1 will be compared
        as less than str2 because it is shorter.
      
      - Field_string::cmp_prefix() now passes the new flag.
        Field_varstring::cmp_prefix() and Field_blob::cmp_prefix() do
        not pass the new flag.
      
      - The branch in cmp_whole_field() in storage/innobase/rem/rem0cmp.cc
        (which handles the CHAR data type) now also passed the new flag.
      
      - Fixing UCA collations to respect the new flag.
        Other collations are possibly also affected, however
        I had no success in making an SQL script demonstrating the problem.
        Other collations will be extended to respect this flags in a separate
        patch later.
      
      - Changing the meaning of the last parameter of Field::cmp_prefix()
        from "number of bytes" (internal length)
        to "number of characters" (user visible length).
      
        The code calling cmp_prefix() from handler.cc was wrong.
        After this change, the call in handler.cc became correct.
      
        The code calling cmp_prefix() from key_rec_cmp() in key.cc
        was adjusted according to this change.
      
      - Old strnncollsp_nchar() related tests in unittest/strings/strings-t.c
        now pass the new flag.
        A few new tests also were added, without the flag.
      8020b1bd
  11. 03 Apr, 2023 2 commits
    • Lorna Luo's avatar
      Make 'move_file' command more reliable in 3 innodb tests · 0cc1694e
      Lorna Luo authored
      The tests innodb.import_tablespace_race, innodn.restart, and innodb.innodb-wl5522 move
      the tablespace file between the data directory and the tmp directory specified by
      global environment variables. However this is risky because it's not unusual that the
      set tmp directory (often under /tmp) is mounted on another disk partition or device,
      and 'move_file' command may fail with "Errcode: 18 'Invalid cross-device link.'"
      
      For innodb.import_tablespace_race and innodb.innodb-wl5522, moving files
      across directories is not necessary. Modify the tests so they rename
      files under the same directory. For innodb.restart, instead of moving
      between datadir and MYSQL_TMPDIR, move the files under MYSQLTEST_VARDIR.
      
      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.
      0cc1694e
    • Lorna Luo's avatar
      Make 'move_file' command more reliable in mysqltest · da73db23
      Lorna Luo authored
      The tests innodb.import_tablespace_race, innodn.restart, and innodb.innodb-wl5522 move
      the tablespace file between the data directory and the tmp directory specified by
      global environment variables. However this is risky because it's not unusual that the
      set tmp directory (often under /tmp) is mounted on another disk partition or device,
      and 'move_file' command may fail with "Errcode: 18 'Invalid cross-device link.'"
      
      To stabilize mysqltest in the described scenario, and prevent such
      behavior in the future, let make_file() check both from file path and to
      file path and make sure they are either both under MYSQLTEST_VARDIR or
      MYSQL_TMP_DIR.
      
      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.
      da73db23
  12. 01 Apr, 2023 4 commits
    • Sergei Golubchik's avatar
      ensure that STRING_WITH_LEN is only used with string literals · 0a634390
      Sergei Golubchik authored
      This is allowed:
      
        STRING_WITH_LEN("string literal")
      
      This is not:
      
        char *str = "pointer to string";
        ... STRING_WITH_LEN(str) ..
      
      In C++ this is also allowed:
      
        const char str[] = "string literal";
        ... STRING_WITH_LEN(str) ...
      0a634390
    • Sergei Golubchik's avatar
      MDEV-13255 main.status failed in buildbot · 6a10468e
      Sergei Golubchik authored
      Test fails sporadically and very rarely on this:
      ```
      let $org_queries= `SHOW STATUS LIKE 'Queries'`;
      SELECT f1();
      CALL p1();
      let $new_queries= `SHOW STATUS LIKE 'Queries'`;
      let $diff= `SELECT SUBSTRING('$new_queries',9)-SUBSTRING('$org_queries',9)`;
      ```
      if COM_QUIT from one of the earlier (in the test) disconnect's
      happens between the two SHOW STATUS commands.
      Because COM_QUIT increments "Queries".
      
      The directly previous test uses wait_condition to wait for
      its disconnects to complete. But there are more disconnects earlier
      in the test file and nothing waits for them.
      
      Let's change wait_condition to wait for *all* disconnect to complete.
      6a10468e
    • Oleksandr Byelkin's avatar
    • Hugo Wen's avatar
      Handle meaningless addr2line results and increase timeout · 3b642440
      Hugo Wen authored
      MariaDB server prints the stack information if a crash happens.
      
      It traverses the stack frames in function `print_with_addr_resolve`.
      For *EACH* frame, it tries to parse the file name and line number of the
      frame using `addr2line`, or prints `backtrace_symbols_fd` if `addr2line`
      fails.
      
      1. Logic in `addr_resolve` function uses addr2line to get the file name
         and line numbers. It has a timeout of 500ms to wait for the response
         from addr2line. However, that's not enough on small instances
         especially if the debug information is in a separate file or
         compressed.
      
         Increase the timeout to 5 seconds to support some edge cases, as
         experiments showed addr2line may take 2-3 seconds on some frames.
      
      2. While parsing a frame inside of a shared library using `addr2line`,
         the file name and line numbers could be `??`, empty or `0` if the
         debug info is not loaded.
         It's easy to reproduce when glibc-debuginfo is not installed.
      
         Instead of printing a meaningless frame like:
      
             :0(__GI___poll)[0x1505e9197639]
             ...
             ??:0(__libc_start_main)[0x7ffff6c8913a]
      
         We want to print the frame information using `backtrace_symbols_fd`,
         with the shared library name and a hexadecimal offset.
         Stacktrace example on a real instance with this commit:
      
             /lib64/libc.so.6(__poll+0x49)[0x145cbf71a639]
             ...
             /lib64/libc.so.6(__libc_start_main+0xea)[0x7f4d0034d13a]
      
         `addr_resolve` has considered the case of meaningless combination of
         file name and line number returned by `addr2line`. e.g. `??:?`
         However, conditions like `:0` and `??:0` are not handled. So now the
         function will rollback to `backtrace_symbols_fd` in above 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.
      3b642440
  13. 31 Mar, 2023 3 commits
  14. 29 Mar, 2023 2 commits
    • Marko Mäkelä's avatar
      MDEV-30453 Setting innodb_buffer_pool_filename to an empty string attempts to... · a6780df4
      Marko Mäkelä authored
      MDEV-30453 Setting innodb_buffer_pool_filename to an empty string attempts to delete the data directory on shutdown
      
      Let us make innodb_buffer_pool_filename a read-only variable
      so that a malicious user cannot cause an important file to be
      deleted on InnoDB shutdown. An attempt to delete a directory
      will fail because it is not a regular file, but what if the
      variable pointed to (say) ibdata1, ib_logfile0 or some *.ibd file?
      
      It does not seem to make much sense for this parameter to be
      configurable in the first place, but we will not change that in order
      to avoid breaking compatibility.
      a6780df4
    • Alexander Barkov's avatar
      MDEV-26765 UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!? · 03b4a2d6
      Alexander Barkov authored
      Problem:
      
      UNIX_TIMESTAMP() called for a expression of the TIME data type
      returned NULL.
      
      Inside Type_handler_timestamp_common::Item_val_native_with_conversion
      the call for item->get_date() did not convert TIME to DATETIME
      automatically (because it does not have to, by design).
      As a result, Type_handler_timestamp_common::TIME_to_native() received
      a MYSQL_TIME value with zero date 0000-00-00 and therefore returned "true"
      (indicating SQL NULL value).
      
      Fix:
      
      Removing the call for item->get_date().
      Instantiating Datetime(item) instead.
      This forces automatic TIME to DATETIME conversion
      (unless @@old_mode is zero_date_time_cast).
      03b4a2d6
  15. 28 Mar, 2023 1 commit
  16. 27 Mar, 2023 2 commits
    • Vlad Lesin's avatar
      MDEV-29050 mariabackup issues error messages during InnoDB tablespaces export... · 4c226c18
      Vlad Lesin authored
      MDEV-29050 mariabackup issues error messages during InnoDB tablespaces export on partial backup preparing
      
      The solution is to suppress error messages for missing tablespaces if
      mariabackup is launched with "--prepare --export" options.
      
      "mariabackup --prepare --export" invokes itself with --mysqld parameter.
      If the parameter is set, then it starts server to feed "FLUSH TABLES ...
      FOR EXPORT;" queries for exported tablespaces. This is "normal" server
      start, that's why new srv_operation value is introduced.
      
      Reviewed by Marko Makela.
      4c226c18
    • Debjyoti's avatar
      MDEV-24453 Added support for a 5th --verbose parameter in mariadb-upgrade to... · d575b07c
      Debjyoti authored
      MDEV-24453 Added support for a 5th --verbose parameter in mariadb-upgrade to show mysql results for mysql_fix_privilege_tables
      d575b07c
  17. 25 Mar, 2023 1 commit
    • Igor Babaev's avatar
      MDEV-30539 EXPLAIN EXTENDED: no message with queries for DML statements · f33fc2fa
      Igor Babaev authored
      EXPLAIN EXTENDED for an UPDATE/DELETE/INSERT/REPLACE statement did not
      produce the warning containing the text representation of the query
      obtained after the optimization phase. Such warning was produced for
      SELECT statements, but not for DML statements.
      The patch fixes this defect of EXPLAIN EXTENDED for DML statements.
      f33fc2fa
  18. 24 Mar, 2023 1 commit
  19. 23 Mar, 2023 3 commits
    • Aleksey Midenkov's avatar
      MDEV-30421 more tests cleaned up · 91e5e47a
      Aleksey Midenkov authored
      All the .inc files that included from binlog_encryption are refactored.
      91e5e47a
    • Aleksey Midenkov's avatar
      MDEV-30421 rpl_parallel.test cleanup · bdf55806
      Aleksey Midenkov authored
      Moved rpl_parallel.inc to rpl_parallel.test
      bdf55806
    • Anel Husakovic's avatar
      MDEV-30269: Remove rpl_semi_sync_[slave,master] usage in code · c596ad73
      Anel Husakovic authored
      - Description:
        - Before 10.3.8 semisync was a plugin that is built into the server with
          MDEV-13073,starting with commit cbc71485.
          There are still some usage of `rpl_semi_sync_master` in mtr.
      Note:
        - To recognize the replica in the `dump_thread`, replica is creating
          local variable `rpl_semi_sync_slave` (the keyword of plugin) in
          function `request_transmit`, that is catched by primary in
          `is_semi_sync_slave()`. This is the user variable and as such not
          related to the obsolete plugin.
      
       - Found in `sys_vars.all_vars` and `rpl_semi_sync_wait_point` tests,
         usage of plugins `rpl_semi_sync_master`, `rpl_semi_sync_slave`.
         The former test is disabled by default (`sys_vars/disabled.def`)
         and marked as `obsolete`, however this patch will remove the queries.
      
      - Add cosmetic fixes to semisync codebase
      
      Reviewer: <brandon.nesterenko@mariadb.com>
      Closes PR #2528, PR #2380
      c596ad73
  20. 22 Mar, 2023 2 commits
    • Marko Mäkelä's avatar
      MDEV-30882 Crash on ROLLBACK in a ROW_FORMAT=COMPRESSED table · ff3d4395
      Marko Mäkelä authored
      row_upd_rec_in_place(): Avoid calling page_zip_write_rec() if we
      are not modifying any fields that are stored in compressed format.
      
      btr_cur_update_in_place_zip_check(): New function to check if a
      ROW_FORMAT=COMPRESSED record can actually be updated in place.
      
      btr_cur_pessimistic_update(): If the BTR_KEEP_POS_FLAG is not set
      (we are in a ROLLBACK and cannot write any BLOBs), ignore the potential
      overflow and let page_zip_reorganize() or page_zip_compress() handle it.
      This avoids a failure when an attempted UPDATE of an NULL column to 0 is
      rolled back. During the ROLLBACK, we would try to move a non-updated
      long column to off-page storage in order to avoid a compression failure
      of the ROW_FORMAT=COMPRESSED page.
      
      page_zip_write_trx_id_and_roll_ptr(): Remove an assertion that would fail
      in row_upd_rec_in_place() because the uncompressed page would already
      have been modified there.
      
      Thanks to Jean-François Gagné for providing a copy of a page that
      triggered these bugs on the ROLLBACK of UPDATE and DELETE.
      
      A 10.6 version of this was tested by Matthias Leich using
      cmake -DWITH_INNODB_EXTRA_DEBUG=ON a.k.a. UNIV_ZIP_DEBUG.
      ff3d4395
    • Yuchen Pei's avatar
      MDEV-27912 Fixing inconsistency w.r.t. expect files in tests. · 7c91082e
      Yuchen Pei authored
      mtr uses group suffix, but some existing inc and test files use
      server_id for expect files. This patch aims to fix that.
      
      For spider:
      
      With this change we will not have to maintain a separate version of
      restart_mysqld.inc for spider, that duplicates code, just because
      spider tests use different names for expect files, and shutdown_mysqld
      requires magical names for them.
      
      With this change spider tests will also be able to use other features
      provided by restart_mysqld.inc without code duplication, like the
      parameter $restart_parameters (see e.g. the testcase mdev_29904.test
      in commit ef1161e5d4f).
      
      Tests run after this change: default, spider, rocksdb, galera, using
      the following command
      
      mtr --parallel=auto --force --max-test-fail=0 --skip-core-file
      mtr --suite spider,spider/*,spider/*/* \
          --skip-test="spider/oracle.*|.*/t\..*" --parallel=auto --big-test \
          --force --max-test-fail=0 --skip-core-file
      mtr --suite galera --parallel=auto
      mtr --suite rocksdb --parallel=auto
      7c91082e