MDEV-10098 main.create_delayed fails with ps-protocol: assertion `global_status_var.global_memory_used >= 0' failed

Remove the assert. We cannot verify that
global_memory_used value is valid (>=0)
because some of updates are cached in individual THD's
(e.g. THD1 can have +300 cached, while the other THD2
can have -300 cached. If the second THD exists before
the first one, global_memory_used will be -300
temporarily).

Instead add the assert just before the exit, when all
THDs been already destroyed.
This commit is contained in:
Sergei Golubchik 2016-06-13 19:50:45 +02:00
parent e65703c6bd
commit 9f9eb682d5

View File

@ -2141,6 +2141,7 @@ static void mysqld_exit(int exit_code)
shutdown_performance_schema(); // we do it as late as possible shutdown_performance_schema(); // we do it as late as possible
#endif #endif
set_malloc_size_cb(NULL); set_malloc_size_cb(NULL);
DBUG_ASSERT(global_status_var.global_memory_used == 0);
cleanup_tls(); cleanup_tls();
DBUG_LEAVE; DBUG_LEAVE;
if (opt_endinfo && global_status_var.global_memory_used) if (opt_endinfo && global_status_var.global_memory_used)
@ -4109,14 +4110,6 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
else else
{ {
update_global_memory_status(size); update_global_memory_status(size);
#ifndef EMBEDDED_LIBRARY
/*
Check if we have missed some mallocs. THis can't be done for embedded
server as the main code may have done calls to malloc before starting
the embedded library.
*/
DBUG_ASSERT(global_status_var.global_memory_used >= 0);
#endif
} }
} }
} }