1. 03 Apr, 2023 1 commit
  2. 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
  3. 31 Mar, 2023 4 commits
  4. 29 Mar, 2023 3 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
    • Daniel Black's avatar
      MDEV-30276 - wsrep_sst_mariabackup to use mariadb-backup · e093e5ab
      Daniel Black authored
      rather than mariabackup internally, and change and messages accordingly.
      e093e5ab
  5. 28 Mar, 2023 3 commits
    • Marko Mäkelä's avatar
      MDEV-30936 fixup · 402f36dd
      Marko Mäkelä authored
      fil_space_t::~fil_space_t(): Invoke ut_free(name) because
      doing so in the callers would trip MSAN_OPTIONS=poison_in_dtor=1
      402f36dd
    • Marko Mäkelä's avatar
      MDEV-30936 clang 15.0.7 -fsanitize=memory fails massively · dfa90257
      Marko Mäkelä authored
      handle_slave_io(), handle_slave_sql(), os_thread_exit():
      Remove a redundant pthread_exit(nullptr) call, because it
      would cause SIGSEGV.
      
      mysql_print_status(): Add MEM_MAKE_DEFINED() to work around
      some missing instrumentation around mallinfo2().
      
      que_graph_free_stat_list(): Invoke que_node_get_next(node) before
      que_graph_free_recursive(node). That is the logical and
      MSAN_OPTIONS=poison_in_dtor=1 compatible way of freeing memory.
      
      ins_node_t::~ins_node_t(): Invoke mem_heap_free(entry_sys_heap).
      
      que_graph_free_recursive(): Rely on ins_node_t::~ins_node_t().
      
      fts_t::~fts_t(): Invoke mem_heap_free(fts_heap).
      
      fts_free(): Replace with direct calls to fts_t::~fts_t().
      
      The failures in free_root() due to MSAN_OPTIONS=poison_in_dtor=1
      will be covered in MDEV-30942.
      dfa90257
    • Yuchen Pei's avatar
      MDEV-30581 Add a testcase for MDEV-29904 · 113bef50
      Yuchen Pei authored
      113bef50
  6. 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
  7. 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
  8. 24 Mar, 2023 1 commit
  9. 23 Mar, 2023 4 commits
    • Aleksey Midenkov's avatar
      MDEV-30421 rpl_parallel_*.test cleanup · a8b616d1
      Aleksey Midenkov authored
      Moved rpl_parallel_*.inc to rpl_parallel_*.test
      a8b616d1
    • 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
  10. 22 Mar, 2023 3 commits
    • Marko Mäkelä's avatar
      MDEV-30882 Crash on ROLLBACK in a ROW_FORMAT=COMPRESSED table · 701399ad
      Marko Mäkelä authored
      btr_cur_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.
      
      This is a 10.5 version of commit ff3d4395
      (different because of commit 08ba3887).
      701399ad
    • 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
  11. 21 Mar, 2023 4 commits
    • Tingyao Nian's avatar
      [MDEV-30824] Fix binlog to use 'String' for setting 'character_set_client' · dccbb5a6
      Tingyao Nian authored
      Commit a923d6f4 disabled numeric setting
      of character_set_* variables with non-default values:
      
        MariaDB [(none)]> set character_set_client=224;
        ERROR 1115 (42000): Unknown character set: '224'
      
      However the corresponding binlog functionality still write numeric
      values for log event, and this will break binlog replay if the value is
      not default. Now make the server use 'String' type for
      'character_set_client' when generating binlog events
      
      Before:
      
        /*!\C utf8mb4 *//*!*/;
        SET @@session.character_set_client=224,@@session.collation_connection=224,@@session.collation_server=33/*!*/;
      
      After:
      
        /*!\C utf8mb4 *//*!*/;
        SET @@session.character_set_client=utf8mb4,@@session.collation_connection=33,@@session.collation_server=8/*!*/;
      
      Note: prior to the previous commit, setting with '224' or '45' or
      'utf8mb4' have the same effect, as they all set the parameter to
      'utf8mb4'.
      
      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.
      dccbb5a6
    • Marko Mäkelä's avatar
      Remove a bogus UNIV_ZIP_DEBUG check · e0560fc4
      Marko Mäkelä authored
      buf_LRU_block_remove_hashed(): Ever since
      commit 2e814d47
      we could get page_zip_validate() failures after an ALTER TABLE
      operation was aborted and BtrBulk::pageCommit() had never been
      executed on some blocks.
      e0560fc4
    • Marko Mäkelä's avatar
      MDEV-29692 Assertion `(writeptr + (i * size)) != local_frame' failed upon IMPORT TABLESPACE · c73a65f5
      Marko Mäkelä authored
      fil_iterate(): Allocation bitmap pages are never encrypted.
      
      Reviewed by: Thirunarayanan Balathandayuthapani
      c73a65f5
    • Vlad Lesin's avatar
      MDEV-28187 mariadb-backup doesn't utilise innodb-undo-log-directory (if... · f8c3d4c2
      Vlad Lesin authored
      MDEV-28187 mariadb-backup doesn't utilise innodb-undo-log-directory (if specified as a relative path) during copy-back operation
      
      Make absolute destination path from relative one, basing on mysql data
      directory.
      
      Reviewed by Alexander Barkov.
      f8c3d4c2
  12. 20 Mar, 2023 2 commits
  13. 16 Mar, 2023 2 commits
    • Andrei's avatar
      MDEV-30780 optimistic parallel slave hangs after hit an error · d4339620
      Andrei authored
      The hang could be seen as show slave status displaying an error like
          Last_Error: Could not execute Write_rows_v1
      along with
          Slave_SQL_Running: Yes
      
      accompanied with one of the replication threads in show-processlist
      characteristically having status like
      
         2394 | system user  |    | NULL | Slave_worker | 50852| closing tables
      
      It turns out that closing tables worker got entrapped in endless looping
      in mark_start_commit_inner() across already garbage-collected gco items.
      
      The reclaimed gco links are explained with actually possible
      out-of-order groups of events termination due to the Last_Error.
      This patch reinforces the correct ordering to perform
      finish_event_group's cleanup actions, incl unlinking gco:s
      from the active list.
      d4339620
    • Marko Mäkelä's avatar
      MDEV-30860 Race condition between buffer pool flush and log file deletion in... · 1495f057
      Marko Mäkelä authored
      MDEV-30860 Race condition between buffer pool flush and log file deletion in mariadb-backup --prepare
      
      srv_start(): If we are going to close the log file in
      mariadb-backup --prepare, call buf_flush_sync() before
      calling recv_sys.debug_free() to ensure that the log file
      will not be accessed.
      
      This fixes a rather rare failure in the test
      mariabackup.innodb_force_recovery where buf_flush_page_cleaner()
      would invoke log_checkpoint_low() because !recv_recovery_is_on()
      would hold due to the fact that recv_sys.debug_free() had
      already been called. Then, the log write for the checkpoint
      would fail because srv_start() had invoked log_sys.log.close_file().
      1495f057
  14. 14 Mar, 2023 1 commit
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-26198 Assertion `0' failed in row_log_table_apply_op during · dfdcd7ff
      Thirunarayanan Balathandayuthapani authored
      		redundant table rebuild
      
      - InnoDB alter fails to apply the online log during redundant table
      rebuild. Problem is that InnoDB wrongly reads the length flags of the
      record while applying the temporary log record.
      
      rec_init_offsets_comp_ordinary(): For finding the n_core_null_bytes,
      InnoDB should use the same logic as rec_convert_dtuple_to_rec_comp().
      dfdcd7ff
  15. 13 Mar, 2023 1 commit
  16. 10 Mar, 2023 2 commits
    • Sergei Golubchik's avatar
      MDEV-30826 Invalid data on mysql.host segfaults the server after an upgrade to 10.4 · 8145b308
      Sergei Golubchik authored
      convert empty host.db to "%", just as it's done for host.hostname
      (in update_hostname())
      8145b308
    • Vlad Lesin's avatar
      MDEV-30775 Performance regression in fil_space_t::try_to_close() introduced in MDEV-23855 · 7d6b3d40
      Vlad Lesin authored
      fil_node_open_file_low() tries to close files from the top of
      fil_system.space_list if the number of opened files is exceeded.
      
      It invokes fil_space_t::try_to_close(), which iterates the list searching
      for the first opened space. Then it just closes the space, leaving it in
      the same position in fil_system.space_list.
      
      On heavy files opening, like during 'SHOW TABLE STATUS ...' execution,
      if the number of opened files limit is reached,
      fil_space_t::try_to_close() iterates more and more closed spaces before
      reaching any opened space for each fil_node_open_file_low() call. What
      causes performance regression if the number of spaces is big enough.
      
      The fix is to keep opened spaces at the top of fil_system.space_list,
      and move closed files at the end of the list.
      
      For this purpose fil_space_t::space_list_last_opened pointer is
      introduced. It points to the last inserted opened space in
      fil_space_t::space_list. When space is opened, it's inserted to the
      position just after the pointer points to in fil_space_t::space_list to
      preserve the logic, inroduced in MDEV-23855. Any closed space is added
      to the end of fil_space_t::space_list.
      
      As opened spaces are located at the top of fil_space_t::space_list,
      fil_space_t::try_to_close() finds opened space faster.
      
      There can be the case when opened and closed spaces are mixed in
      fil_space_t::space_list if fil_system.freeze_space_list was set during
      fil_node_open_file_low() execution. But this should not cause any error,
      as fil_space_t::try_to_close() still iterates spaces in the list.
      
      There is no need in any test case for the fix, as it does not change any
      functionality, but just fixes performance regression.
      7d6b3d40
  17. 09 Mar, 2023 1 commit
    • Marko Mäkelä's avatar
      MDEV-30819 InnoDB fails to start up after downgrading from MariaDB 11.0 · 08267ba0
      Marko Mäkelä authored
      While downgrades are not supported and misguided attempts at it could
      cause serious corruption especially after
      commit b07920b6
      it might be useful if InnoDB would start up even after an upgrade to
      MariaDB Server 11.0 or later had removed the change buffer.
      
      innodb_change_buffering_update(): Disallow anything else than
      innodb_change_buffering=none when the change buffer is corrupted.
      
      ibuf_init_at_db_start(): Mention a possible downgrade in the corruption
      error message. If innodb_change_buffering=none, ignore the error but do
      not initialize ibuf.index.
      
      ibuf_free_excess_pages(), ibuf_contract(), ibuf_merge_space(),
      ibuf_update_max_tablespace_id(), ibuf_delete_for_discarded_space(),
      ibuf_print(): Check for !ibuf.index.
      
      ibuf_check_bitmap_on_import(): Remove some unnecessary code.
      This function is only accessing change buffer bitmap pages in a
      data file that is not attached to the rest of the database.
      It is not accessing the change buffer tree itself, hence it does
      not need any additional mutex protection.
      
      This has been tested both by starting up MariaDB Server 10.8 on
      a 11.0 data directory, and by running ./mtr --big-test while
      ibuf_init_at_db_start() was tweaked to always fail.
      08267ba0
  18. 08 Mar, 2023 1 commit