diff options
Diffstat (limited to 'storage/myisam/ha_myisam.cc')
-rw-r--r-- | storage/myisam/ha_myisam.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 8fde949189b..86d80b14ce5 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2011, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1074,6 +1074,18 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) mi_get_mask_all_keys_active(share->base.keys) : share->state.key_map); ulonglong testflag= param.testflag; +#ifdef HAVE_MMAP + bool remap= test(share->file_map); + /* + 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. + */ + if (remap) + mi_munmap_file(file); +#endif if (mi_test_if_sort_rep(file,file->state->records,key_map,0) && (local_testflag & T_REP_BY_SORT)) { @@ -1106,6 +1118,10 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) test(param.testflag & T_QUICK)); } param.testflag= testflag | (param.testflag & T_RETRY_WITHOUT_QUICK); +#ifdef HAVE_MMAP + if (remap) + mi_dynmap_file(file, file->state->data_file_length); +#endif optimize_done=1; } if (!error) |