mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user