summaryrefslogtreecommitdiff
path: root/mysql-test/suite/maria
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-02-01 18:46:34 +0200
committerMonty <monty@mariadb.org>2021-02-03 02:22:47 +0200
commiteacefbca3596fa9cb853272265855d4efafd5f24 (patch)
treeb1c3bce08841852163468bc4fff595ad2aba4907 /mysql-test/suite/maria
parentb76e5c66107d75d0161d8f8ab3cf05fc360c831e (diff)
downloadmariadb-git-eacefbca3596fa9cb853272265855d4efafd5f24.tar.gz
MDEV-24750 Various corruptions caused by Aria subsystem...
The test case was setting aria_sort_buffer_size to MAX_ULONGLONG-1 which was not handled gracefully by my_malloc() or safemalloc(). Fixed by ensuring that the malloc functions returns 0 if the size is too big. I also added some protection to Aria repair: - Limit sort_buffer_size to 16G (after that a bigger sort buffer will not help that much anyway) - Limit sort_buffer_size also according to sort file size. This will help by not allocating less memory if someone sets the buffer size too high.
Diffstat (limited to 'mysql-test/suite/maria')
-rw-r--r--mysql-test/suite/maria/aria_sort_buffer.result11
-rw-r--r--mysql-test/suite/maria/aria_sort_buffer.test15
2 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/suite/maria/aria_sort_buffer.result b/mysql-test/suite/maria/aria_sort_buffer.result
new file mode 100644
index 00000000000..5db9b9d7d44
--- /dev/null
+++ b/mysql-test/suite/maria/aria_sort_buffer.result
@@ -0,0 +1,11 @@
+SET SESSION aria_repair_threads=128;
+SET SESSION aria_sort_buffer_size=CAST(-1 AS UNSIGNED INT);
+Warnings:
+Note 1105 Cast to unsigned converted negative integer to it's positive complement
+Note 1105 Cast to unsigned converted negative integer to it's positive complement
+Warning 1292 Truncated incorrect aria_sort_buffer_size value: '18446744073709551615'
+SET SESSION tmp_table_size=65535;
+CREATE TABLE t1 (a VARCHAR(255));
+insert into t1 (a) select seq from seq_1_to_1000;
+UPDATE t1 SET a=( (SELECT MAX(a) FROM t1));
+DROP TABLE t1;
diff --git a/mysql-test/suite/maria/aria_sort_buffer.test b/mysql-test/suite/maria/aria_sort_buffer.test
new file mode 100644
index 00000000000..190daa0fa10
--- /dev/null
+++ b/mysql-test/suite/maria/aria_sort_buffer.test
@@ -0,0 +1,15 @@
+--source include/have_sequence.inc
+
+#
+#
+# MDEV-24750 Various corruptions caused by Aria subsystem asking system call
+# to overwrite memory that it does not own (InnoDB stacks)
+
+SET SESSION aria_repair_threads=128;
+SET SESSION aria_sort_buffer_size=CAST(-1 AS UNSIGNED INT);
+
+SET SESSION tmp_table_size=65535;
+CREATE TABLE t1 (a VARCHAR(255));
+insert into t1 (a) select seq from seq_1_to_1000;
+UPDATE t1 SET a=( (SELECT MAX(a) FROM t1));
+DROP TABLE t1;