Commit 756416f6 authored by Nirbhay Choubey's avatar Nirbhay Choubey

Merge of patch for bug#11756764 from mysql-5.1.

parents a2248579 c67a91f1
...@@ -84,7 +84,12 @@ int mi_close(register MI_INFO *info) ...@@ -84,7 +84,12 @@ int mi_close(register MI_INFO *info)
} }
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
if (share->file_map) if (share->file_map)
_mi_unmap_file(info); {
if (share->options & HA_OPTION_COMPRESS_RECORD)
_mi_unmap_file(info);
else
mi_munmap_file(info);
}
#endif #endif
if (share->decode_trees) if (share->decode_trees)
{ {
......
...@@ -1549,13 +1549,14 @@ my_bool _mi_memmap_file(MI_INFO *info) ...@@ -1549,13 +1549,14 @@ my_bool _mi_memmap_file(MI_INFO *info)
void _mi_unmap_file(MI_INFO *info) void _mi_unmap_file(MI_INFO *info)
{ {
(void) my_munmap((char*) info->s->file_map, DBUG_ASSERT(info->s->options & HA_OPTION_COMPRESS_RECORD);
(size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN);
(void) my_munmap((char*) info->s->file_map, (size_t) info->s->mmaped_length);
if (myisam_mmap_size != SIZE_T_MAX) if (myisam_mmap_size != SIZE_T_MAX)
{ {
mysql_mutex_lock(&THR_LOCK_myisam_mmap); mysql_mutex_lock(&THR_LOCK_myisam_mmap);
myisam_mmap_used-= info->s->mmaped_length + MEMMAP_EXTRA_MARGIN; myisam_mmap_used-= info->s->mmaped_length;
mysql_mutex_unlock(&THR_LOCK_myisam_mmap); mysql_mutex_unlock(&THR_LOCK_myisam_mmap);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment