1. 08 Jul, 2024 1 commit
  2. 04 Jul, 2024 3 commits
    • Oleksandr Byelkin's avatar
      Merge branch '10.6' into 10.11 · 034a1759
      Oleksandr Byelkin authored
      034a1759
    • Oleksandr Byelkin's avatar
    • Alexander Barkov's avatar
      MDEV-10865 COLLATE keyword doesn't work in PREPARE query · f6989d17
      Alexander Barkov authored
      Fixing applying the COLLATE clause to a parameter caused an error error:
        COLLATION '...' is not valid for CHARACTER SET 'binary'
      
      Fix:
      
      - Changing the collation derivation for a non-prepared Item_param
        to DERIVATION_IGNORABLE.
      
      - Allowing to apply any COLLATE clause to expressions with DERIVATION_IGNORABLE.
        This includes:
          1. A non-prepared Item_param
          2. An explicit NULL
          3. Expressions derived from #1 and #2
      
        For example:
          SELECT ? COLLATE utf8mb_unicode_ci;
          SELECT NULL COLLATE utf8mb_unicode_ci;
          SELECT CONCAT(?) COLLATE utf8mb_unicode_ci;
          SELECT CONCAT(NULL) COLLATE utf8mb_unicode_ci
      
      - Additional change: preserving the collation of an expression when
        the expression gets assigned to a PS parameter and evaluates to SQL NULL.
        Before this change, the collation of the parameter was erroneously set
        to &my_charset_binary.
      
      - Additional change: removing the multiplication to mbmaxlen from the
        fix_char_length_ulonglong() argument, because the multiplication already
        happens inside fix_char_length_ulonglong().
        This fixes a too large column size created for a COLLATE clause.
      f6989d17
  3. 03 Jul, 2024 6 commits
    • Brandon Nesterenko's avatar
      MDEV-9159: Bring back assert in semisync_master.cc · d58975bb
      Brandon Nesterenko authored
      In 10.0 there was an assert to ensure that there were semi
      sync clients before removing one, but it was removed in 10.1.
      This patch adds the assertion back.
      d58975bb
    • mariadb-DebarunBanerjee's avatar
      MDEV-34458 wait_for_read in buf_page_get_low hurts performance · 73ad436e
      mariadb-DebarunBanerjee authored
      The performance regression seen while loading BP is caused by the
      deadlock fix given in MDEV-33543. The area of impact is wider but is
      more visible when BP is being loaded initially via DMLs.  Specifically
      the response time could be impacted in DML doing pessimistic operation
      on index(split/merge) and the leaf pages are not found in buffer pool.
      It is more likely to occur with small BP size.
      
      The origin of the issue dates back to MDEV-30400 that introduced
      btr_cur_t::search_leaf() replacing btr_cur_search_to_nth_level() for
      leaf page searches. In btr_latch_prev, we use RW_NO_LATCH to get the
      previous page fixed in BP without latching. When the page is not in BP,
      we try to acquire and wait for S latch violating the latching order.
      
      This deadlock was analyzed in MDEV-33543 and fixed by using the already
      present wait logic in buf_page_get_gen() instead of waiting for latch.
      The wait logic is inferior to usual S latch wait and is simply a
      repeated sleep 100 of micro-sec (The actual sleep time could be more
      depending on platforms). The bug was seen with "change-buffering" code
      path and the idea was that this path should be less exercised. The
      judgement was not correct and the path is actually quite frequent and
      does impact performance when pages are not in BP and being loaded by
      DML expanding/shrinking large data.
      
      Fix: While trying to get a page with RW_NO_LATCH and we are attempting
      "out of order" latch, return from buf_page_get_gen immediately instead
      of waiting and follow the ordered latching path.
      73ad436e
    • Oleksandr Byelkin's avatar
      Merge branch '10.5' into 10.6 · dcd8a648
      Oleksandr Byelkin authored
      dcd8a648
    • Oleksandr Byelkin's avatar
      Fix compiler errors · a4ef05d0
      Oleksandr Byelkin authored
      a4ef05d0
    • Monty's avatar
      Added Lock_time_ms and Table_catalog columns to metadata_lock_info · c91ec6a5
      Monty authored
      If compiled for debugging, LOCK_DURATION is also filled in.
      c91ec6a5
    • Daniel Black's avatar
      MDEV-34502 InnoDB debug mode build - asserts with Valgrind · 25c6e3e4
      Daniel Black authored
      Valgrind looks as the assertions as examining uninitalized values.
      
      As the assertions are tested in other Debug builds we know
      it isn't all invalid.
      
      Account for Valgrind by removing the assertion under
      the WITH_VALGRIND=1 compulation.
      25c6e3e4
  4. 02 Jul, 2024 5 commits
    • Dmitry Shulga's avatar
      MDEV-34447: Memory leakage is detected on running the test main.ps against the server 11.1 · e0124073
      Dmitry Shulga authored
      The memory leak happened on second execution of a prepared statement
      that runs UPDATE statement with correlated subquery in right hand side of
      the SET clause. In this case, invocation of the method
        table->stat_records()
      could return the zero value that results in going into the 'if' branch
      that handles impossible where condition. The issue is that this condition
      branch missed saving of leaf tables that has to be performed as first
      condition optimization activity. Later the PS statement memory root
      is marked as read only on finishing first time execution of the prepared
      statement. Next time the same statement is executed it hits the assertion
      on attempt to allocate a memory on the PS memory root marked as read only.
      This memory allocation takes place by the sequence of the following
      invocations:
       Prepared_statement::execute
        mysql_execute_command
         Sql_cmd_dml::execute
          Sql_cmd_update::execute_inner
           Sql_cmd_update::update_single_table
            st_select_lex::save_leaf_tables
             List<TABLE_LIST>::push_back
      
      To fix the issue, add the flag SELECT_LEX::leaf_tables_saved to control
      whether the method SELECT_LEX::save_leaf_tables() has to be called or
      it has been already invoked and no more invocation required.
      
      Similar issue could take place on running the DELETE statement with
      the LIMIT clause in PS/SP mode. The reason of memory leak is the same as for
      UPDATE case and be fixed in the same way.
      e0124073
    • Monty's avatar
      MDEV-34494 Add server_uid global variable and add it to error log at startup · 2739b5f5
      Monty authored
      The feedback plugin server_uid variable and the calculate_server_uid()
      function is moved from feedback/utils.cc to sql/mysqld.cc
      
      server_uid is added as a global variable (shown in 'show variables') and
      is written to the error log on server startup together with server version
      and server commit id.
      2739b5f5
    • Monty's avatar
      MDEV-34491 Setting log_slow_admin="" at startup should be converted to log_slow_admin=ALL · d8c9c5ea
      Monty authored
      We have an issue if a user have the following in a configuration file:
      log_slow_filter=""                  # Log everything to slow query log
      log_queries_not_using_indexes=ON
      
      This set log_slow_filter to 'not_using_index' which disables
      slow_query_logging of most queries.
      In effect, on should never use log_slow_filter="" in config files but
      instead use log_slow_filter=ALL.
      
      Fixed by changing log_slow_filter="" that comes either from a
      configuration file or from the command line, when starting to the server,
      to log_slow_filter=ALL.
      A warning will be printed when this happens.
      
      Other things:
      - One can now use =ALL for any 'set' variable to set all options at once.
        (backported from 10.6)
      d8c9c5ea
    • Daniel Black's avatar
      MDEV-34437: handle error on getaddrinfo · 243dee74
      Daniel Black authored
      When getaddrinfo returns and error, the contents
      of ai are invalid so we cannot continue based
      on their data structures.
      
      In the previous branch of the if statement, we
      abort there if there is an error so for consistency
      we abort here too.
      
      The test case fixes the port number to UINTMAX32
      for both an enumberated bind-address and the
      default bind-address covering the two calls to
      getaddrinfo.
      
      Review thanks Sanja.
      243dee74
    • Lena Startseva's avatar
  5. 01 Jul, 2024 4 commits
  6. 29 Jun, 2024 2 commits
  7. 28 Jun, 2024 3 commits
    • Marko Mäkelä's avatar
      Merge 10.6 into 10.11 · 1d76794a
      Marko Mäkelä authored
      1d76794a
    • Marko Mäkelä's avatar
      MDEV-32176 Contention in ha_innobase::info_low() · d1ecf5cc
      Marko Mäkelä authored
      During a Sysbench oltp_point_select workload with 1 table and 400
      concurrent connections, a bottleneck on dict_table_t::lock_mutex was
      observed in ha_innobase::info_low().
      
      dict_table_t::lock_latch: Replaces lock_mutex.
      
      In ha_innobase::info_low() and several other places, we will acquire
      a shared dict_table_t::lock_latch or we may elide the latch if
      hardware memory transactions are available.
      
      innobase_build_v_templ(): Remove the parameter "bool locked", and
      require the caller to hold exclusive dict_table_t::lock_latch
      (instead of holding an exclusive dict_sys.latch).
      
      Tested by: Vladislav Vaintroub
      Reviewed by: Vladislav Vaintroub
      d1ecf5cc
    • Lena Startseva's avatar
  8. 27 Jun, 2024 3 commits
    • Marko Mäkelä's avatar
      MDEV-33894: Resurrect innodb_log_write_ahead_size · 4ca355d8
      Marko Mäkelä authored
      As part of commit 685d958e (MDEV-14425)
      the parameter innodb_log_write_ahead_size was removed, because it was
      thought that determining the physical block size would be a sufficient
      replacement.
      
      However, we can only determine the physical block size on Linux or
      Microsoft Windows. On some file systems, the physical block size
      is not relevant. For example, XFS uses a block size of 4096 bytes
      even if the underlying block size may be smaller.
      
      On Linux, we failed to determine the physical block size if
      innodb_log_file_buffered=OFF was not requested or possible.
      This will be fixed.
      
      log_sys.write_size: The value of the reintroduced parameter
      innodb_log_write_ahead_size. To keep it simple, this is read-only
      and a power of two between 512 and 4096 bytes, so that the previous
      alignment guarantees are fulfilled. This will replace the previous
      log_sys.get_block_size().
      
      log_sys.block_size, log_t::get_block_size(): Remove.
      
      log_t::set_block_size(): Ensure that write_size will not be less
      than the physical block size. There is no point to invoke this
      function with 512 or less, because that is the minimum value of
      write_size.
      
      innodb_params_adjust(): Add some disabled code for adjusting
      the minimum value and default value of innodb_log_write_ahead_size
      to reflect the log_sys.write_size.
      
      log_t::set_recovered(): Mark the recovery completed. This is the
      place to adjust some things if we want to allow write_size>4096.
      
      log_t::resize_write_buf(): Refer to write_size.
      
      log_t::resize_start(): Refer to write_size instead of get_block_size().
      
      log_write_buf(): Simplify some arithmetics and remove a goto.
      
      log_t::write_buf(): Refer to write_size. If we are writing less than
      that, do not switch buffers, but keep writing to the same buffer.
      Move some code to improve the locality of reference.
      
      recv_scan_log(): Refer to write_size instead of get_block_size().
      
      os_file_create_func(): For type==OS_LOG_FILE on Linux, always invoke
      os_file_log_maybe_unbuffered(), so that log_sys.set_block_size() will
      be invoked even if we are not attempting to use O_DIRECT.
      
      recv_sys_t::find_checkpoint(): Read the entire log header
      in a single 12 KiB request into log_sys.buf.
      
      Tested with:
      ./mtr --loose-innodb-log-write-ahead-size=4096
      ./mtr --loose-innodb-log-write-ahead-size=2048
      4ca355d8
    • Marko Mäkelä's avatar
      Merge 10.6 into 10.11 · 27a33666
      Marko Mäkelä authored
      27a33666
    • Meng-Hsiu Chiang's avatar
      [MDEV-28162] Replace PFS_atomic with std::atomic<T> · 55db59f1
      Meng-Hsiu Chiang authored
      PFS_atomic class contains wrappers around my_atomic_* operations, which
      are macros to GNU atomic operations (__atomic_*). Due to different
      implementations of compilers, clang may encounter errors when compiling
      on x86_32 architecture.
      
      The following functions are replaced with C++ std::atomic type in
      performance schema code base:
        - PFS_atomic::store_*()
            -> my_atomic_store*
              -> __atomic_store_n()
          => std::atomic<T>::store()
      
        - PFS_atomic::load_*()
            -> my_atomic_load*
              -> __atomic_load_n()
          => std::atomic<T>::load()
      
        - PFS_atomic::add_*()
            -> my_atomic_add*
              -> __atomic_fetch_add()
          => std::atomic<T>::fetch_add()
      
        - PFS_atomic::cas_*()
          -> my_atomic_cas*
            -> __atomic_compare_exchange_n()
          => std::atomic<T>::compare_exchange_strong()
      
      and PFS_atomic class could be dropped completely.
      
      Note that in the wrapper memory order passed to original GNU atomic
      extensions are hard-coded as `__ATOMIC_SEQ_CST`, which is equivalent to
      `std::memory_order_seq_cst` in C++, and is the default parameter for
      std::atomic_* functions.
      
      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.
      55db59f1
  9. 26 Jun, 2024 6 commits
  10. 25 Jun, 2024 5 commits
    • Yuchen Pei's avatar
      ad0ee8cd
    • Yuchen Pei's avatar
      MDEV-34361 Split my.cnf in the spider suite. · 01289dac
      Yuchen Pei authored
      Just like the spider/bugfix suite.
      
      One caveat is that my_2_3.cnf needs something under mysqld.2.3 group,
      otherwise mtr will fail with something like:
      
      There is no group named 'mysqld.2.3' that can be used to resolve
      'port' for ...
      
      This will allow new tests under the spider suite to use what is
      needed. It also somehow fixes issues of running a test followed by
      spider.slave_trx_isolation.
      01289dac
    • Yuchen Pei's avatar
    • Dmitry Shulga's avatar
      MDEV-34171: Memory leakage is detected on running the test versioning.partition · 77c465d5
      Dmitry Shulga authored
      One of possible use cases that reproduces the memory leakage listed below:
      
        set timestamp= unix_timestamp('2000-01-01 00:00:00');
        create or replace table t1 (x int) with system versioning
          partition by system_time interval 1 hour auto
          partitions 3;
      
        create table t2 (x int);
      
        create trigger tr after insert on t2 for each row update t1 set x= 11;
        create or replace procedure sp2() insert into t2 values (5);
      
        set timestamp= unix_timestamp('2000-01-01 04:00:00');
        call sp2;
      
        set timestamp= unix_timestamp('2000-01-01 13:00:00');
        call sp2; # <<=== Memory leak happens there. In case MariaDB server is built
                          with the option -DWITH_PROTECT_STATEMENT_MEMROOT,
                          the second execution would hit assert failure.
      
      The reason of leaking a memory is that once a new partition be created
      the table should be closed and re-opened. It results in calling the function
      extend_table_list() that indirectly invokes the function sp_add_used_routine()
      to add routines implicitly used by the statement that makes a new memory
      allocation.
      
      To fix it, don't remove routines and tables the statement implicitly depends
      on when a table being closed for subsequent re-opening.
      77c465d5
    • Dmitry Shulga's avatar
      MDEV-24411: Trigger doesn't work correctly with bulk insert · 8b169949
      Dmitry Shulga authored
      Executing an INSERT statement in PS mode having positional parameter
      bound with an array could result in incorrect number of inserted rows
      in case there is a BEFORE INSERT trigger that executes yet another
      INSERT statement to put a copy of row being inserted into some table.
      
      The reason for incorrect number of inserted rows is that a data structure
      used for binding positional argument with its actual values is stored
      in THD (this is thd->bulk_param) and reused on processing every INSERT
      statement. It leads to consuming actual values bound with top-level
      INSERT statement by other INSERT statements used by triggers' body.
      
      To fix the issue, reset the thd->bulk_param temporary to the value nullptr
      before invoking triggers and restore its value on finishing its execution.
      8b169949
  11. 24 Jun, 2024 2 commits