summaryrefslogtreecommitdiff
path: root/mysql-test/r/partition.result
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2010-03-22 16:30:27 +0400
committerSergey Vojtovich <svoj@sun.com>2010-03-22 16:30:27 +0400
commitb602127bf0225b7a33b44c1d7c7e1f06f8f4dee7 (patch)
treea581ffa29f2b17a0136b112db49189fa46d88d4b /mysql-test/r/partition.result
parentc92b9b7315c01e87b1099e7df182213a1d8ffa6f (diff)
downloadmariadb-git-b602127bf0225b7a33b44c1d7c7e1f06f8f4dee7.tar.gz
BUG#51868 - crash with myisam_use_mmap and partitioned
myisam tables Queries following TRUNCATE of partitioned MyISAM table may crash server if myisam_use_mmap is true. Internally this is MyISAM bug, but limited to partitioned tables, because MyISAM doesn't use ::delete_all_rows() method for TRUNCATE, but goes via table recreate instead. MyISAM didn't properly fall back to non-mmaped I/O after mmap() failure. Was not repeatable on linux before, likely because (quote from man mmap): SUSv3 specifies that mmap() should fail if length is 0. However, in kernels before 2.6.12, mmap() succeeded in this case: no mapping was created and the call returned addr. Since kernel 2.6.12, mmap() fails with the error EINVAL for this case. mysql-test/r/partition.result: A test case for BUG#51868. mysql-test/t/partition.test: A test case for BUG#51868. storage/myisam/mi_delete_all.c: _mi_unmap_file() is compressed record format specific, which is read-only. As compressed MyISAM data files are read-only, we must never use _mi_unmap_file() in mi_delete_all_rows(). storage/myisam/mi_dynrec.c: Make myisam mmap code more durable to errors: - set file_read/file_write handlers if mmap succeeded; - reset file_read/file_write handlers on unmap. storage/myisam/mi_extra.c: Moved file_read/file_write handlers initialization to mi_dynmap_file(). storage/myisam/myisamdef.h: Added mi_munmap_file() declaration.
Diffstat (limited to 'mysql-test/r/partition.result')
-rw-r--r--mysql-test/r/partition.result11
1 files changed, 11 insertions, 0 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 08357795046..23a485dc5ed 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -2088,4 +2088,15 @@ SELECT 1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE;
1
1
DROP TABLE t1;
+#
+# BUG#51868 - crash with myisam_use_mmap and partitioned myisam tables
+#
+SET GLOBAL myisam_use_mmap=1;
+CREATE TABLE t1(a INT) PARTITION BY HASH(a) PARTITIONS 1;
+INSERT INTO t1 VALUES(0);
+FLUSH TABLE t1;
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES(0);
+DROP TABLE t1;
+SET GLOBAL myisam_use_mmap=default;
End of 5.1 tests