mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
myisamdef.h, mi_locking.c, mi_dynrec.c:
Fix insert performance with mmap
This commit is contained in:
parent
32da648789
commit
ab301016f2
3 changed files with 7 additions and 1 deletions
|
@ -201,6 +201,7 @@ uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
info->s->nonmmaped_inserts++;
|
||||||
if (info->s->concurrent_insert)
|
if (info->s->concurrent_insert)
|
||||||
rw_unlock(&info->s->mmap_lock);
|
rw_unlock(&info->s->mmap_lock);
|
||||||
return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags);
|
return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags);
|
||||||
|
|
|
@ -85,11 +85,13 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
||||||
if (share->changed && !share->w_locks)
|
if (share->changed && !share->w_locks)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_MMAP
|
#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)
|
if (info->s->concurrent_insert)
|
||||||
rw_wrlock(&info->s->mmap_lock);
|
rw_wrlock(&info->s->mmap_lock);
|
||||||
mi_remap_file(info, info->s->state.state.data_file_length);
|
mi_remap_file(info, info->s->state.state.data_file_length);
|
||||||
|
info->s->nonmmaped_inserts= 0;
|
||||||
if (info->s->concurrent_insert)
|
if (info->s->concurrent_insert)
|
||||||
rw_unlock(&info->s->mmap_lock);
|
rw_unlock(&info->s->mmap_lock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,7 @@ typedef struct st_mi_isam_pack {
|
||||||
uchar version;
|
uchar version;
|
||||||
} MI_PACK;
|
} MI_PACK;
|
||||||
|
|
||||||
|
#define MAX_NONMAPPED_INSERTS 1000
|
||||||
|
|
||||||
typedef struct st_mi_isam_share { /* Shared between opens */
|
typedef struct st_mi_isam_share { /* Shared between opens */
|
||||||
MI_STATE_INFO state;
|
MI_STATE_INFO state;
|
||||||
|
@ -211,6 +212,8 @@ typedef struct st_mi_isam_share { /* Shared between opens */
|
||||||
rw_lock_t *key_root_lock;
|
rw_lock_t *key_root_lock;
|
||||||
#endif
|
#endif
|
||||||
my_off_t mmaped_length;
|
my_off_t mmaped_length;
|
||||||
|
uint nonmmaped_inserts; /* counter of writing in non-mmaped
|
||||||
|
area */
|
||||||
rw_lock_t mmap_lock;
|
rw_lock_t mmap_lock;
|
||||||
} MYISAM_SHARE;
|
} MYISAM_SHARE;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue