diff options
author | Alexander Nozdrin <alik@sun.com> | 2010-06-25 19:32:59 +0400 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2010-06-25 19:32:59 +0400 |
commit | 514b9b25d256b71b90f4693549c7e596ad72177a (patch) | |
tree | 546fd92283955f11ad27a77c1740a6fd7c17b89b /storage/myisam | |
parent | 80af13189f69e17bf93ee6dfbc188f600f79aa34 (diff) | |
download | mariadb-git-514b9b25d256b71b90f4693549c7e596ad72177a.tar.gz |
Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
The server crashed on an attempt to optimize a MERGE table with
non-existent child table.
mysql_admin_table() relied on the table to be successfully open
if a table object had been allocated.
Changed code to check return value of the open function before
calling a handler:: function on it.
Diffstat (limited to 'storage/myisam')
-rw-r--r-- | storage/myisam/mi_check.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 0bcc022a0dc..25267bfb9ea 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1736,6 +1736,21 @@ err: { mysql_file_close(new_file, MYF(0)); info->dfile=new_file= -1; + /* + On Windows, the old data file cannot be deleted if it is either + open, or memory mapped. Closing the file won't remove the memory + map implicilty on Windows. We closed the data file, but we keep + the MyISAM table open. A memory map will be closed on the final + mi_close() only. So we need to unmap explicitly here. After + renaming the new file under the hook, we couldn't use the map of + the old file any more anyway. + */ + if (info->s->file_map) + { + (void) my_munmap((char*) info->s->file_map, + (size_t) info->s->mmaped_length); + info->s->file_map= NULL; + } if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, DATA_TMP_EXT, share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? |