Bug#4692 - DISABLE/ENABLE KEYS waste a space
Disabling and enabling indexes on a non-empty table grows the index file. Disabling indexes just sets a flag per non-unique index and does not free the index blocks of the affected indexes. Re-enabling indexes creates new indexes with new blocks. The old blocks remain unused in the index file. Fixed by dropping and re-creating all indexes if non-empty disabled indexes exist when enabling indexes. Dropping all indexes resets the internal end-of-file marker to the end of the index file header. It also clears the root block pointers of every index and clears the deleted blocks chains. This way all blocks are declared as free. myisam/mi_check.c: Bug#4692 - DISABLE/ENABLE KEYS waste a space Added function mi_drop_all_indexes() to support drop of all indexes in case we want to re-enable non-empty disabled indexes. Changed mi_repair(), mi_repair_by_sort(), and mi_repair_parallel() to use the new function instead of duplicate drop index code. mysql-test/r/myisam.result: Bug#4692 - DISABLE/ENABLE KEYS waste a space Added test result. mysql-test/t/myisam.test: Bug#4692 - DISABLE/ENABLE KEYS waste a space Added test.
Showing
Please register or sign in to comment