mariadb/mysql-test/suite/galera_3nodes/r
Jan Lindström ee974ca5e0 MDEV-31658 : Deadlock found when trying to get lock during applying
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: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-06-19 14:09:11 +02:00
..
GAL-501.result Merge 10.3 into 10.4 2020-09-21 12:29:00 +03:00
galera-features#119.result Fix MTR suppressions in inconsistency voting tests (#1412) 2019-11-22 08:44:05 +02:00
galera_2_cluster.result MDEV-26223 Galera cluster node consider old server_id value even after modification of server_id [wsrep_gtid_mode=ON] 2022-01-27 08:22:46 +02:00
galera_certification_ccc.result Galera4 2019-01-23 15:30:00 +04:00
galera_certification_double_failure.result Galera4 2019-01-23 15:30:00 +04:00
galera_duplicate_primary_value.result MDEV-31658 : Deadlock found when trying to get lock during applying 2024-06-19 14:09:11 +02:00
galera_dynamic_protocol.result MDEV-22131 allow transition from unencrypted to TLS cluster communication without cluster downtime 2021-04-29 08:09:20 +03:00
galera_evs_suspect_timeout.result MDEV-17048 Inconsistency voting support (#1373) 2019-08-28 09:19:24 +03:00
galera_garbd.result Merge branch '10.3' into 10.4 2019-02-21 14:40:52 +01:00
galera_garbd_backup.result MDEV-28377: galera_as_slave_nonprim bind: Address already in use 2022-04-26 20:44:20 +02:00
galera_gtid_2_cluster.result MDEV-32633: Fix Galera cluster <-> native replication interaction 2024-06-03 09:48:13 +02:00
galera_gtid_consistency.result MDEV-31905 GTID inconsistency 2023-12-22 00:10:23 +01:00
galera_ipv6_mariabackup.result Merge 10.3 into 10.4 2020-09-21 12:29:00 +03:00
galera_ipv6_mariabackup_section.result Merge 10.3 into 10.4 2020-09-21 12:29:00 +03:00
galera_ipv6_mysqldump.result MDEV-22189: Change error messages inside code to have mariadb instead of 2021-05-24 11:38:13 +05:30
galera_ipv6_rsync.result Merge 10.3 into 10.4 2020-09-21 12:29:00 +03:00
galera_ipv6_rsync_section.result Merge 10.3 into 10.4 2020-09-21 12:29:00 +03:00
galera_ist_gcache_rollover.result MDEV-33036 : Galera test case galera_3nodes.galera_ist_gcache_rollover has warning 2024-01-30 00:26:13 +01:00
galera_join_with_cc_A.result Merge 10.4 into 10.5 2022-11-30 13:10:52 +02:00
galera_join_with_cc_B.result MDEV-33036 : Galera test case galera_3nodes.galera_ist_gcache_rollover has warning 2024-01-30 00:26:13 +01:00
galera_join_with_cc_C.result Merge commit '10.4' into 10.5 2023-07-20 11:54:52 +02:00
galera_parallel_apply_3nodes.result Make test galera_parallel_apply_3nodes deterministic 2020-11-19 12:42:54 +02:00
galera_pc_bootstrap.result Merge commit '10.4' into 10.5 2023-07-20 11:54:52 +02:00
galera_pc_weight.result Merge 10.4 into 10.5 2020-03-21 11:37:10 +02:00
galera_safe_to_bootstrap.result MDEV-30172: Galera test case cleanup 2022-12-07 07:33:51 +02:00
galera_ssl_reload.result MDEV-25591 : Test case cleanups 2021-05-05 09:32:06 +03:00
galera_toi_vote.result MDEV-17048 Inconsistency voting support (#1373) 2019-08-28 09:19:24 +03:00
galera_var_dirty_reads2.result Merge 10.3 into 10.4 2022-09-13 16:36:38 +03:00
galera_var_node_address.result MDEV-20485 : Galera test failure on galera.galera_var_node_address 2023-12-21 18:45:57 +01:00
galera_vote_rejoin_mysqldump.result Merge 10.5 into 10.6 2023-12-21 12:58:11 +02:00
galera_wsrep_schema.result A cleanup for MDEV-29446 Change SHOW CREATE TABLE to display default collation 2022-09-14 08:00:56 +04:00
galera_wsrep_schema_init.result MDEV-30172: Galera test case cleanup 2022-12-07 07:33:51 +02:00
GCF-354.result Merge commit '10.4' into 10.5 2023-07-20 11:54:52 +02:00
GCF-363.result Merge commit '10.4' into 10.5 2023-07-20 11:54:52 +02:00
GCF-376.result Merge commit '10.4' into 10.5 2023-07-20 11:54:52 +02:00
inconsistency_shutdown.result Fix suppression in MTR test galera_3nodes.inconsistency_shutdown 2020-11-17 13:00:44 +02:00
MDEV-29171.result MDEV-33896 : Galera test failure on galera_3nodes.MDEV-29171 2024-04-25 16:32:06 +02:00