summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorunknown <istruewing@chilla.local>2007-03-13 16:43:45 +0100
committerunknown <istruewing@chilla.local>2007-03-13 16:43:45 +0100
commitcc9f55767f22848396591ff7eaa4453799be9347 (patch)
tree95db08264571ae7332545e0979926ac7f11bf740 /storage/myisam
parent98736877832f57246607f5210d012b7a41856164 (diff)
downloadmariadb-git-cc9f55767f22848396591ff7eaa4453799be9347.tar.gz
Bug#25460 - High concurrency MyISAM access causes severe mysqld crash.
The previous two patches for this bug worked together so that no permanent table was memory mapped. The first patch tried to avoid mapping while a table is in use. It allowed mapping only if there was exactly one lock on the table, assuming that the calling thread owned it. During mi_open(), a different call to memory mapping was coded, which did not have this limitation. The second patch tried to remove the code duplication and just called mi_extra() from mi_open() an thus inherited the limitation. But on open, a thread does not have a lock on the table... A possible solution would be to check for zero or one lock. But since I learned that it is safe to memory map a file while normal file I/O is done on it, I removed the restriction altogether and allow to memory map while a table is in use. No test case. I do not see a chance to verify with the test suite which kind of I/O is used on a table. storage/myisam/mi_extra.c: Bug#25460 - High concurrency MyISAM access causes severe mysqld crash. Allow to memory map while table is in use.
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/mi_extra.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index ae584b06173..729174b6f88 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -350,11 +350,13 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
#ifdef HAVE_MMAP
pthread_mutex_lock(&share->intern_lock);
/*
- Memory map the data file if it is not already mapped and if there
- are no other threads using this table. intern_lock prevents other
- threads from starting to use the table while we are mapping it.
+ Memory map the data file if it is not already mapped. It is safe
+ to memory map a file while other threads are using file I/O on it.
+ Assigning a new address to a function pointer is an atomic
+ operation. intern_lock prevents that two or more mappings are done
+ at the same time.
*/
- if (!share->file_map && (share->tot_locks == 1))
+ if (!share->file_map)
{
if (mi_dynmap_file(info, share->state.state.data_file_length))
{