summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-09-17 16:06:16 +0300
committerMonty <monty@mariadb.org>2020-09-25 13:07:04 +0300
commit8819b5eea5640dc99a96c76a428f739236600ad8 (patch)
tree96f017bd013d82f3bc48ace8d799ef48281dd0c9 /mysql-test/main
parent0b73ef0688b320c2ff7fe678b28041f3e7505e97 (diff)
downloadmariadb-git-8819b5eea5640dc99a96c76a428f739236600ad8.tar.gz
MDEV-23318 Assertion `cache_empty(keycache)' failed in prepare_resize_simple_key_cache
The reason was that during MyISAM parallel repair two threads used the same changed TABLE object to compute virtual columns Fixed by adding a mutex in compute_vcols()
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/myisam_repair.result51
-rw-r--r--mysql-test/main/myisam_repair.test57
2 files changed, 108 insertions, 0 deletions
diff --git a/mysql-test/main/myisam_repair.result b/mysql-test/main/myisam_repair.result
new file mode 100644
index 00000000000..50a9695c8c7
--- /dev/null
+++ b/mysql-test/main/myisam_repair.result
@@ -0,0 +1,51 @@
+#
+# MDEV-23318 Assertion `cache_empty(keycache)' failed in
+# prepare_resize_simple_key_cache
+#
+SET @buffer_size.save= @@key_buffer_size;
+SET GLOBAL key_buffer_size= 134217728;
+SET myisam_repair_threads= 6;
+CREATE TABLE t1 (
+pk INT AUTO_INCREMENT,
+a INTEGER,
+b DATE,
+c VARCHAR(1),
+d BLOB,
+PRIMARY KEY (pk),
+KEY (a),
+KEY (b),
+KEY (c, a),
+UNIQUE (d)
+) ENGINE=MyISAM;
+INSERT INTO t1 (a,b,c) SELECT seq, '2020-12-12', 'x' FROM seq_1_to_20;
+ALTER TABLE t1 DISABLE KEYS;
+SET GLOBAL c.key_buffer_size= 13700864;
+Warnings:
+Warning 1292 Truncated incorrect key_buffer_size value: '13700864'
+INSERT INTO t1 SELECT 1;
+ERROR 21S01: Column count doesn't match value count at row 1
+SET GLOBAL c.key_buffer_size= 0;
+DROP TABLE t1;
+SET GLOBAL key_buffer_size= 134217728;
+CREATE TABLE t1 (
+pk INT AUTO_INCREMENT,
+a INTEGER,
+b DATE,
+c VARCHAR(1),
+d VARBINARY(40982),
+PRIMARY KEY (pk),
+KEY (a),
+KEY (b),
+KEY (c, a),
+UNIQUE (d)
+) ENGINE=MyISAM;
+INSERT INTO t1 (a,b,c) SELECT seq, '2020-12-12', 'x' FROM seq_1_to_20;
+ALTER TABLE t1 DISABLE KEYS;
+SET GLOBAL c.key_buffer_size= 13700864;
+Warnings:
+Warning 1292 Truncated incorrect key_buffer_size value: '13700864'
+INSERT INTO t1 SELECT 1;
+ERROR 21S01: Column count doesn't match value count at row 1
+SET GLOBAL c.key_buffer_size= 0;
+DROP TABLE t1;
+SET GLOBAL key_buffer_size= @buffer_size.save;
diff --git a/mysql-test/main/myisam_repair.test b/mysql-test/main/myisam_repair.test
new file mode 100644
index 00000000000..bcb69d59e2c
--- /dev/null
+++ b/mysql-test/main/myisam_repair.test
@@ -0,0 +1,57 @@
+--source include/have_sequence.inc
+
+
+--echo #
+--echo # MDEV-23318 Assertion `cache_empty(keycache)' failed in
+--echo # prepare_resize_simple_key_cache
+--echo #
+
+SET @buffer_size.save= @@key_buffer_size;
+SET GLOBAL key_buffer_size= 134217728;
+SET myisam_repair_threads= 6;
+
+CREATE TABLE t1 (
+ pk INT AUTO_INCREMENT,
+ a INTEGER,
+ b DATE,
+ c VARCHAR(1),
+ d BLOB,
+ PRIMARY KEY (pk),
+ KEY (a),
+ KEY (b),
+ KEY (c, a),
+ UNIQUE (d)
+) ENGINE=MyISAM;
+
+INSERT INTO t1 (a,b,c) SELECT seq, '2020-12-12', 'x' FROM seq_1_to_20;
+
+ALTER TABLE t1 DISABLE KEYS;
+SET GLOBAL c.key_buffer_size= 13700864;
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1 SELECT 1;
+SET GLOBAL c.key_buffer_size= 0;
+DROP TABLE t1;
+
+SET GLOBAL key_buffer_size= 134217728;
+
+CREATE TABLE t1 (
+ pk INT AUTO_INCREMENT,
+ a INTEGER,
+ b DATE,
+ c VARCHAR(1),
+ d VARBINARY(40982),
+ PRIMARY KEY (pk),
+ KEY (a),
+ KEY (b),
+ KEY (c, a),
+ UNIQUE (d)
+) ENGINE=MyISAM;
+INSERT INTO t1 (a,b,c) SELECT seq, '2020-12-12', 'x' FROM seq_1_to_20;
+ALTER TABLE t1 DISABLE KEYS;
+SET GLOBAL c.key_buffer_size= 13700864;
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1 SELECT 1;
+SET GLOBAL c.key_buffer_size= 0;
+
+DROP TABLE t1;
+SET GLOBAL key_buffer_size= @buffer_size.save;