mariadb/include/mysql
Teemu Ollakka 3f59bbeeae MDEV-29293 MariaDB stuck on starting commit state
The problem seems to be a deadlock between KILL command execution
and BF abort issued by an applier, where:
* KILL has locked victim's LOCK_thd_kill and LOCK_thd_data.
* Applier has innodb side global lock mutex and victim trx mutex.
* KILL is calling innobase_kill_query, and is blocked by innodb
  global lock mutex.
* Applier is in wsrep_innobase_kill_one_trx and is blocked by
  victim's LOCK_thd_kill.

The fix in this commit removes the TOI replication of KILL command
and makes KILL execution less intrusive operation. Aborting the
victim happens now by using awake_no_mutex() and ha_abort_transaction().
If the KILL happens when the transaction is committing, the
KILL operation is postponed to happen after the statement
has completed in order to avoid KILL to interrupt commit
processing.

Notable changes in this commit:
* wsrep client connections's error state may remain sticky after
  client connection is closed. This error message will then pop
  up for the next client session issuing first SQL statement.
  This problem raised with test galera.galera_bf_kill.
  The fix is to reset wsrep client error state, before a THD is
  reused for next connetion.
* Release THD locks in wsrep_abort_transaction when locking
  innodb mutexes. This guarantees same locking order as with applier
  BF aborting.
* BF abort from MDL was changed to do BF abort on server/wsrep-lib
  side first, and only then do the BF abort on InnoDB side. This
  removes the need to call back from InnoDB for BF aborts which originate
  from MDL and simplifies the locking.
* Removed wsrep_thd_set_wsrep_aborter() from service_wsrep.h.
  The manipulation of the wsrep_aborter can be done solely on
  server side. Moreover, it is now debug only variable and
  could be excluded from optimized builds.
* Remove LOCK_thd_kill from wsrep_thd_LOCK/UNLOCK to allow more
  fine grained locking for SR BF abort which may require locking
  of victim LOCK_thd_kill. Added explicit call for
  wsrep_thd_kill_LOCK/UNLOCK where appropriate.
* Wsrep-lib was updated to version which allows external
  locking for BF abort calls.

Changes to MTR tests:
* Disable galera_bf_abort_group_commit. This test is going to
  be removed (MDEV-30855).
* Record galera_gcache_recover_manytrx as result file was incomplete.
  Trivial change.
* Make galera_create_table_as_select more deterministic:
  Wait until CTAS execution has reached MDL wait for multi-master
  conflict case. Expected error from multi-master conflict is
  ER_QUERY_INTERRUPTED. This is because CTAS does not yet have open
  wsrep transaction when it is waiting for MDL, query gets interrupted
  instead of BF aborted. This should be addressed in separate task.
* A new test galera_kill_group_commit to verify correct behavior
  when KILL is executed while the transaction is committing.

Co-authored-by: Seppo Jaakola <seppo.jaakola@iki.fi>
Co-authored-by: Jan Lindström <jan.lindstrom@galeracluster.com>
Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-05-22 00:39:43 +02:00
..
psi Merge branch 'merge-perfschema-5.7' into 10.5 2023-04-28 08:22:17 +02:00
auth_dialog_client.h Update FSF address 2019-05-10 20:52:00 +03:00
client_plugin.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
client_plugin.h.pp MDEV-8052 abi detection incorrect with clang 2015-06-03 09:54:56 +02:00
plugin.h Merge 10.4 into 10.5 2022-12-13 14:39:18 +02:00
plugin_audit.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
plugin_audit.h.pp Merge 10.4 into 10.5 2022-12-13 14:39:18 +02:00
plugin_auth.h MDEV-27341 Use SET PASSWORD to change PAM service 2022-01-17 18:19:29 +01:00
plugin_auth.h.pp Merge 10.4 into 10.5 2022-12-13 14:39:18 +02:00
plugin_auth_common.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
plugin_data_type.h cleanup: data type plugins 2019-10-31 11:19:39 +01:00
plugin_data_type.h.pp Merge 10.4 into 10.5 2022-12-13 14:39:18 +02:00
plugin_encryption.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
plugin_encryption.h.pp Merge 10.4 into 10.5 2022-12-13 14:39:18 +02:00
plugin_ftparser.h header typos 2022-12-20 08:55:48 +11:00
plugin_ftparser.h.pp Merge 10.4 into 10.5 2022-12-13 14:39:18 +02:00
plugin_function.h Part1: MDEV-20837 Add MariaDB_FUNCTION_PLUGIN 2019-10-16 21:40:30 +04:00
plugin_function.h.pp Merge 10.4 into 10.5 2022-12-13 14:39:18 +02:00
plugin_password_validation.h Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
plugin_password_validation.h.pp Merge 10.4 into 10.5 2022-12-13 14:39:18 +02:00
service_base64.h header typos 2022-12-20 08:55:48 +11:00
service_debug_sync.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
service_encryption.h post fix for "move alloca() definition from all *.h files to one new header file" 2023-03-08 17:36:36 +01:00
service_encryption_scheme.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
service_json.h Improve documentation of json parser functions 2021-07-22 21:51:49 +03:00
service_kill_statement.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
service_logger.h Merge branch '5.5' into 10.1 2019-05-11 19:15:57 +03:00
service_md5.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
service_my_crypt.h MDEV-25785 Add support for OpenSSL 3.0 2022-07-04 12:49:11 +02:00
service_my_print_error.h remove incorrect #ifdef 2019-08-26 23:33:42 +02:00
service_my_snprintf.h header typos 2022-12-20 08:55:48 +11:00
service_progress_report.h Merge branch '5.5' into 10.1 2019-05-11 19:15:57 +03:00
service_sha1.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
service_sha2.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
service_thd_alloc.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
service_thd_autoinc.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
service_thd_error_context.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
service_thd_mdl.h MDEV-16678 Prefer MDL to dict_sys.latch for innodb background tasks 2019-12-10 15:42:50 +02:00
service_thd_rnd.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
service_thd_specifics.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
service_thd_timezone.h header typos 2022-12-20 08:55:48 +11:00
service_thd_wait.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
service_wsrep.h MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:39:43 +02:00
services.h Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00