mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-14526: MariaDB keeps crashing under load when query_cache_type is changed
The problem was in such scenario:
T1 - starts registering query and locked QC
T2 - starts disabling QC and wait for UNLOCK
T1 - unlock QC
T2 - disable QC and destroy signals without waiting for query unlock
T1 a) - not yet unlocked query in qc and crash on attempt to unlock because
QC signals are destroyed
b) if above was done before destruction, it execute end_of results first
time at exit on after try_lock which see QC disables and return TRUE.
But it do not reset query_cache_tls->first_query_block which lead to
second call of end_of_result when diagnostic arena has already
inappropriate status (not is_eof()).
Fix is:
1) wait for all queries unlocked before destroying them by locking and
unlocking
2) remove query_cache_tls->first_query_block if QC disabled
This commit is contained in:
@@ -220,3 +220,29 @@ RESET QUERY CACHE;
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL query_cache_size= DEFAULT;
|
||||
SET GLOBAL query_cache_type= DEFAULT;
|
||||
#
|
||||
# MDEV-14526: MariaDB keeps crashing under load when
|
||||
# query_cache_type is changed
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) default '0',
|
||||
PRIMARY KEY (`id`))
|
||||
ENGINE=MyISAM;
|
||||
INSERT IGNORE INTO t1 VALUES
|
||||
(NULL,1),(NULL,8),(NULL,NULL),(NULL,NULL),(NULL,4),(NULL,9),(NULL,7),
|
||||
(NULL,3),(NULL,NULL),(NULL,2),(NULL,3),(NULL,NULL),(NULL,2),(NULL,7),
|
||||
(NULL,1),(NULL,2),(NULL,4),(NULL,NULL),(NULL,1),(NULL,1),(NULL,4);
|
||||
SET GLOBAL query_cache_size= 1024*1024;
|
||||
SET GLOBAL query_cache_type= 1;
|
||||
set debug_sync="wait_in_query_cache_store_query SIGNAL parked WAIT_FOR go";
|
||||
SELECT DISTINCT id FROM t1 WHERE id BETWEEN 5603 AND 16218 ORDER BY k;
|
||||
set debug_sync="now WAIT_FOR parked";
|
||||
SET GLOBAL query_cache_type= 0;
|
||||
set debug_sync="now SIGNAL go";
|
||||
id
|
||||
set debug_sync= 'RESET';
|
||||
DROP TABLE t1;
|
||||
SEt GLOBAL query_cache_size= DEFAULT;
|
||||
SEt GLOBAL query_cache_type= DEFAULT;
|
||||
# End of 5.5 tests
|
||||
|
||||
Reference in New Issue
Block a user