summaryrefslogtreecommitdiff
path: root/storage/myisam/mi_dynrec.c
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2010-04-28 14:52:24 +0200
committerunknown <knielsen@knielsen-hq.org>2010-04-28 14:52:24 +0200
commitb1e00b6be81c80b09d11085d77d86978e26df988 (patch)
treebb1fdd7363fbf2580572ac9a56dbd4c933cc4c0d /storage/myisam/mi_dynrec.c
parent1f683a7270e63abfadce20c6f51370621ff065e1 (diff)
parentc9cfd2df5f2f58c2cdf716999ebea252c307333f (diff)
downloadmariadb-git-b1e00b6be81c80b09d11085d77d86978e26df988.tar.gz
Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
Diffstat (limited to 'storage/myisam/mi_dynrec.c')
-rw-r--r--storage/myisam/mi_dynrec.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c
index 374fcfd4ddf..adae7076858 100644
--- a/storage/myisam/mi_dynrec.c
+++ b/storage/myisam/mi_dynrec.c
@@ -94,6 +94,34 @@ my_bool mi_dynmap_file(MI_INFO *info, my_off_t size)
madvise((char*) info->s->file_map, size, MADV_RANDOM);
#endif
info->s->mmaped_length= size;
+ info->s->file_read= mi_mmap_pread;
+ info->s->file_write= mi_mmap_pwrite;
+ DBUG_RETURN(0);
+}
+
+
+/*
+ Destroy mmaped area for MyISAM handler
+
+ SYNOPSIS
+ mi_munmap_file()
+ info MyISAM handler
+
+ RETURN
+ 0 ok
+ !0 error.
+*/
+
+int mi_munmap_file(MI_INFO *info)
+{
+ int ret;
+ DBUG_ENTER("mi_unmap_file");
+ if ((ret= my_munmap(info->s->file_map, info->s->mmaped_length)))
+ DBUG_RETURN(ret);
+ info->s->file_read= mi_nommap_pread;
+ info->s->file_write= mi_nommap_pwrite;
+ info->s->file_map= 0;
+ info->s->mmaped_length= 0;
DBUG_RETURN(0);
}
@@ -112,8 +140,7 @@ void mi_remap_file(MI_INFO *info, my_off_t size)
{
if (info->s->file_map)
{
- VOID(my_munmap((char*) info->s->file_map,
- (size_t) info->s->mmaped_length));
+ mi_munmap_file(info);
mi_dynmap_file(info, size);
}
}
@@ -933,8 +960,16 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record,
}
if (block_info.next_filepos != HA_OFFSET_ERROR)
+ {
+ /*
+ delete_dynamic_record() may change data file position.
+ IO cache must be notified as it may still have cached
+ data, which has to be flushed later.
+ */
+ info->rec_cache.seek_not_done= 1;
if (delete_dynamic_record(info,block_info.next_filepos,1))
goto err;
+ }
DBUG_RETURN(0);
err:
DBUG_RETURN(1);