summaryrefslogtreecommitdiff
path: root/mysql-test/t/assign_key_cache-5405.test
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-01-27 12:11:04 +0100
committerSergei Golubchik <sergii@pisem.net>2014-01-27 12:11:04 +0100
commitb4dd13b519e1346d81641ccd3331181ab13e1d41 (patch)
tree8cd730117c0c450e19e788f7e89c4f585086d66b /mysql-test/t/assign_key_cache-5405.test
parentebaac51c2f047892cdfc0e30415a4880df9de2e8 (diff)
downloadmariadb-git-b4dd13b519e1346d81641ccd3331181ab13e1d41.tar.gz
MDEV-5405 RQG induced crash in mi_assign_to_key_cache in safe mutex unlock
if two threads were calling mi_assign_to_key_cache() for the same table, one could change share->key_cache while the other was having share->key_cache->op_lock locked. The other thread would crash then, trying to unlock share->key_cache->op_lock (because it would be a different mutex). fixed by caching the value of share->key_cache in a local variable. The thread can still call flush_key_blocks() for an unassigned keycache, but it's harmless.
Diffstat (limited to 'mysql-test/t/assign_key_cache-5405.test')
-rw-r--r--mysql-test/t/assign_key_cache-5405.test27
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/t/assign_key_cache-5405.test b/mysql-test/t/assign_key_cache-5405.test
new file mode 100644
index 00000000000..2839e040bd3
--- /dev/null
+++ b/mysql-test/t/assign_key_cache-5405.test
@@ -0,0 +1,27 @@
+#
+# MDEV-5405 RQG induced crash in mi_assign_to_key_cache in safe mutex unlock
+#
+--source include/have_debug_sync.inc
+create table t1 (f int, key(f)) engine=myisam;
+set global kc1.key_buffer_size = 65536;
+
+connect (con1, localhost, root);
+
+set debug_sync='assign_key_cache_op_unlock wait_for op_locked';
+send cache index t1 in kc1;
+
+connection default;
+sleep 1;
+set debug_sync='assign_key_cache_op_lock signal op_locked wait_for assigned';
+send cache index t1 in kc1;
+
+connection con1;
+reap;
+set debug_sync='now signal assigned';
+disconnect con1;
+connection default;
+reap;
+
+drop table t1;
+set global kc1.key_buffer_size = 0;
+set debug_sync='reset';