Disable mmap usage in Aria and MyISAM when compiling with valgrind

This removes a valgrind warning "cannot read program header" while it
tries to search for memory leaks.
This commit is contained in:
Monty 2025-01-07 12:12:24 +02:00
parent fd9a11d8a5
commit cc5d738999
2 changed files with 6 additions and 6 deletions
storage

View file

@ -74,7 +74,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
} }
if (info->s->file_map) /* Don't use cache if mmap */ if (info->s->file_map) /* Don't use cache if mmap */
break; break;
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) #if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind)
if ((share->options & HA_OPTION_COMPRESS_RECORD)) if ((share->options & HA_OPTION_COMPRESS_RECORD))
{ {
mysql_mutex_lock(&share->intern_lock); mysql_mutex_lock(&share->intern_lock);
@ -162,7 +162,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
error= end_io_cache(&info->rec_cache); error= end_io_cache(&info->rec_cache);
/* Sergei will insert full text index caching here */ /* Sergei will insert full text index caching here */
} }
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) #if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind)
if (info->opt_flag & MEMMAP_USED) if (info->opt_flag & MEMMAP_USED)
madvise((char*) share->file_map, share->state.state.data_file_length, madvise((char*) share->file_map, share->state.state.data_file_length,
MADV_RANDOM); MADV_RANDOM);
@ -456,7 +456,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
maria_extra_keyflag(info, function); maria_extra_keyflag(info, function);
break; break;
case HA_EXTRA_MMAP: case HA_EXTRA_MMAP:
#ifdef HAVE_MMAP #if defined(HAVE_MMAP) && !defined(HAVE_valgrind)
if (block_records) if (block_records)
break; /* Not supported */ break; /* Not supported */
mysql_mutex_lock(&share->intern_lock); mysql_mutex_lock(&share->intern_lock);

View file

@ -69,7 +69,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
} }
if (info->s->file_map) /* Don't use cache if mmap */ if (info->s->file_map) /* Don't use cache if mmap */
break; break;
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) #if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind)
if ((share->options & HA_OPTION_COMPRESS_RECORD)) if ((share->options & HA_OPTION_COMPRESS_RECORD))
{ {
mysql_mutex_lock(&share->intern_lock); mysql_mutex_lock(&share->intern_lock);
@ -155,7 +155,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
error=end_io_cache(&info->rec_cache); error=end_io_cache(&info->rec_cache);
/* Sergei will insert full text index caching here */ /* Sergei will insert full text index caching here */
} }
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) #if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind)
if (info->opt_flag & MEMMAP_USED) if (info->opt_flag & MEMMAP_USED)
madvise((char*) share->file_map, share->state.state.data_file_length, madvise((char*) share->file_map, share->state.state.data_file_length,
MADV_RANDOM); MADV_RANDOM);
@ -320,7 +320,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
mi_extra_keyflag(info, function); mi_extra_keyflag(info, function);
break; break;
case HA_EXTRA_MMAP: case HA_EXTRA_MMAP:
#ifdef HAVE_MMAP #if defined(HAVE_MMAP) && !defined(HAVE_valgrind)
mysql_mutex_lock(&share->intern_lock); mysql_mutex_lock(&share->intern_lock);
/* /*
Memory map the data file if it is not already mapped. It is safe Memory map the data file if it is not already mapped. It is safe