diff options
author | Sergey Vojtovich <sergey.vojtovich@oracle.com> | 2011-10-20 15:03:22 +0400 |
---|---|---|
committer | Sergey Vojtovich <sergey.vojtovich@oracle.com> | 2011-10-20 15:03:22 +0400 |
commit | de8c70e70b3fd335e1d34a5635fc4357adb43d95 (patch) | |
tree | 4e8a0018a765d64da5e5172478b8d28e2435b69f /mysql-test | |
parent | fd955448c86018539e1e46a7390273dff11f0291 (diff) | |
download | mariadb-git-de8c70e70b3fd335e1d34a5635fc4357adb43d95.tar.gz |
BUG#11757032 - 49030: OPTIMIZE TABLE BREAKS MYISAM TABLE WHEN
USING MYISAM_USE_MMAP ON WINDOWS
When OPTIMIZE/REPAIR TABLE is switching to new data file,
old data file is removed while memory mapping is still
active.
With 5.1 implementation of nt_share_delete() it is not
permitted to remove mmaped file.
This fix disables memory mapping for mi_repair() operations.
mysql-test/r/myisam.result:
A test case for BUG#11757032.
mysql-test/t/myisam.test:
A test case for BUG#11757032.
storage/myisam/ha_myisam.cc:
mi_repair*() functions family use file I/O even if memory
mapping is available.
Since mixing mmap I/O and file I/O may cause various artifacts,
memory mapping must be disabled.
storage/myisam/mi_delete_all.c:
Clean-up: do not attempt to remap file after truncate, since
there is nothing to map.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/myisam.result | 24 | ||||
-rw-r--r-- | mysql-test/t/myisam.test | 18 |
2 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 433fc7c16a7..620c1f8b4b6 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -2412,4 +2412,28 @@ CARDINALITY DROP TABLE t1; SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; SET myisam_repair_threads=@@global.myisam_repair_threads; +# +# BUG#11757032 - 49030: OPTIMIZE TABLE BREAKS MYISAM TABLE WHEN +# USING MYISAM_USE_MMAP ON WINDOWS +# +SET GLOBAL myisam_use_mmap=1; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1),(2); +DELETE FROM t1 WHERE a=1; +FLUSH TABLE t1; +LOCK TABLE t1 WRITE; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +INSERT INTO t1 VALUES(3); +UNLOCK TABLES; +SELECT * FROM t1; +a +2 +3 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET GLOBAL myisam_use_mmap=default; End of 5.1 tests diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 4abd7dd2b1b..5340ddcaa48 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1645,4 +1645,22 @@ DROP TABLE t1; SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; SET myisam_repair_threads=@@global.myisam_repair_threads; +--echo # +--echo # BUG#11757032 - 49030: OPTIMIZE TABLE BREAKS MYISAM TABLE WHEN +--echo # USING MYISAM_USE_MMAP ON WINDOWS +--echo # +SET GLOBAL myisam_use_mmap=1; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1),(2); +DELETE FROM t1 WHERE a=1; +FLUSH TABLE t1; +LOCK TABLE t1 WRITE; +OPTIMIZE TABLE t1; +INSERT INTO t1 VALUES(3); +UNLOCK TABLES; +SELECT * FROM t1; +CHECK TABLE t1; +DROP TABLE t1; +SET GLOBAL myisam_use_mmap=default; + --echo End of 5.1 tests |