1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-10814: Coredumps to exclude query cache (Linux)

This only occurs non-DEBUG builds. Its main purpose is to
save space in the core dump from elements not usually useful.

Signed-off-by: Daniel Black <daniel@linux.vnet.ibm.com>
This commit is contained in:
Daniel Black
2017-04-25 17:49:15 +10:00
committed by Daniel Black
parent c029eae02d
commit 3188131b15
2 changed files with 19 additions and 1 deletions

View File

@@ -329,6 +329,9 @@ TODO list:
*/ */
#include "mariadb.h" /* NO_EMBEDDED_ACCESS_CHECKS */ #include "mariadb.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#if defined(DBUG_OFF) && defined(HAVE_MADVISE)
#include <sys/mman.h>
#endif
#include "sql_priv.h" #include "sql_priv.h"
#include "sql_basic_types.h" #include "sql_basic_types.h"
#include "sql_cache.h" #include "sql_cache.h"
@@ -2581,7 +2584,7 @@ ulong Query_cache::init_cache()
{ {
uint mem_bin_count, num, step; uint mem_bin_count, num, step;
ulong mem_bin_size, prev_size, inc; ulong mem_bin_size, prev_size, inc;
ulong additional_data_size, max_mem_bin_size, approx_additional_data_size; ulong max_mem_bin_size, approx_additional_data_size;
int align; int align;
DBUG_ENTER("Query_cache::init_cache"); DBUG_ENTER("Query_cache::init_cache");
@@ -2646,6 +2649,13 @@ ulong Query_cache::init_cache()
if (!(cache= (uchar *) if (!(cache= (uchar *)
my_malloc_lock(query_cache_size+additional_data_size, MYF(0)))) my_malloc_lock(query_cache_size+additional_data_size, MYF(0))))
goto err; goto err;
#if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DONTDUMP)
if (madvise(cache, query_cache_size+additional_data_size, MADV_DONTDUMP))
{
DBUG_PRINT("warning", ("coudn't mark query cache memory as MADV_DONTDUMP: %s",
strerror(errno)));
}
#endif
DBUG_PRINT("qcache", ("cache length %lu, min unit %lu, %u bins", DBUG_PRINT("qcache", ("cache length %lu, min unit %lu, %u bins",
query_cache_size, min_allocation_unit, mem_bin_num)); query_cache_size, min_allocation_unit, mem_bin_num));
@@ -2797,6 +2807,13 @@ void Query_cache::free_cache()
} while (block != queries_blocks); } while (block != queries_blocks);
} }
#if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DODUMP)
if (madvise(cache, query_cache_size+additional_data_size, MADV_DODUMP))
{
DBUG_PRINT("warning", ("coudn't mark query cache memory as MADV_DODUMP: %s",
strerror(errno)));
}
#endif
my_free(cache); my_free(cache);
make_disabled(); make_disabled();
my_hash_free(&queries); my_hash_free(&queries);

View File

@@ -337,6 +337,7 @@ protected:
till the end of a flush operation. till the end of a flush operation.
*/ */
mysql_mutex_t structure_guard_mutex; mysql_mutex_t structure_guard_mutex;
ulong additional_data_size;
uchar *cache; // cache memory uchar *cache; // cache memory
Query_cache_block *first_block; // physical location block list Query_cache_block *first_block; // physical location block list
Query_cache_block *queries_blocks; // query list (LIFO) Query_cache_block *queries_blocks; // query list (LIFO)