#At file:///home/anurag/mysqlsrc/mysql-5.0-bugteam-44723/ based on revid:li-bing.song@stripped
2788 Anurag Shekhar 2009-08-14
Bug #44723 Larger read_buffer_size values can cause performance
decrease for INSERTs
Large number of calls to 'memset' to initialize the bugger to mulls
where causing the performance drop.
my_malloc routine initializes the buffer if MY_ZEROFILL flag is set.
In this use case MY_ZEROFILL is set unintentionally due to presence
MY_WAIT_IF_FULL which is not meant for my_malloc but has same value
as MY_ZEROFILL. Unsetting this flag before calling my_malloc solves
the problem.
The performance improvement from this patch will be visible only on
release build as the debug build uses a safemalloc routine which
initializes the buffer with ALLOC_VAL (0xA5) if MY_ZEROFILL is not set.
@ mysys/mf_iocache.c
Remove MY_WAIT_IF_FULL from myflags before calling my_malloc
to prevent conflict with MY_ZEROFILL.
modified:
mysys/mf_iocache.c
=== modified file 'mysys/mf_iocache.c'
--- a/mysys/mf_iocache.c 2007-03-28 17:46:42 +0000
+++ b/mysys/mf_iocache.c 2009-08-13 19:08:56 +0000
@@ -235,8 +235,8 @@ int init_io_cache(IO_CACHE *info, File f
buffer_block *= 2;
if ((info->buffer=
(byte*) my_malloc(buffer_block,
- MYF((cache_myflags & ~ MY_WME) |
- (cachesize == min_cache ? MY_WME : 0)))) != 0)
+ MYF(((cache_myflags & ~ (MY_WME | MY_WAIT_IF_FULL)) |
+ (cachesize == min_cache ? MY_WME : 0))))) != 0)
{
info->write_buffer=info->buffer;
if (type == SEQ_READ_APPEND)
Attachment: [text/bzr-bundle] bzr/anurag.shekhar@sun.com-20090813190856-vbsszcijgmzh6cdo.bundle