1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-35941 : galera_bf_abort_lock_table fails with wait for metadata lock

Problem was missing case from wsrep_handle_mdl_conflict. Test case
was trying to confirm that LOCK TABLE thread is not BF-aborted.
However as case was missing it was BF-aborted. Test case passed
because BF-aborting takes time and used wait condition might
see expected thread status before it was BF-aborted. Test naturally
failed if BF-aborting was done early enough.

Fix is to add missing case for SQLCOM_LOCK_TABLES to
wsrep_handle_mdl_conflict.

Note that using LOCK TABLE is still not recomended on cluster
because it could cause cluster hang.

This is a 10.5 specific commit that will then be overridden by
another one for 10.6+.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
This commit is contained in:
Jan Lindström
2025-02-10 09:19:23 +02:00
committed by Julius Goryavsky
parent 7b040e53cc
commit bb64a51037
4 changed files with 10 additions and 8 deletions

View File

@@ -13,7 +13,5 @@
galera_sequences : MDEV-35934/MDEV-33850 For Galera, create sequence with low cache got signal 6 error: [ERROR] WSREP: FSM: no such a transition REPLICATING -> COMMITTED galera_sequences : MDEV-35934/MDEV-33850 For Galera, create sequence with low cache got signal 6 error: [ERROR] WSREP: FSM: no such a transition REPLICATING -> COMMITTED
galera_wan : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan galera_wan : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan
galera_vote_rejoin_ddl : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan galera_vote_rejoin_ddl : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan
galera_bf_abort_lock_table : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock
mysql-wsrep#198 : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock
MW-329 : MDEV-35951 Complete freeze during MW-329 test MW-329 : MDEV-35951 Complete freeze during MW-329 test
galera_vote_rejoin_dml : MDEV-35964 Assertion `ist_seqno >= cc_seqno' failed in galera_vote_rejoin_dml galera_vote_rejoin_dml : MDEV-35964 Assertion `ist_seqno >= cc_seqno' failed in galera_vote_rejoin_dml

View File

@@ -1 +0,0 @@
!include ../galera_2nodes.cnf

View File

@@ -19,13 +19,13 @@ INSERT INTO t1 VALUES (2);
SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%');
--let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
--source include/wait_condition_with_debug_and_kill.inc --source include/wait_condition_with_debug.inc
UNLOCK TABLES; UNLOCK TABLES;
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%');
--let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
--source include/wait_condition_with_debug_and_kill.inc --source include/wait_condition_with_debug.inc
COMMIT; COMMIT;
SELECT COUNT(*) = 1 FROM t1; SELECT COUNT(*) = 1 FROM t1;

View File

@@ -2781,11 +2781,9 @@ void wsrep_to_isolation_end(THD *thd)
@param requestor_ctx The MDL context of the requestor @param requestor_ctx The MDL context of the requestor
@param ticket MDL ticket for the requested lock @param ticket MDL ticket for the requested lock
@param key The key of the object (data) being protected
@retval TRUE Lock request can be granted
@retval FALSE Lock request cannot be granted
*/ */
void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx,
const MDL_ticket *ticket, const MDL_ticket *ticket,
const MDL_key *key) const MDL_key *key)
@@ -2861,6 +2859,13 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx,
mysql_mutex_unlock(&granted_thd->LOCK_thd_data); mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
mysql_mutex_unlock(&granted_thd->LOCK_thd_kill); mysql_mutex_unlock(&granted_thd->LOCK_thd_kill);
} }
else if (granted_thd->lex->sql_command == SQLCOM_LOCK_TABLES)
{
WSREP_DEBUG("BF thread waiting for LOCK TABLES");
ticket->wsrep_report(wsrep_debug);
mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
mysql_mutex_unlock(&granted_thd->LOCK_thd_kill);
}
else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE) else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE)
{ {
WSREP_DEBUG("DROP caused BF abort, conf %s", WSREP_DEBUG("DROP caused BF abort, conf %s",