From 4c0078853fbd2052270198217aa19d573a516f92 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 31 Oct 2007 12:29:32 -0400 Subject: [PATCH] Push history-limiting code until after the code that adds new history entries. Lazy deletion isn't smart or useful here. --- sql/sql_profile.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index 30bedcfc813..1ef7363c3a8 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -338,9 +338,6 @@ void PROFILING::store() DBUG_VOID_RETURN; } - while (history.elements > thd->variables.profiling_history_size) - delete history.pop(); - if (likely(((thd)->options & OPTION_PROFILING) == 0)) DBUG_VOID_RETURN; @@ -370,6 +367,9 @@ void PROFILING::store() if (enabled) current= new QUERY_PROFILE(this, thd->query, thd->query_length); + while (history.elements > thd->variables.profiling_history_size) + delete history.pop(); + DBUG_VOID_RETURN; }