mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Let "FTWRL <table_list>" use extra(HA_EXTRA_FLUSH)
Rather than flushing caches with tdc_remove_table(TDC_RT_REMOVE_UNUSED) flush them with extra(HA_EXTRA_FLUSH) instead. This goes inline with regular FTWRL. Part of MDEV-17882 - Cleanup refresh version
This commit is contained in:
@ -2010,117 +2010,6 @@ connection deadlock_con1;
|
||||
connection default;
|
||||
# Reaping ALTER. It should succeed and not produce ER_LOCK_DEADLOCK.
|
||||
drop table t1;
|
||||
#
|
||||
# Now, test for a situation in which deadlock involves waiting not
|
||||
# only in MDL subsystem but also for TDC. Such deadlocks should be
|
||||
# successfully detected. If possible, they should be resolved without
|
||||
# resorting to ER_LOCK_DEADLOCK error.
|
||||
#
|
||||
create table t1(i int);
|
||||
create table t2(j int);
|
||||
#
|
||||
# First, let us check how we handle a simple scenario involving
|
||||
# waits in MDL and TDC.
|
||||
#
|
||||
set debug_sync= 'RESET';
|
||||
connection deadlock_con1;
|
||||
# Start a statement, which will acquire SR metadata lock on t1, open it
|
||||
# and then stop, before trying to acquire SW lock on t2 and opening it.
|
||||
set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
|
||||
# Sending:
|
||||
select * from t1 where i in (select j from t2 for update);
|
||||
connection deadlock_con2;
|
||||
# Wait till the above SELECT stops.
|
||||
set debug_sync='now WAIT_FOR parked';
|
||||
# The below FLUSH TABLES WITH READ LOCK should acquire
|
||||
# SNW locks on t1 and t2 and wait till SELECT closes t1.
|
||||
# Sending:
|
||||
flush tables t1, t2 with read lock;
|
||||
connection deadlock_con3;
|
||||
# Wait until FLUSH TABLES WITH t1, t2 READ LOCK starts waiting
|
||||
# for SELECT to close t1.
|
||||
# Resume SELECT, so it tries to acquire SW lock on t1 and blocks,
|
||||
# creating a deadlock. This deadlock should be detected and resolved
|
||||
# by backing-off SELECT. As a result FTWRL should be able to finish.
|
||||
set debug_sync='now SIGNAL go';
|
||||
connection deadlock_con2;
|
||||
# Reap FLUSH TABLES WITH READ LOCK.
|
||||
unlock tables;
|
||||
connection deadlock_con1;
|
||||
# Reap SELECT.
|
||||
i
|
||||
#
|
||||
# The same scenario with a slightly different order of events
|
||||
# which emphasizes that setting correct deadlock detector weights
|
||||
# for flush waits is important.
|
||||
#
|
||||
set debug_sync= 'RESET';
|
||||
connection deadlock_con2;
|
||||
set debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked WAIT_FOR go';
|
||||
# The below FLUSH TABLES WITH READ LOCK should acquire
|
||||
# SNW locks on t1 and t2 and wait on debug sync point.
|
||||
# Sending:
|
||||
flush tables t1, t2 with read lock;
|
||||
connection deadlock_con1;
|
||||
# Wait till FLUSH TABLE WITH READ LOCK stops.
|
||||
set debug_sync='now WAIT_FOR parked';
|
||||
# Start statement which will acquire SR metadata lock on t1, open
|
||||
# it and then will block while trying to acquire SW lock on t2.
|
||||
# Sending:
|
||||
select * from t1 where i in (select j from t2 for update);
|
||||
connection deadlock_con3;
|
||||
# Wait till the above SELECT blocks.
|
||||
# Resume FLUSH TABLES, so it tries to flush t1, thus creating
|
||||
# a deadlock. This deadlock should be detected and resolved by
|
||||
# backing-off SELECT. As a result FTWRL should be able to finish.
|
||||
set debug_sync='now SIGNAL go';
|
||||
connection deadlock_con2;
|
||||
# Reap FLUSH TABLES WITH READ LOCK.
|
||||
unlock tables;
|
||||
connection deadlock_con1;
|
||||
# Reap SELECT.
|
||||
i
|
||||
#
|
||||
# Now a more complex scenario involving two connections
|
||||
# waiting for MDL and one for TDC.
|
||||
#
|
||||
set debug_sync= 'RESET';
|
||||
connection deadlock_con1;
|
||||
# Start a statement which will acquire SR metadata lock on t2, open it
|
||||
# and then stop, before trying to acquire SR on t1 and opening it.
|
||||
set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
|
||||
# Sending:
|
||||
select * from t2, t1;
|
||||
connection deadlock_con2;
|
||||
# Wait till the above SELECT stops.
|
||||
set debug_sync='now WAIT_FOR parked';
|
||||
# The below FLUSH TABLES WITH READ LOCK should acquire
|
||||
# SNW locks on t2 and wait till SELECT closes t2.
|
||||
# Sending:
|
||||
flush tables t2 with read lock;
|
||||
connection deadlock_con3;
|
||||
# Wait until FLUSH TABLES WITH READ LOCK starts waiting
|
||||
# for SELECT to close t2.
|
||||
# The below DROP TABLES should acquire X lock on t1 and start
|
||||
# waiting for X lock on t2.
|
||||
# Sending:
|
||||
drop tables t1, t2;
|
||||
connection default;
|
||||
# Wait until DROP TABLES starts waiting for X lock on t2.
|
||||
# Resume SELECT, so it tries to acquire SR lock on t1 and blocks,
|
||||
# creating a deadlock. This deadlock should be detected and resolved
|
||||
# by backing-off SELECT. As a result, FTWRL should be able to finish.
|
||||
set debug_sync='now SIGNAL go';
|
||||
connection deadlock_con2;
|
||||
# Reap FLUSH TABLES WITH READ LOCK.
|
||||
# Unblock DROP TABLES.
|
||||
unlock tables;
|
||||
connection deadlock_con3;
|
||||
# Reap DROP TABLES.
|
||||
connection deadlock_con1;
|
||||
# Reap SELECT. It should emit error about missing table.
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
connection default;
|
||||
set debug_sync= 'RESET';
|
||||
disconnect deadlock_con1;
|
||||
disconnect deadlock_con2;
|
||||
|
Reference in New Issue
Block a user