Commit d914d09f authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-25329: Assertion `allocated_status_memory != __null' failed in void...

MDEV-25329: Assertion `allocated_status_memory != __null' failed in void PROF_MEASUREMENT::set_label(const char*, const char*, const char*, unsigned int)

Make profiler to play a bit better with memory allocators. Test suite can not be included because it lead to non free memory on shutdown (IMHO OK for memory shortage emulation)

As alternetive all this should be rewritten and ability to return errors on upper level should be added.
parent 01031f43
......@@ -203,7 +203,8 @@ void PROF_MEASUREMENT::set_label(const char *status_arg,
sizes[2]= (file_arg == NULL) ? 0 : strlen(file_arg) + 1;
allocated_status_memory= (char *) my_malloc(sizes[0] + sizes[1] + sizes[2], MYF(0));
DBUG_ASSERT(allocated_status_memory != NULL);
if (!allocated_status_memory)
return;
cursor= allocated_status_memory;
......@@ -267,6 +268,8 @@ QUERY_PROFILE::QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg)
{
m_seq_counter= 1;
PROF_MEASUREMENT *prof= new PROF_MEASUREMENT(this, status_arg);
if (!prof)
return;
prof->m_seq= m_seq_counter++;
m_start_time_usecs= prof->time_usecs;
m_end_time_usecs= m_start_time_usecs;
......@@ -308,6 +311,8 @@ void QUERY_PROFILE::new_status(const char *status_arg,
prof= new PROF_MEASUREMENT(this, status_arg, function_arg, base_name(file_arg), line_arg);
else
prof= new PROF_MEASUREMENT(this, status_arg);
if (!prof)
DBUG_VOID_RETURN;
prof->m_seq= m_seq_counter++;
m_end_time_usecs= prof->time_usecs;
......
......@@ -98,6 +98,8 @@ template <class T> class Queue
struct queue_item *new_item;
new_item= (struct queue_item *) my_malloc(sizeof(struct queue_item), MYF(0));
if (!new_item)
return;
new_item->payload= payload;
......@@ -291,7 +293,11 @@ class PROFILING
{
DBUG_ASSERT(!current);
if (unlikely(enabled))
current= new QUERY_PROFILE(this, initial_state);
{
QUERY_PROFILE *new_profile= new QUERY_PROFILE(this, initial_state);
if (new_profile)
current= new_profile;
}
}
void discard_current_query();
......
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