[MDEV-30161] InnoDB lock wait timeout watchdog Created: 2022-12-05  Updated: 2023-02-14

Status: Open
Project: MariaDB Server
Component/s: Galera, Storage Engine - InnoDB
Affects Version/s: 10.6
Fix Version/s: 10.6

Type: Bug Priority: Major
Reporter: Jan Lindström (Inactive) Assignee: Seppo Jaakola
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File node2.err    

 Description   

As transactions which are executed by appliers have passed certification in the cluster, they must be applied and committed successfully. These transactions are called brute force (BF). Normally, when BF transaction is requesting conflicting lock that is held by local transaction, local transaction is aborted and rolled back. However, occasionally BF aborting local transactions may not work perfectly due to race conditions or unforeseen behavior of the lock manager, which may cause appliers to wait locks indefinitely. There has been bug reports containing error log message "WSREP: BF lock wait long for trx:" (.e.g. MDEV-20082, MDEV-28070, MDEV-15822, MDEV-17809 etc). These are caused by bug or BF abort did not happen or was unsuccessful, when the applier originally faced a lock conflict with the lock holder. Reproducing these problems have proved to be very hard and in many cases reason for this long lock wait was not found.

In order to resolve indefinite applier waits, a short applier lock wait timeout is introduced. However instead of giving up with lock wait, a background thread is used to retry BF abort on behalf of the applier which is waiting for the lock.

A variable to control the applier lock wait timeout is innodb_wsrep_applier_lock_wait_timeout with default value of five seconds. If the value is zero, the background BF aborting is disabled.

The value of innodb_wsrep_applier_lock_wait_timeout is set to zero in Galera suite MTR test configuration to avoid non-deterministic behavior.



 Comments   
Comment by Marko Mäkelä [ 2022-12-10 ]

Before we can proceed with this, I think that we must thoroughly understand the reason of the hang. I checked /qa-dev/BF_abort_3_threads/node2/core that ramesh produced. The crashing Thread 1 (due to a lock wait timeout in a brute force applier) is blocked by a lock held by Thread 11, Thread 20, or Thread 21. I found these threads by following a hash bucket chain that matched the lock:

(gdb) p *lock_sys.rec_hash.array@lock_sys.rec_hash.n_cells
$13 = {{node = 0x0} <repeats 31201 times>, {node = 0x1468c12e1180}, {
    node = 0x0} <repeats 284 times>, {node = 0x1468c12dfb80}, {
    node = 0x0} <repeats 9375 times>, {node = 0x1468c12da380}, {
    node = 0x0} <repeats 746 times>}
(gdb) p/x ((ib_lock_t*)0x1468c12da380).trx.mysql_thd.real_id
$42 = 0x14687cd47700
(gdb) p/x ((ib_lock_t*)0x1468c12da380).hash.trx.mysql_thd.real_id
$43 = 0x14687c966700
(gdb) p/x ((ib_lock_t*)0x1468c12da380).hash.hash.trx.mysql_thd.real_id
$44 = 0x14687cd47700
(gdb) p/x ((ib_lock_t*)0x1468c12da380).hash.hash.hash.trx.mysql_thd.real_id
$45 = 0x14687c966700
(gdb) p/x ((ib_lock_t*)0x1468c12da380).hash.hash.hash.hash.trx.mysql_thd.real_id
$46 = 0x1468b00a8700
(gdb) p/x ((ib_lock_t*)0x1468c12da380).hash.hash.hash.hash.hash.trx.mysql_thd.real_id
$47 = 0x14687ccfc700
(gdb) p/x ((ib_lock_t*)0x1468c12da380).hash.hash.hash.hash.hash.hash.trx.mysql_thd.real_id
$48 = 0x14687c966700
(gdb) p/x ((ib_lock_t*)0x1468c12da380).hash.hash.hash.hash.hash.hash.hash.trx.mysql_thd.real_id
$49 = 0x14687ccfc700
(gdb) p/x ((ib_lock_t*)0x1468c12da380).hash.hash.hash.hash.hash.hash.hash.hash.trx.mysql_thd.real_id
Cannot access memory at address 0x0
(gdb) thread find 0x14687cd47700

All threads Thread 11, 20, 21 are waiting for something inside Galera, deep inside wsrep_before_commit(). I think that we must find out why the transaction abort mechanism does not work as intended. For that, an rr record trace of this failure would be helpful.

Comment by Marko Mäkelä [ 2022-12-12 ]

As far as I understand, the actual problem is that the Galera conflict resolution does not work. The proposed addition of a configuration parameter might work around it, but it is unclear to me how it would work. I think that we first need to understand the actual problem. ramesh was able to reproduce the problem on cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo using rr record. I found the root cause in the trace:

ssh galapq
/home/ramesh/rr-5.5.0-Linux-x86_64/bin/rr replay /qa-dev/BF_abort_6_threads/node2_rr/latest-trace

run 935197
break lock_wait_wsrep
continue
thread apply all backtrace

This will stop the execution at the point where a high-priority transaction starts to wait for a lock. Here are some commands and their output that I used for gathering more detail:

(rr) p *lock_sys.rec_hash.array@lock_sys.rec_hash.n_cells
$63 = {{node = 0x0} <repeats 2861 times>, {node = 0xe317fe1ae00}, {
    node = 0x0} <repeats 9544 times>, {node = 0xe317fe1a180}, {
    node = 0x0} <repeats 18922 times>, {node = 0xe317fe1ad80}, {
    node = 0x0} <repeats 162 times>, {node = 0xe317fe1a380}, {
    node = 0x0} <repeats 9348 times>, {node = 0xe317fe1b800}, {
    node = 0x0} <repeats 32 times>, {node = 0xe317fe1b780}, {
    node = 0x0} <repeats 734 times>}

At the time of the lock wait, we have these record locks in the system. I checked each hash bucket chain to find all conflicting locks. Only one hash bucket chain matched this page number (0xa9 in tablespace 8), and each element in the bucket chain is for this page:

(rr) p ((ib_lock_t*)0xe317fe1b780).hash.hash.hash.hash.hash.hash.hash.hash.hash.hash.hash.un_member.tab_lock.table
$83 = (dict_table_t *) 0x8000000a9
(rr) p ((ib_lock_t*)0xe317fe1b780).hash.hash.hash.hash.hash.hash.hash.hash.hash.hash.hash.hash.un_member.tab_lock.table
Cannot access memory at address 0x38

I single-stepped through lock_wait_wsrep(), and it constructed the following collections:

victims = std::set with 4 elements = {[0] = 0xe317fe17f80, [1] = 0xe317fe1a080, [2] = 0xe317fe1ab80, [3] = 0xe317fe1b680}
victim_id = std::vector of length 4, capacity 4 = {{first = 22, second = 161}, {first = 20, second = 157}, {first = 24, second = 151}, {first = 23, second = 114}}

I compared that to the transaction pointers in the chain:

(rr) p ((ib_lock_t*)0xe317fe1b780).trx
$115 = (trx_t *) 0xe317fe1b680
(rr) p ((ib_lock_t*)0xe317fe1b780).hash.trx
$116 = (trx_t *) 0xe317fe1b680
(rr) p ((ib_lock_t*)0xe317fe1b780).hash.hash.trx
$117 = (trx_t *) 0xe317fe1b680
(rr) p ((ib_lock_t*)0xe317fe1b780).hash.hash.hash.trx
$118 = (trx_t *) 0xe317fe1b680
(rr) p ((ib_lock_t*)0xe317fe1b780).hash.hash.hash.hash.trx
$119 = (trx_t *) 0xe317fe1ab80
(rr) p ((ib_lock_t*)0xe317fe1b780).hash.hash.hash.hash.hash.trx
$120 = (trx_t *) 0xe317fe1ab80
(rr) p ((ib_lock_t*)0xe317fe1b780).hash.hash.hash.hash.hash.hash.hash.hash.hash.hash.trx
$125 = (trx_t *) 0xe317fe17f80
(rr) p ((ib_lock_t*)0xe317fe1b780).hash.hash.hash.hash.hash.hash.hash.hash.hash.hash.hash.trx
$126 = (trx_t *) 0xe317fe13280
(rr) p ((ib_lock_t*)0xe317fe1b780).hash.hash.hash.hash.hash.hash.hash.hash.hash.hash.hash.hash.trx
Cannot access memory at address 0x0

In this chain, we find exactly the 4 victim transaction pointers, plus the high-priority transaction 0xe317fe13280 that is trying to kill them. Nothing was missed.

If I continue the execution to the crash, I will see that the list starts with 0xe317fe1b680 and 0xe317fe13280. Why was 0xe317fe1b680 not killed? Let us check which thread is handling it:

(rr) p ((trx_t*)0xe317fe1b680).mysql_thd
$144 = (THD *) 0x7181440008e8

By searching the output of thread apply all backtrace for this pointer, I will find one thread. It was Thread 31 in my execution:

disable
thread 31
backtrace
finish
backtrace

We will see that this thread will remain blocked (and blocking the high-priority transaction) until the very end of the execution:

10.6 dd5f4b3625def2ee74d8f9a6b55d1368ba597a84

(rr) thread 31
[Switching to thread 31 (Thread 2180525.2494662)]
#0  0x0000000070000002 in syscall_traced ()
(rr) backtrace
#0  0x0000000070000002 in syscall_traced ()
#1  0x0000052a39f1d1a4 in _raw_syscall () at /home/roc/rr/rr/src/preload/raw_syscall.S:120
#2  0x0000052a39f182ce in traced_raw_syscall (call=<optimized out>) at /home/roc/rr/rr/src/preload/syscallbuf.c:278
#3  0x0000052a39f1c0c3 in sys_fcntl (call=<optimized out>) at /home/roc/rr/rr/src/preload/syscallbuf.c:1529
#4  syscall_hook_internal (call=0x14a81e89efa0) at /home/roc/rr/rr/src/preload/syscallbuf.c:3293
#5  syscall_hook (call=0x14a81e89efa0) at /home/roc/rr/rr/src/preload/syscallbuf.c:3454
#6  0x0000052a39f180b0 in _syscall_hook_trampoline () at /home/roc/rr/rr/src/preload/syscall_hook.S:313
#7  0x0000052a39f1810f in __morestack () at /home/roc/rr/rr/src/preload/syscall_hook.S:458
#8  0x0000052a39f1812b in _syscall_hook_trampoline_48_3d_00_f0_ff_ff () at /home/roc/rr/rr/src/preload/syscall_hook.S:477
#9  0x00003b713ab1637c in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x2b441c01e3b8) at ../sysdeps/nptl/futex-internal.h:183
#10 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x562ba6176598, cond=0x2b441c01e390) at pthread_cond_wait.c:508
#11 __pthread_cond_wait (cond=cond@entry=0x2b441c01e390, mutex=mutex@entry=0x562ba6176598) at pthread_cond_wait.c:647
#12 0x0000318758535c3b in gu_cond_wait_SYS (mutex=0x562ba6176598, cond=0x2b441c01e390) at /test/mtest/10.11_galera/galerautils/src/gu_threads.h:251
#13 gu::Lock::wait (this=<synthetic pointer>, cond=...) at /test/mtest/10.11_galera/galerautils/src/gu_lock.hpp:46
#14 galera::Monitor<galera::ReplicatorSMM::CommitOrder>::enter (this=this@entry=0x562ba6176598, obj=...) at /test/mtest/10.11_galera/galera/src/monitor.hpp:194
#15 0x00003187585254ab in galera::ReplicatorSMM::commit_order_enter_local (this=this@entry=0x562ba6175200, trx=...) at /test/mtest/10.11_galera/galera/src/replicator_smm.cpp:1256
#16 0x00003187585066c2 in galera_commit_order_enter (gh=<optimized out>, ws_handle=<optimized out>, meta=<optimized out>) at /test/mtest/10.11_galera/galera/src/wsrep_provider.cpp:758
#17 0x0000562ba492fa2a in wsrep::wsrep_provider_v26::commit_order_enter (this=<optimized out>, ws_handle=..., ws_meta=...) at /test/mtest/10.6/wsrep-lib/src/wsrep_provider_v26.cpp:276
#18 0x0000562ba492add7 in wsrep::transaction::before_commit (this=this@entry=0x718144006c18) at /test/mtest/10.6/wsrep-lib/include/wsrep/server_state.hpp:320
#19 0x0000562ba445fef3 in wsrep::client_state::before_commit (this=0x718144006bb0) at /test/mtest/10.6/wsrep-lib/include/wsrep/client_state.hpp:502
#20 wsrep_before_commit (all=true, thd=0x7181440008e8) at /test/mtest/10.6/sql/wsrep_trans_observer.h:281
#21 ha_commit_trans (thd=thd@entry=0x7181440008e8, all=all@entry=true) at /test/mtest/10.6/sql/handler.cc:1827
#22 0x0000562ba4357169 in trans_commit (thd=thd@entry=0x7181440008e8) at /test/mtest/10.6/sql/transaction.cc:266
#23 0x0000562ba424e264 in mysql_execute_command (thd=0x7181440008e8, is_called_from_prepared_stmt=<optimized out>) at /test/mtest/10.6/sql/sql_parse.cc:5621
#24 0x0000562ba423c375 in mysql_parse (rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, thd=0x7181440008e8) at /test/mtest/10.6/sql/sql_parse.cc:8018
#25 mysql_parse (thd=0x7181440008e8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/mtest/10.6/sql/sql_parse.cc:7940
#26 0x0000562ba423bc21 in wsrep_mysql_parse (thd=0x7181440008e8, rawbuf=0x7181440106f0 "COMMIT", length=6, parser_state=0x646a3c98d410) at /test/mtest/10.6/sql/sql_parse.cc:7830
#27 0x0000562ba424944d in dispatch_command (command=COM_QUERY, thd=0x7181440008e8, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/mtest/10.6/sql/sql_parse.cc:1979
#28 0x0000562ba424a09e in do_command (thd=0x7181440008e8, blocking=blocking@entry=true) at /test/mtest/10.6/sql/sql_parse.cc:1409
#29 0x0000562ba4347d27 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x562ba64169a8, put_in_cache=put_in_cache@entry=true) at /test/mtest/10.6/sql/sql_connect.cc:1415
#30 0x0000562ba434800d in handle_one_connection (arg=0x562ba64169a8) at /test/mtest/10.6/sql/sql_connect.cc:1317
#31 0x00003b713ab0f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#32 0x000073607b654133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(rr) finish
Run till exit from #0  0x0000000070000002 in syscall_traced ()
 
Thread 1 received signal SIGABRT, Aborted.
[Switching to Thread 2180525.2208333]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(rr) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000073607b557859 in __GI_abort () at abort.c:79
#2  0x0000562ba411ab20 in ut_dbg_assertion_failed (expr=expr@entry=0x562ba496e6a5 "0", file=file@entry=0x562ba4abac40 "/test/mtest/10.6/storage/innobase/lock/lock0lock.cc", line=line@entry=585)
    at /test/mtest/10.6/storage/innobase/ut/ut0dbg.cc:60
#3  0x0000562ba40fa397 in wsrep_is_BF_lock_timeout (trx=...) at /test/mtest/10.6/storage/innobase/lock/lock0lock.cc:585
#4  0x0000562ba46f3589 in lock_wait (thr=thr@entry=0x148464031b20) at /test/mtest/10.6/storage/innobase/lock/lock0lock.cc:6370
#5  0x0000562ba47494df in row_mysql_handle_errors (new_err=0x72d005dee284, trx=0xe317fe13280, thr=<optimized out>, savept=0x72d005dee288) at /test/mtest/10.6/storage/innobase/row/row0mysql.cc:681
#6  0x0000562ba474bbb1 in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x14846401c498 "\377", <incomplete sequence \304>, prebuilt=0x148464031088, ins_mode=ROW_INS_NORMAL)
    at /test/mtest/10.6/storage/innobase/row/row0mysql.cc:1319
#7  0x0000562ba46b9094 in ha_innobase::write_row (this=0x14846401c890, record=0x14846401c498 "\377", <incomplete sequence \304>) at /test/mtest/10.6/storage/innobase/handler/ha_innodb.cc:7918
#8  0x0000562ba44691a7 in handler::ha_write_row (this=0x14846401c890, buf=0x14846401c498 "\377", <incomplete sequence \304>) at /test/mtest/10.6/sql/handler.cc:7582
#9  0x0000562ba457aae3 in Rows_log_event::write_row (this=this@entry=0x3ee36407a398, rgi=rgi@entry=0x3ee36402f6f0, overwrite=false) at /test/mtest/10.6/sql/log_event_server.cc:7343
#10 0x0000562ba457b161 in Write_rows_log_event::do_exec_row (this=0x3ee36407a398, rgi=0x3ee36402f6f0) at /test/mtest/10.6/sql/log_event_server.cc:7571
#11 0x0000562ba456fc87 in Rows_log_event::do_apply_event (this=0x3ee36407a398, rgi=0x3ee36402f6f0) at /test/mtest/10.6/sql/log_event_server.cc:5733
#12 0x0000562ba468e266 in Log_event::apply_event (rgi=<optimized out>, this=0x3ee36407a398) at /test/mtest/10.6/sql/log_event.h:1499
#13 wsrep_apply_events (thd=thd@entry=0x3ee364000c58, rli=<optimized out>, events_buf=<optimized out>, buf_len=0) at /test/mtest/10.6/sql/wsrep_applier.cc:208
#14 0x0000562ba4676100 in apply_events (thd=thd@entry=0x3ee364000c58, rli=<optimized out>, data=..., err=...) at /test/mtest/10.6/wsrep-lib/include/wsrep/buffer.hpp:48
#15 0x0000562ba467641a in Wsrep_applier_service::apply_write_set (this=0x72d005defcf0, ws_meta=..., data=..., err=...) at /test/mtest/10.6/sql/wsrep_high_priority_service.cc:583
#16 0x0000562ba491f3ab in apply_write_set (server_state=..., high_priority_service=..., ws_handle=..., ws_meta=..., data=...) at /test/mtest/10.6/wsrep-lib/src/server_state.cpp:332
#17 0x0000562ba4920301 in wsrep::server_state::on_apply (this=<optimized out>, high_priority_service=..., ws_handle=..., ws_meta=..., data=...) at /test/mtest/10.6/wsrep-lib/src/server_state.cpp:1119
#18 0x0000562ba492f021 in wsrep::high_priority_service::apply (data=..., ws_meta=..., ws_handle=..., this=0x72d005defcf0) at /test/mtest/10.6/wsrep-lib/include/wsrep/high_priority_service.hpp:47
#19 (anonymous namespace)::apply_cb (ctx=ctx@entry=0x72d005defcf0, wsh=wsh@entry=0x72d005deed20, flags=<optimized out>, flags@entry=65, buf=buf@entry=0x72d005deed30, meta=meta@entry=0x72d005deefe0, 
    exit_loop=exit_loop@entry=0x72d005deef9f) at /test/mtest/10.6/wsrep-lib/src/wsrep_provider_v26.cpp:507
#20 0x00003187585137f5 in galera::TrxHandleSlave::apply (this=this@entry=0x3b71300008d0, recv_ctx=recv_ctx@entry=0x72d005defcf0, 
    apply_cb=0x562ba492eee0 <(anonymous namespace)::apply_cb(void*, wsrep_ws_handle_t const*, uint32_t, wsrep_buf_t const*, wsrep_trx_meta_t const*, wsrep_bool_t*)>, meta=..., 
    exit_loop=exit_loop@entry=@0x72d005deef9f: false) at /test/mtest/10.11_galera/galera/src/trx_handle.cpp:396
#21 0x0000318758529fae in galera::ReplicatorSMM::apply_trx (this=0x562ba6175200, recv_ctx=0x72d005defcf0, ts=...) at /test/mtest/10.11_galera/galera/src/replicator_smm.cpp:516
#22 0x000031875852e218 in galera::ReplicatorSMM::process_trx (this=0x562ba6175200, recv_ctx=0x72d005defcf0, ts_ptr=...) at /test/mtest/10.11_galera/galera/src/replicator_smm.cpp:2138
#23 0x000031875855fba9 in galera::GcsActionSource::process_writeset (this=0x562ba61a58f0, recv_ctx=0x72d005defcf0, act=..., exit_loop=@0x72d005def91f: false)
    at /test/mtest/10.11_galera/galera/src/gcs_action_source.cpp:62
#24 0x0000318758560603 in galera::GcsActionSource::dispatch (this=0x562ba61a58f0, recv_ctx=0x72d005defcf0, act=..., exit_loop=<optimized out>) at /test/mtest/10.11_galera/galera/src/gcs_action_source.cpp:110
#25 0x0000318758560bc2 in galera::GcsActionSource::process (this=0x562ba61a58f0, recv_ctx=0x72d005defcf0, exit_loop=@0x72d005def91f: false) at /test/mtest/10.11_galera/galera/src/gcs_action_source.cpp:186
#26 0x000031875852b650 in galera::ReplicatorSMM::async_recv (this=0x562ba6175200, recv_ctx=0x72d005defcf0) at /test/mtest/10.11_galera/galera/src/replicator_smm.cpp:402
#27 0x00003187584fff01 in galera_recv (gh=<optimized out>, recv_ctx=<optimized out>) at /test/mtest/10.11_galera/galera/src/wsrep_provider.cpp:264
#28 0x0000562ba492f6a2 in wsrep::wsrep_provider_v26::run_applier (this=<optimized out>, applier_ctx=<optimized out>) at /test/mtest/10.6/wsrep-lib/src/wsrep_provider_v26.cpp:858
#29 0x0000562ba468ff21 in wsrep_replication_process (thd=0x3ee364000c58, arg=<optimized out>) at /test/mtest/10.6/wsrep-lib/include/wsrep/server_state.hpp:320
#30 0x0000562ba467f802 in start_wsrep_THD (arg=0x562ba61d6e80) at /test/mtest/10.6/sql/wsrep_mysqld.h:539
#31 0x00003b713ab0f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#32 0x000073607b654133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

To fix this bug, lock_wait_wsrep_kill() needs to wake gu_cond_wait_SYS() from its sleep, to let the transaction to be rolled back. Possibly, an error needs to be propagated all the way up to wsrep_before_commit().

Comment by Seppo Jaakola [ 2022-12-13 ]

marko thanks for the detailed gdb session, much appreciated. Bottom line is indeed that one of the blocking victims, was never aborted, or aborting was not successful.

The purpose of this MDEV, however, is not to implement replication conflict resolving. Conflicts should be resolved by the high priority operator (usually replication applier), when the lock conflict is first encountered. This conflict resolving has gone broken at some point, and work started to remedy the damage a couple of months ago. Fixes have been submitted as 3 separate pull requests as part of MDEV-29684.

The actual purpose of this MDEV, otoh, is to provide replication monitoring within the mariadb server, to provide diagnostics for troubleshooting purposes and releasing blocked replication appliers, if eternal hanging is observed.

Comment by Jan Lindström (Inactive) [ 2022-12-19 ]

seppo We applied you PRs on branch bb-10.6-MDEV-30133, however we still see crash like wsrep::client_state::bf_abort(wsrep::seqno): Assertion `mode_ == m_local || transaction_.is_streaming()' failed: This is same as in MDEV-30217.

safe_mutex: Found wrong usage of mutex 'LOCK_thd_data' and 'wait_mutex'
Mutex currently locked (in reverse order):
wait_mutex                        /test/mtest/10.6/storage/innobase/handler/ha_innodb.cc  line 18624
LOCK_thd_data                     /test/mtest/10.6/sql/service_wsrep.cc  line 37
LOCK_thd_kill                     /test/mtest/10.6/sql/sql_parse.cc  line 9163
2022-12-19 14:41:52 1 [Note] WSREP: cluster conflict due to high priority abort for threads:
2022-12-19 14:41:52 1 [Note] WSREP: Winning thread: 
   THD: 1, mode: high priority, state: exec, conflict: replaying, seqno: 134
   SQL: INSERT INTO sbtest9 (id, k, c, pad) VALUES (49813, 50104, '49734964315-55907540745-16502239868-79817146007-84008058070-60258551649-21287800251-50584797471-93467621616-30515529628', '56574889421-20759424067-77552106343-42638820615-57634541757')\ cf
2022-12-19 14:41:52 1 [Note] WSREP: Victim thread: 
   THD: 7, mode: high priority, state: exec, conflict: committing, seqno: 136
   SQL: NULL
2022-12-19 14:41:52 1 [Note] WSREP: context: /test/mtest/10.6/storage/innobase/handler/ha_innodb.cc:18638
2022-12-19 14:41:52 1 [Note] WSREP: Aborter BF THD: 0x9d7c0560b8 trx_id: 605 thread: 1 seqno: 134 client_state: exec client_mode: high priority transaction_mode: replaying query: INSERT INTO sbtest9 (id, k, c, pad) VALUES (49813, 50104, '49734964315-55907540745-16502239868-79817146007-84008058070-60258551649-21287800251-50584797471-93467621616-30515529628', '56574889421-20759424067-77552106343-42638820615-57634541757')\ cf
2022-12-19 14:41:52 1 [Note] WSREP: Victim BF THD: 0x37f020000ff8 trx_id: 567 thread: 7 seqno: 136 client_state: exec client_mode: high priority transaction_mode: committing query: NULL
2022-12-19 14:41:52 1 [Note] WSREP: wsrep_thd_set_wsrep_aborter setting wsrep_aborter 1
2022-12-19 14:41:52 1 [Note] WSREP: JAN: wsrep_thd_bf_abort: bf thd: 0x9d7c0560b8 victim thd 0x37f020000ff8
2022-12-19 14:41:52 1 [Note] WSREP: JAN2: wsrep_thd_bf_abort: bf thd: 0x9d7c0560b8 victim thd 0x37f020000ff8
2022-12-19 14:41:52 1 [Note] WSREP: wsrep_bf_abort BF aborter before
    thd: 1 thd_ptr: 0x9d7c0560b8 client_mode: high priority client_state: exec trx_state: replaying
    next_trx_id: 1635 trx_id: 528 seqno: 134
    is_streaming: 0 fragments: 0
    sql_errno: 0 message: 
    command: 161 query: INSERT INTO sbtest9 (id, k, c, pad) VALUES (49813, 50104, '49734964315-5
2022-12-19 14:41:52 1 [Note] WSREP: wsrep_bf_abort victim before
    thd: 7 thd_ptr: 0x37f020000ff8 client_mode: high priority client_state: exec trx_state: committing
    next_trx_id: 1333 trx_id: 2503 seqno: 136
    is_streaming: 0 fragments: 0
    sql_errno: 0 message: 
    command: 161 query: NULL
2022-12-19 14:41:52 1 [Note] WSREP: JAN3: wsrep_thd_abort: bf thd: 0x9d7c0560b8 victim thd 0x37f020000ff8
2022-12-19 14:41:52 1 [Note] WSREP: JAN4: victim_thd->wsrep_cs().bf_abort before: bf thd: 0x9d7c0560b8 victim thd 0x37f020000ff8
mysqld: /test/mtest/10.6/wsrep-lib/include/wsrep/client_state.hpp:667: int wsrep::client_state::bf_abort(wsrep::seqno): Assertion `mode_ == m_local || transaction_.is_streaming()' failed.

Comment by Jan Lindström (Inactive) [ 2022-12-20 ]

At lock_wsrep_wait BF has following victims :

(rr) p victim_id
$2 = std::vector of length 3, capacity 4 = {{first = 7, second = 567}, {first = 26, second = 603}, {
    first = 27, second = 583}}

where first is thread_id and second trx->id. From these naturally interesting one is thread with id 7.

Comment by Seppo Jaakola [ 2022-12-21 ]

note that this PR does not fix any possible issues in cluster conflict resolving. This just implements a watchdog thread, which monitors the progress of replication applying, providing logging for situations of delayed applying and potentially resolving a locked applying state when BF aborting was not successful.

Generated at Thu Feb 08 10:14:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.