Commit a9056a2b authored by Daniel Black's avatar Daniel Black

MDEV-18946: innodb: {de|}allocate_large_{dodump|dontdump} added

In 1dc78d35a0beb9620bae1f4841cc07389b425707 the arguments
to a deallocate_large(dontdump=true) was passed a wrong value.

To avoid accidential calling large memory function that have
DODUMP/DONTDUMP options and missing arguments, the functions
have been given distinct names.
parent 8678a105
...@@ -1571,8 +1571,7 @@ buf_chunk_init( ...@@ -1571,8 +1571,7 @@ buf_chunk_init(
DBUG_EXECUTE_IF("ib_buf_chunk_init_fails", return(NULL);); DBUG_EXECUTE_IF("ib_buf_chunk_init_fails", return(NULL););
chunk->mem = buf_pool->allocator.allocate_large(mem_size, chunk->mem = buf_pool->allocator.allocate_large_dontdump(mem_size, &chunk->mem_pfx);
&chunk->mem_pfx, true);
if (UNIV_UNLIKELY(chunk->mem == NULL)) { if (UNIV_UNLIKELY(chunk->mem == NULL)) {
...@@ -1865,9 +1864,8 @@ buf_pool_init_instance( ...@@ -1865,9 +1864,8 @@ buf_pool_init_instance(
&block->debug_latch)); &block->debug_latch));
} }
buf_pool->allocator.deallocate_large( buf_pool->allocator.deallocate_large_dodump(
chunk->mem, &chunk->mem_pfx, chunk->mem_size(), chunk->mem, &chunk->mem_pfx, chunk->mem_size());
true);
} }
ut_free(buf_pool->chunks); ut_free(buf_pool->chunks);
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
...@@ -2014,8 +2012,8 @@ buf_pool_free_instance( ...@@ -2014,8 +2012,8 @@ buf_pool_free_instance(
ut_d(rw_lock_free(&block->debug_latch)); ut_d(rw_lock_free(&block->debug_latch));
} }
buf_pool->allocator.deallocate_large( buf_pool->allocator.deallocate_large_dodump(
chunk->mem, &chunk->mem_pfx, chunk->mem_size(), true); chunk->mem, &chunk->mem_pfx, chunk->mem_size());
} }
for (ulint i = BUF_FLUSH_LRU; i < BUF_FLUSH_N_TYPES; ++i) { for (ulint i = BUF_FLUSH_LRU; i < BUF_FLUSH_N_TYPES; ++i) {
...@@ -2892,8 +2890,8 @@ buf_pool_resize() ...@@ -2892,8 +2890,8 @@ buf_pool_resize()
&block->debug_latch)); &block->debug_latch));
} }
buf_pool->allocator.deallocate_large( buf_pool->allocator.deallocate_large_dodump(
chunk->mem, &chunk->mem_pfx, chunk->mem_size(), true); chunk->mem, &chunk->mem_pfx, chunk->mem_size());
sum_freed += chunk->size; sum_freed += chunk->size;
......
...@@ -654,13 +654,18 @@ class ut_allocator { ...@@ -654,13 +654,18 @@ class ut_allocator {
return(ptr); return(ptr);
} }
pointer
allocate_large_dontdump(
size_type n_elements,
ut_new_pfx_t* pfx)
{
return allocate_large(n_elements, pfx, true);
}
/** Free a memory allocated by allocate_large() and trace the /** Free a memory allocated by allocate_large() and trace the
deallocation. deallocation.
@param[in,out] ptr pointer to memory to free @param[in,out] ptr pointer to memory to free
@param[in] pfx descriptor of the memory, as returned by @param[in] pfx descriptor of the memory, as returned by
allocate_large(). allocate_large(). */
@param[in] dodump if true, advise the OS to include this
memory again if a core dump occurs. */
void void
deallocate_large( deallocate_large(
pointer ptr, pointer ptr,
...@@ -669,12 +674,8 @@ class ut_allocator { ...@@ -669,12 +674,8 @@ class ut_allocator {
pfx pfx
#endif #endif
, ,
size_t size, size_t size)
bool dodump = false)
{ {
if (dodump) {
ut_dodump(ptr, size);
}
#ifdef UNIV_PFS_MEMORY #ifdef UNIV_PFS_MEMORY
if (pfx) { if (pfx) {
deallocate_trace(pfx); deallocate_trace(pfx);
...@@ -684,8 +685,27 @@ class ut_allocator { ...@@ -684,8 +685,27 @@ class ut_allocator {
os_mem_free_large(ptr, size); os_mem_free_large(ptr, size);
} }
void
deallocate_large_dodump(
pointer ptr,
const ut_new_pfx_t*
#ifdef UNIV_PFS_MEMORY #ifdef UNIV_PFS_MEMORY
pfx
#endif
,
size_t size)
{
ut_dodump(ptr, size);
deallocate_large(ptr,
#ifdef UNIV_PFS_MEMORY
pfx,
#else
NULL,
#endif
size);
}
#ifdef UNIV_PFS_MEMORY
/** Get the performance schema key to use for tracing allocations. /** Get the performance schema key to use for tracing allocations.
@param[in] file file name of the caller or NULL if unknown @param[in] file file name of the caller or NULL if unknown
@return performance schema key */ @return performance schema key */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment