diff options
author | unknown <vtkachenko@quadxeon.mysql.com> | 2006-02-22 08:32:58 +0100 |
---|---|---|
committer | unknown <vtkachenko@quadxeon.mysql.com> | 2006-02-22 08:32:58 +0100 |
commit | 1692707cdc6e39a9ec2541ed7454d179c5ac71f2 (patch) | |
tree | b02a75a8cb332579bfb72d62a1b0e1b932e37d29 /storage/myisam | |
parent | 4ab6a29476862036e09596ffc4433214edd67d5b (diff) | |
download | mariadb-git-1692707cdc6e39a9ec2541ed7454d179c5ac71f2.tar.gz |
myisamdef.h, mi_locking.c, mi_dynrec.c:
Fix insert performance with mmap
storage/myisam/mi_dynrec.c:
Fix insert performance with mmap
storage/myisam/mi_locking.c:
Fix insert performance with mmap
storage/myisam/myisamdef.h:
Fix insert performance with mmap
Diffstat (limited to 'storage/myisam')
-rw-r--r-- | storage/myisam/mi_dynrec.c | 1 | ||||
-rw-r--r-- | storage/myisam/mi_locking.c | 4 | ||||
-rw-r--r-- | storage/myisam/myisamdef.h | 3 |
3 files changed, 7 insertions, 1 deletions
diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index cdcd7b95ce1..36d88bd362a 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -201,6 +201,7 @@ uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer, } else { + info->s->nonmmaped_inserts++; if (info->s->concurrent_insert) rw_unlock(&info->s->mmap_lock); return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags); diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c index 7c418cb9531..ecb737867f5 100644 --- a/storage/myisam/mi_locking.c +++ b/storage/myisam/mi_locking.c @@ -85,11 +85,13 @@ int mi_lock_database(MI_INFO *info, int lock_type) if (share->changed && !share->w_locks) { #ifdef HAVE_MMAP - if (info->s->mmaped_length != info->s->state.state.data_file_length) + if ((info->s->mmaped_length != info->s->state.state.data_file_length) && + (info->s->nonmmaped_inserts > MAX_NONMAPPED_INSERTS)) { if (info->s->concurrent_insert) rw_wrlock(&info->s->mmap_lock); mi_remap_file(info, info->s->state.state.data_file_length); + info->s->nonmmaped_inserts= 0; if (info->s->concurrent_insert) rw_unlock(&info->s->mmap_lock); } diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index 4e5c6be68fd..caf6254c321 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -152,6 +152,7 @@ typedef struct st_mi_isam_pack { uchar version; } MI_PACK; +#define MAX_NONMAPPED_INSERTS 1000 typedef struct st_mi_isam_share { /* Shared between opens */ MI_STATE_INFO state; @@ -211,6 +212,8 @@ typedef struct st_mi_isam_share { /* Shared between opens */ rw_lock_t *key_root_lock; #endif my_off_t mmaped_length; + uint nonmmaped_inserts; /* counter of writing in non-mmaped + area */ rw_lock_t mmap_lock; } MYISAM_SHARE; |