mariadb/storage/innobase/include
Teemu Ollakka f307160218 MDEV-29293 MariaDB stuck on starting commit state
This commit contains a merge from 10.5-MDEV-29293-squash
into 10.6.

Although the bug MDEV-29293 was not reproducible with 10.6,
the fix contains several improvements for wsrep KILL query and
BF abort handling, and addresses the following issues:

* MDEV-30307 KILL command issued inside a transaction is
  problematic for galera replication:
  This commit will remove KILL TOI replication, so Galera side
  transaction context is not lost during KILL.
* MDEV-21075 KILL QUERY maintains nodes data consistency but
  breaks GTID sequence: This is fixed as well as KILL does not
  use TOI, and thus does not change GTID state.
* MDEV-30372 Assertion in wsrep-lib state: This was caused by
  BF abort or KILL when local transaction was in the middle
  of group commit. This commit disables THD::killed handling
  during commit, so the problem is avoided.
* MDEV-30963 Assertion failure !lock.was_chosen_as_deadlock_victim
  in trx0trx.h:1065: The assertion happened when the victim was
  BF aborted via MDL while it was committing. This commit changes
  MDL BF aborts so that transactions which are committing cannot
  be BF aborted via MDL. The RQG grammar attached in the issue
  could not reproduce the crash anymore.

Original commit message from 10.5 fix:

    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).
    * Make galera_var_retry_autocommit result more readable by echoing
      cases and expectations into result. Only one expected result for
      reap to verify that server returns expected status for query.
    * 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_bf_abort_registering to check that registering trx gets
      BF aborted through MDL.
    * 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:42:05 +02:00
..
btr0btr.h MDEV-29835 InnoDB hang on B-tree split or merge 2023-03-16 15:52:42 +02:00
btr0btr.inl MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
btr0bulk.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
btr0cur.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
btr0cur.inl MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
btr0defragment.h MDEV-25791: Remove UNIV_INTERN 2021-05-27 13:28:08 +03:00
btr0pcur.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
btr0pcur.inl MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
btr0sea.h Merge 10.5 into 10.6 2022-12-13 16:58:58 +02:00
btr0sea.inl MDEV-27700 ASAN: Heap_use_after_free in btr_search_drop_page_hash_index() 2022-08-22 16:29:46 +05:30
btr0types.h MDEV-29835 InnoDB hang on B-tree split or merge 2023-03-16 15:52:42 +02:00
buf0block_hint.h MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
buf0buddy.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
buf0buf.h MDEV-29911 InnoDB recovery and mariadb-backup --prepare fail to report detailed progress 2023-05-19 15:20:07 +03:00
buf0buf.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
buf0checksum.h MDEV-25105 Remove innodb_checksum_algorithm values none,innodb,... 2021-03-11 12:46:18 +02:00
buf0dblwr.h Merge 10.5 into 10.6 2023-04-25 13:10:33 +03:00
buf0dump.h
buf0flu.h MDEV-26827 Make page flushing even faster 2023-03-16 17:19:58 +02:00
buf0lru.h MDEV-26826 Duplicated computations of buf_pool.page_hash addresses 2021-10-22 12:33:37 +03:00
buf0rea.h MDEV-29911 InnoDB recovery and mariadb-backup --prepare fail to report detailed progress 2023-05-19 15:20:07 +03:00
buf0types.h MDEV-28845 InnoDB: Failing assertion: bpage->can_relocate() in buf0lru.cc 2022-06-15 17:00:05 +03:00
data0data.h MDEV-26294 Duplicate entries in unique index not detected when changing collation 2022-07-04 16:13:04 +03:00
data0data.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
data0type.h MDEV-26294 Duplicate entries in unique index not detected when changing collation 2022-07-04 16:13:04 +03:00
data0type.inl cleanup: un-inline dtype_get_mblen() 2022-04-13 17:50:00 +02:00
data0types.h
db0err.h Merge 10.5 into 10.6 2022-06-09 13:34:52 +03:00
dict0boot.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
dict0crea.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
dict0crea.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
dict0defrag_bg.h MDEV-25919 fixup: Acquire MDL also in defragmentation 2021-09-18 14:39:32 +03:00
dict0dict.h MDEV-29504/MDEV-29849 TRUNCATE breaks FOREIGN KEY locking 2022-11-08 17:34:34 +02:00
dict0dict.inl MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
dict0load.h MDEV-29504/MDEV-29849 TRUNCATE breaks FOREIGN KEY locking 2022-11-08 17:34:34 +02:00
dict0mem.h Merge 10.5 into 10.6 2023-01-03 18:13:11 +02:00
dict0mem.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
dict0pagecompress.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
dict0pagecompress.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
dict0stats.h Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
dict0stats.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
dict0stats_bg.h Merge 10.5 into 10.6 2022-04-26 15:21:20 +03:00
dict0types.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
dyn0buf.h MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
dyn0types.h
eval0eval.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
eval0eval.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
eval0proc.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
eval0proc.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
fil0crypt.h MDEV-13542: Do not crash on decryption failure 2022-06-08 09:48:12 +03:00
fil0crypt.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
fil0fil.h Merge 10.5 into 10.6 2023-05-15 09:02:32 +03:00
fil0pagecompress.h Merge 10.4 into 10.5 2021-08-18 18:22:35 +03:00
fsp0file.h MDEV-27014 InnoDB fails to restore page 0 from the doublewrite buffer 2021-12-12 09:58:54 +05:30
fsp0fsp.h Merge 10.5 into 10.6 2022-12-13 16:58:58 +02:00
fsp0space.h MDEV-25312 Replace fil_space_t::name with fil_space_t::name() 2021-04-07 18:01:13 +03:00
fsp0sysspace.h Cleanup: Make InnoDB page numbers uint32_t 2020-10-15 17:06:17 +03:00
fsp0types.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
fts0ast.h Merge 10.4 to 10.5 2020-10-22 17:08:49 +03:00
fts0blex.h
fts0fts.h MDEV-30996 insert.. select in presence of full text index freezes all other commits at commit time 2023-04-24 11:06:56 +05:30
fts0opt.h
fts0pars.h
fts0plugin.h
fts0priv.h Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
fts0priv.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
fts0tlex.h
fts0tokenize.h
fts0types.h MDEV-30996 insert.. select in presence of full text index freezes all other commits at commit time 2023-04-24 11:06:56 +05:30
fts0types.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
fts0vlc.h MDEV-19522 InnoDB commit fails when FTS_DOC_ID value is greater than 4294967295 2021-10-21 12:56:59 +03:00
fut0lst.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
gis0geo.h
gis0rtree.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
gis0rtree.inl MDEV-21098: Assertion failure in rec_get_offsets_func() 2022-08-01 11:25:50 +03:00
gis0type.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
ha0ha.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ha0ha.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ha0storage.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ha0storage.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ha_prototypes.h MDEV-30413 : run sequence nextval got [Note] WSREP: MDL BF-BF conflict and [ERROR] Aborting 2023-03-30 13:32:44 +02:00
handler0alter.h Merge branch '10.2' into 10.3 2020-05-04 16:47:11 +02:00
hash0hash.h After-merge fixes 2022-03-08 09:04:03 +02:00
ibuf0ibuf.h Merge 10.5 into 10.6 2022-11-14 15:44:55 +02:00
ibuf0ibuf.inl MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
lock0iter.h
lock0lock.h MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
lock0lock.inl MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
lock0prdt.h MDEV-20612: Partition lock_sys.latch 2021-02-12 17:44:32 +02:00
lock0priv.h After-merge fixes 2022-03-08 09:04:03 +02:00
lock0priv.inl After-merge fixes 2022-03-08 09:04:03 +02:00
lock0types.h MDEV-20612: Partition lock_sys.latch 2021-02-12 17:44:32 +02:00
log0crypt.h MDEV-25791: Remove UNIV_INTERN 2021-05-27 13:28:08 +03:00
log0log.h MDEV-31132 Deadlock between DDL and purge of InnoDB history 2023-04-26 12:08:59 +03:00
log0log.inl MDEV-31132 Deadlock between DDL and purge of InnoDB history 2023-04-26 12:08:59 +03:00
log0recv.h MDEV-29911 InnoDB recovery and mariadb-backup --prepare fail to report detailed progress 2023-05-19 15:20:07 +03:00
log0types.h MDEV-22325 ib_logfile0 is too small for innodb_thread_concurrency=0. The size of ib_logfile0 should be bigger than 200 kB * innodb_thread_concurrency. 2020-06-09 03:15:31 +03:00
mach0data.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
mach0data.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
mem0mem.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
mem0mem.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
mtr0log.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
mtr0mtr.h MDEV-29593 Purge misses a chance to free not-yet-reused undo pages 2023-04-21 17:58:09 +03:00
mtr0types.h MDEV-30638 Deadlock between INSERT and InnoDB non-persistent statistics update 2023-02-16 08:30:20 +02:00
os0file.h MDEV-29911 InnoDB recovery and mariadb-backup --prepare fail to report detailed progress 2023-05-19 15:20:07 +03:00
os0file.inl MDEV-30132 Crash after recovery, with InnoDB: Tried to read ... 2022-11-30 10:54:03 +02:00
page0cur.h MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
page0cur.inl MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
page0page.h MDEV-28797 Assertion `page_rec_is_user_rec(rec)' failed in PageBulk::getSplitRec 2022-11-08 15:27:29 +05:30
page0page.inl MDEV-28797 Assertion `page_rec_is_user_rec(rec)' failed in PageBulk::getSplitRec 2022-11-08 15:27:29 +05:30
page0types.h MDEV-27924 page_zip_copy_recs() corrupts ROW_FORMAT=COMPRESSED block descriptor 2022-02-23 11:34:52 +02:00
page0zip.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
page0zip.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
pars0grm.h Cleanup: Remove pars_stored_procedure_call() 2021-07-29 15:37:35 +03:00
pars0opt.h
pars0pars.h MDEV-25919 preparation: Various cleanup 2021-08-31 13:54:20 +03:00
pars0sym.h
pars0types.h
que0que.h Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
que0que.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
que0types.h MDEV-23379 Deprecate&ignore InnoDB concurrency throttling parameters 2020-08-04 06:59:29 +03:00
read0types.h MDEV-24402: InnoDB CHECK TABLE ... EXTENDED 2022-10-21 10:02:54 +03:00
rem0cmp.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
rem0cmp.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
rem0rec.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
rem0rec.inl MDEV-21098: Assertion failure in rec_get_offsets_func() 2022-08-01 11:25:50 +03:00
rem0types.h Merge 10.4 into 10.5 2020-05-05 21:16:22 +03:00
row0ext.h Merge branch '10.3' into 10.4 2022-01-30 09:46:52 +01:00
row0ext.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
row0ftsort.h Cleanup: Replace mysql_cond_t with pthread_cond_t 2021-02-07 13:21:18 +02:00
row0import.h
row0ins.h Merge 10.5 into 10.6 2023-03-28 15:25:52 +03:00
row0log.h MDEV-15250 UPSERT during ALTER TABLE results in 'Duplicate entry' error for alter 2022-04-26 16:22:56 +05:30
row0merge.h MDEV-26294 Duplicate entries in unique index not detected when changing collation 2022-07-04 16:13:04 +03:00
row0mysql.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
row0purge.h Simplify purge a little 2022-10-06 13:15:12 +03:00
row0quiesce.h
row0row.h MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
row0row.inl Merge branch '10.3' into 10.4 2022-01-30 09:46:52 +01:00
row0sel.h MDEV-24402: InnoDB CHECK TABLE ... EXTENDED 2022-10-21 10:02:54 +03:00
row0types.h Merge 10.4 into 10.5 2020-03-30 19:07:25 +03:00
row0uins.h
row0umod.h
row0undo.h
row0upd.h Merge 10.5 into 10.6 2023-01-03 18:13:11 +02:00
row0upd.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
row0vers.h MDEV-24402: InnoDB CHECK TABLE ... EXTENDED 2022-10-21 10:02:54 +03:00
rw_lock.h MDEV-26781 InnoDB hangs when using SUX_LOCK_GENERIC 2022-04-06 12:51:27 +03:00
small_vector.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
srv0mon.h Merge branch '10.5' into 10.6 2022-05-18 10:30:47 +02:00
srv0mon.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
srv0srv.h MDEV-31309 Innodb_buffer_pool_read_requests is not updated correctly 2023-05-19 15:38:48 +03:00
srv0start.h Merge 10.5 into 10.6 2022-09-26 14:34:43 +03:00
srw_lock.h MDEV-26781 InnoDB hangs when using SUX_LOCK_GENERIC 2022-04-06 12:51:27 +03:00
sux_lock.h Cleanup: Remove os0thread 2022-04-19 13:49:52 +03:00
transactional_lock_guard.h MDEV-27956 hardware lock ellision on s390x/ppc64{,le} 2022-03-11 10:42:27 +11:00
trx0i_s.h Merge 10.2 into 10.3 2021-07-27 10:47:17 +03:00
trx0purge.h MDEV-29401 InnoDB history list length increased in 10.6 compared to 10.5 2023-04-27 17:11:32 +03:00
trx0rec.h MDEV-24402: InnoDB CHECK TABLE ... EXTENDED 2022-10-21 10:02:54 +03:00
trx0roll.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
trx0rseg.h MDEV-30863 Server freeze, all threads in trx_assign_rseg_low() 2023-04-18 14:54:40 +03:00
trx0sys.h Merge 10.5 into 10.6 2023-05-19 12:24:58 +03:00
trx0trx.h MDEV-30357 Performance regression in locking reads from secondary indexes 2023-03-16 16:00:45 +02:00
trx0trx.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
trx0types.h MDEV-25062: Reduce trx_rseg_t::mutex contention 2021-06-23 13:42:11 +03:00
trx0undo.h MDEV-26782 InnoDB temporary tablespace: reclaiming of free space does not work 2023-04-21 17:58:26 +03:00
trx0undo.inl MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
trx0xa.h
univ.i MDEV-21452 fixup: Remove PFS_NOT_INSTRUMENTED 2022-11-24 15:04:25 +02:00
ut0byte.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ut0byte.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ut0counter.h Cleanup: Remove os0thread 2022-04-19 13:49:52 +03:00
ut0crc32.h MDEV-19935 Create unified CRC-32 interface 2020-09-17 16:07:37 +02:00
ut0dbg.h
ut0list.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ut0list.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ut0lst.h Do not use C++11 before MariaDB 10.4 2022-10-14 11:54:05 +03:00
ut0mem.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ut0mem.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ut0new.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
ut0pool.h MDEV-28836: Memory alignment cleanup 2022-06-21 16:59:49 +03:00
ut0rbt.h
ut0rnd.h Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
ut0rnd.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
ut0sort.h
ut0stage.h
ut0ut.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
ut0ut.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ut0vec.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ut0vec.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ut0wqueue.h Merge 10.5 into 10.6 2021-10-21 16:06:34 +03:00