1. 01 Jul, 2024 1 commit
    • Denis Protivensky's avatar
      MDEV-33064: Sync trx->wsrep state from THD on trx start · cfbd57df
      Denis Protivensky authored
      InnoDB transactions may be reused after committed:
      - when taken from the transaction pool
      - during a DDL operation execution
      
      In this case wsrep flag on trx object is cleared, which may cause wrong
      execution logic afterwards (wsrep-related hooks are not run).
      
      Make trx->wsrep flag initialize from THD object only once on InnoDB transaction
      start and don't change it throughout the transaction's lifetime.
      The flag is reset at commit time as before.
      
      Unconditionally set wsrep=OFF for THD objects that represent InnoDB background
      threads.
      
      Make Wsrep_schema::store_view() operate in its own transaction.
      
      Fix streaming replication transactions' fragments rollback to not switch
      THD->wsrep value during transaction's execution
      (use THD->wsrep_ignore_table as a workaround).
      Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
      cfbd57df
  2. 29 Jun, 2024 1 commit
  3. 28 Jun, 2024 1 commit
    • 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
  4. 26 Jun, 2024 3 commits
  5. 25 Jun, 2024 4 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-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
  6. 24 Jun, 2024 4 commits
  7. 22 Jun, 2024 3 commits
  8. 21 Jun, 2024 2 commits
  9. 20 Jun, 2024 6 commits
    • Dave Gosselin's avatar
      MDEV-33746 Supply missing override markings · db0c28ef
      Dave Gosselin authored
      Find and fix missing virtual override markings.  Updates cmake
      maintainer flags to include -Wsuggest-override and
      -Winconsistent-missing-override.
      db0c28ef
    • Vlad Lesin's avatar
      MDEV-34108 Inappropriate semi-consistent read in RC if innodb_snapshot_isolation=ON · 0a199cb8
      Vlad Lesin authored
      The fixes in b8a67198 have not disabled
      semi-consistent read for innodb_snapshot_isolation=ON mode, they just allowed
      read uncommitted version of a record, that's why the test for MDEV-26643 worked
      well.
      
      The semi-consistent read should be disabled on upper level in
      row_search_mvcc() for READ COMMITTED isolation level.
      
      Reviewed by Marko Mäkelä.
      0a199cb8
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-34389 Avoid log overwrite in early recovery · ab448d4b
      Thirunarayanan Balathandayuthapani authored
      - InnoDB tries to write FILE_CHECKPOINT marker during
      early recovery when log file size is insufficient.
      While updating the log checkpoint at the end of the recovery,
      InnoDB must already have written out all pending changes
      to the persistent files. To complete the checkpoint, InnoDB
      has to write some log records for the checkpoint and to
      update the checkpoint header. If the server gets killed
      before updating the checkpoint header then it would lead
      the logfile to be unrecoverable.
      
      - This patch avoids FILE_CHECKPOINT marker during early
      recovery and narrows down the window of opportunity to
      make the log file unrecoverable.
      ab448d4b
    • Alexander Barkov's avatar
      MDEV-34417 Wrong result set with utf8mb4_danish_ci and BNLH join · 6cecf61a
      Alexander Barkov authored
      There were erroneous calls for charpos() in key_hashnr() and key_buf_cmp().
      These functions are never called with prefix segments.
      
      The charpos() calls were wrong. Before the change BNHL joins
      - could return wrong result sets, as reported in MDEV-34417
      - were extremely slow for multi-byte character sets, because
        the hash was calculated on string prefixes, which increased
        the amount of collisions drastically.
      
      This patch fixes the wrong result set as reported in MDEV-34417,
      as well as (partially) the performance problem reported in MDEV-34352.
      6cecf61a
    • Monty's avatar
      Disable new connections in case of fatal signal · 279aa1e6
      Monty authored
      A user reported that MariaDB server got a signal 6 but still accepted new
      connections and did not crash.  I have not been able to find a way to
      repeat this or find the cause of issue. However to make it easier to
      notice that the server is unstable, I added code to disable new
      connections when the handle_fatal_signal() handler has been called.
      279aa1e6
    • Monty's avatar
      MDEV-33582 Add more warnings to be able to better diagnose network issues · 3541bd63
      Monty authored
      Changed the logged messages from errors to warnings
      Also changed 'remain' to 'read_length' in the warning to make it more readable.
      3541bd63
  10. 19 Jun, 2024 11 commits
    • Vladislav Vaintroub's avatar
      MDEV-34428 bootstrap can't delete tempfile, it is already gone · 6c2cd4cf
      Vladislav Vaintroub authored
      The problem is seen on CI, where TEMP pointed to directory outside of
      the usual vardir, when testing mysql_install_db.exe
      A likely cause for this error is that TEMP was periodically cleaned up
      by some automation running on the host, perhaps by buildbot itself.
      
      To fix, mysql_install_db.exe will now use datadir as --tmpdir
      for the bootstrap run. This will minimize chances to run into any
      environment problems.
      6c2cd4cf
    • Vicențiu Ciorbaru's avatar
      MDEV-34311: Alter USER should reset all account limit counters · 63823391
      Vicențiu Ciorbaru authored
      This commit introduces a reset of password errors counter on any alter user
      command for the altered user. This is done so as to not require a
      complete privilege system reload.
      63823391
    • Vicențiu Ciorbaru's avatar
      cleanup, refactor · 2d8d8139
      Vicențiu Ciorbaru authored
      Fix coding style and extract common password reset counter code into
      separate ACL_USER method.
      2d8d8139
    • Iaroslav Babanin's avatar
      MDEV-33935 fix deadlock counter · 5d49a2ad
      Iaroslav Babanin authored
      - The deadlock counter was moved from
      Deadlock::find_cycle into Deadlock::report, because
      the find_cycle method is called multiple times during deadlock
      detection flow, which means it shouldn't have such side effects.
      But report() can, which called only once for
      a victim transaction.
      - Also the deadlock_detect.test and *.result test case
      has been extended to handle the fix.
      5d49a2ad
    • Jan Lindström's avatar
      MDEV-31658 : Deadlock found when trying to get lock during applying · ee974ca5
      Jan Lindström authored
      Problem was that there was two non-conflicting local idle
      transactions in node_1 that both inserted a key to primary key.
      Then two transactions from other nodes inserted also
      a key to primary key so that insert from node_2 conflicted
      one of the local transactions in node_1 so that there would
      be duplicate key if both are committed. For this insert
      from other node tries to acquire S-lock for this record
      and because this insert is high priority brute force (BF)
      transaction it will kill idle local transaction.
      
      Concurrently, second insert from node_3 conflicts the second
      idle insert transaction in node_1. Again, it tries to acquire
      S-lock for this record and kills idle local transaction.
      
      At this point we have two non-conflicting high priority
      transactions holding S-lock on different records in node_1.
      For example like this: rec s-lock-node2-rec s-lock-node3-rec rec.
      
      Because these high priority BF-transactions do not wait
      each other insert from node3 that has later seqno compared
      to insert from node2 can continue. It will try to acquire
      insert intention for record it tries to insert (to avoid
      duplicate key to be inserted by local transaction). Hower,
      it will note that there is conflicting S-lock in same gap
      between records. This will lead deadlock error as we have
      defined that BF-transactions may not wait for record lock
      but we can't kill conflicting BF-transaction because
      it has lower seqno and it should commit first.
      
      BF-transactions are executed concurrently because their
      values to primary key are different i.e. they do not
      conflict.
      
      Galera certification will make sure that inserts from
      other nodes i.e these high priority BF-transactions
      can't insert duplicate keys. Local transactions naturally
      can but they will be killed when BF-transaction
      acquires required record locks.
      
      Therefore, we can allow situation where there is conflicting
      S-lock and insert intention lock regardless of their seqno
      order and let both continue with no wait. This will lead
      to situation where we need to allow BF-transaction
      to wait when lock_rec_has_to_wait_in_queue is called
      because this function is also called from
      lock_rec_queue_validate and because lock is waiting
      there would be assertion in ut_a(lock->is_gap()
      || lock_rec_has_to_wait_in_queue(cell, lock));
      
      lock_wait_wsrep_kill
        Add debug sync points for BF-transactions killing
        local transaction.
      
      wsrep_assert_no_bf_bf_wait
        Print also requested lock information
      
      lock_rec_has_to_wait
        Add function to handle wsrep transaction lock wait
        cases.
      
      lock_rec_has_to_wait_wsrep
        New function to handle wsrep transaction lock wait
        exceptions.
      
      lock_rec_has_to_wait_in_queue
        Remove wsrep exception, in this function all
        conflicting locks need to wait in queue.
        Conflicts between BF and local transactions
        are handled in lock_wait.
      Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
      ee974ca5
    • Julius Goryavsky's avatar
    • Jan Lindström's avatar
      MDEV-12008 : Change error code for Galera unkillable threads · 1001dae1
      Jan Lindström authored
      Changed error code for Galera unkillable threads to
      be ER_KILL_DENIED_HIGH_PRIORITY giving message
      
      This is a high priority thread/query and cannot be killed
      without the compromising consistency of the cluster
      
      also a warning is produced
        Thread %lld is [wsrep applier|high priority] and cannot be killed
      Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
      1001dae1
    • Marko Mäkelä's avatar
      MDEV-34178: Enable spinloop for index_lock · 5b26a076
      Marko Mäkelä authored
      In an I/O bound concurrent INSERT test conducted by Mark Callaghan,
      spin loops on dict_index_t::lock turn out to be beneficial.
      
      This is a mixed bag; enabling the spin loops will improve throughput
      and latency on some workloads and degrade in others.
      
      Reviewed by: Debarun Banerjee
      Tested by: Matthias Leich
      Performance tested by: Axel Schwenke
      5b26a076
    • Marko Mäkelä's avatar
      MDEV-34178: Improve the spin loops · f8d213bd
      Marko Mäkelä authored
      srw_mutex_impl<spinloop>::wait_and_lock(): Invoke srw_pause() and
      reload the lock word on each loop. Thanks to Mark Callaghan for
      suggesting this.
      
      ssux_lock_impl<spinloop>::rd_wait(): Actually implement a spin loop
      on the rw-lock component without blocking on the mutex component.
      If there is a conflict with wr_lock(), wait for writer.lock to be
      released without actually acquiring it.
      
      Reviewed by: Debarun Banerjee
      Tested by: Matthias Leich
      f8d213bd
    • Marko Mäkelä's avatar
      MDEV-34178: Improve PERFORMANCE_SCHEMA instrumentation · 6cde03ae
      Marko Mäkelä authored
      When MariaDB is built with PERFORMANCE_SCHEMA support enabled
      and with futex-based rw-locks (not srw_lock_), we were unnecessarily
      releasing and reacquiring lock.writer in srw_lock_impl::psi_wr_lock()
      and ssux_lock::psi_wr_lock().
      
      If there is a conflict with rd_lock(), let us hold the lock.writer
      and execute u_wr_upgrade() to wait for rd_unlock().
      
      Reviewed by: Debarun Banerjee
      Tested by: Matthias Leich
      6cde03ae
    • Alexander Barkov's avatar
      MDEV-27966 Assertion `fixed()' failed and Assertion `fixed == 1' failed, both... · cfa61434
      Alexander Barkov authored
      MDEV-27966 Assertion `fixed()' failed and Assertion `fixed == 1' failed, both in Item_func_concat::val_str on SELECT after INSERT with collation utf32_bin on utf8_bin table
      
      This problem was earlier fixed by this commit:
      
      > commit 08c7ab40
      > Author: Aleksey Midenkov <midenok@gmail.com>
      > Date:   Mon Apr 18 12:44:27 2022 +0300
      >
      >    MDEV-24176 Server crashes after insert in the table with virtual
      >    column generated using date_format() and if()
      
      Adding an mtr test only.
      cfa61434
  11. 18 Jun, 2024 4 commits
    • Marko Mäkelä's avatar
      MDEV-34178: Simplify the U lock · 2bd661ca
      Marko Mäkelä authored
      The U lock mode of the sux_lock that was introduced in
      commit 03ca6495 (MDEV-24142)
      is unnecessarily complex.
      
      Internally, sux_lock comprises two parts, each with their own wait queue
      inside the operating system kernel: a mutex and a rw-lock.
      
      We can map the operations as follows:
      
      x_lock(): (X,X)
      u_lock(): (X,_)
      s_lock(): (_,S)
      
      The Update lock mode, which is mutually exclusive with itself and with
      X (exclusive) locks but not with shared (S) locks, was unnecessarily
      acquiring a shared lock on the second component. The mutual exclusion
      is guaranteed by the first component.
      
      We might simplify the #ifdef SUX_LOCK_GENERIC case further by omitting
      srw_mutex_impl::lock, because it is kind-of duplicating the mutex
      that we will use for having a wait queue. However, the predicate
      buf_page_t::can_relocate() would depend on the predicate
      is_locked_or_waiting(), which is not available for pthread_mutex_t.
      
      Reviewed by: Debarun Banerjee
      Tested by: Matthias Leich
      2bd661ca
    • Brandon Nesterenko's avatar
      MDEV-23857: replication master password length · 6cab2f75
      Brandon Nesterenko authored
      After MDEV-4013, the maximum length of replication passwords was extended to
      96 ASCII characters. After a restart, however, slaves only read the first 41
      characters of MASTER_PASSWORD from the master.info file. This lead to slaves
      unable to reconnect to the master after a restart.
      
      After a slave restart, if a master.info file is detected, use the full
      allowable length of the password rather than 41 characters.
      
      Reviewed By:
      ============
      Sergei Golubchik <serg@mariadb.com>
      6cab2f75
    • Brandon Nesterenko's avatar
      MDEV-34397: "delete si" rather than "my_free(si)" in THD::register_slave() · 0e25cc51
      Brandon Nesterenko authored
      In the error case of THD::register_slave(), there is undefined
      behavior of Slave_info si because it is allocated via malloc()
      (my_malloc), and cleaned up via delete().
      
      This patch makes these consistent by switching si's cleanup
      to use my_free.
      0e25cc51
    • Souradeep Saha's avatar
      MDEV-34168: Extend perror utility to print link to KB page · 10fbd1ce
      Souradeep Saha authored
      As all MariaDB Server errors now have a dedicated web page, the
      perror utility is extended to include a link to the KB page of
      the corresponding error code.
      
      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.
      10fbd1ce