summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorAnurag Shekhar <anurag.shekhar@sun.com>2009-08-24 13:15:51 +0530
committerAnurag Shekhar <anurag.shekhar@sun.com>2009-08-24 13:15:51 +0530
commit90032c100751d4a864f371dd451fda7d8b12022d (patch)
tree781e201a4563b0e00910428ce33083b8e7425dcf /mysys
parent4207e50e23cd5b964e4223b61048cd2b5729358f (diff)
downloadmariadb-git-90032c100751d4a864f371dd451fda7d8b12022d.tar.gz
Bug #44723 Larger read_buffer_size values can cause performance
decrease for INSERTs Bulk inserts (multiple row, CREATE ... SELECT, INSERT ... SELECT) into MyISAM tables were performed inefficiently. This was mainly affecting use cases where read_buffer_size was considerably large (>256K) and low number of rows was inserted (e.g. 30-100). The problem was that during I/O cache initialization (this happens before each bulk insert) allocated I/O buffer was unnecessarily initialized to '\0'. This was happening because of mess in flag values. MyISAM informs I/O cache to wait for free space (if out of disk space) by passing MY_WAIT_IF_FULL flag. Since MY_WAIT_IF_FULL and MY_ZEROFILL have the same values, memory allocator was initializing memory to '\0'. The performance gain provided with this patch may only be visible with non-debug binaries, since safemalloc always initializes allocated memory to 0xA5A5...
Diffstat (limited to 'mysys')
-rw-r--r--mysys/mf_iocache.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index d2ace12da4d..3aab904a6e0 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -233,10 +233,13 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
buffer_block = cachesize;
if (type == SEQ_READ_APPEND)
buffer_block *= 2;
- if ((info->buffer=
- (byte*) my_malloc(buffer_block,
- MYF((cache_myflags & ~ MY_WME) |
- (cachesize == min_cache ? MY_WME : 0)))) != 0)
+ /*
+ Unset MY_WAIT_IF_FULL bit if it is set, to prevent conflict with
+ MY_ZEROFILL.
+ */
+ myf flag = MYF((cache_myflags & ~ (MY_WME | MY_WAIT_IF_FULL)) |
+ (cachesize == min_cache ? MY_WME : 0));
+ if ((info->buffer= (byte*) my_malloc(buffer_block, flag)) != 0)
{
info->write_buffer=info->buffer;
if (type == SEQ_READ_APPEND)