diff options
author | Tor Didriksen <tor.didriksen@oracle.com> | 2011-02-02 12:54:49 +0100 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@oracle.com> | 2011-02-02 12:54:49 +0100 |
commit | 207e5321bbf0d64c7611bf00e99b439576d3bacd (patch) | |
tree | 28afe03c7912a95367973f279a71006e76e08162 /sql/filesort.cc | |
parent | d6ed8398d5ce4ef144e2e2f03ffbb1be41cbafe3 (diff) | |
download | mariadb-git-207e5321bbf0d64c7611bf00e99b439576d3bacd.tar.gz |
Bug #36022 please log more information about "Sort aborted" queries
Write an additional warning message to the server log,
explaining why a sort operation is aborted.
The output in mysqld.err will look something like:
110127 15:07:54 [ERROR] mysqld: Sort aborted: Out of memory (Needed 24 bytes)
110127 15:07:54 [ERROR] mysqld: Out of sort memory, consider increasing server sort buffer size
110127 15:07:54 [ERROR] mysqld: Sort aborted: Out of sort memory, consider increasing server sort buffer size
110127 15:07:54 [ERROR] mysqld: Sort aborted: Incorrect number of arguments for FUNCTION test.f1; expected 0, got 1
If --log-warn=2 is enabled, we output information about host/user/query as well.
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r-- | sql/filesort.cc | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index f888206f730..cf5334cd87f 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -324,8 +324,24 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, } } if (error) - my_message(ER_FILSORT_ABORT, ER(ER_FILSORT_ABORT), - MYF(ME_ERROR+ME_WAITTANG)); + { + DBUG_ASSERT(thd->is_error()); + my_printf_error(ER_FILSORT_ABORT, + "%s: %s", + MYF(ME_ERROR + ME_WAITTANG), + ER_THD(thd, ER_FILSORT_ABORT), + thd->stmt_da->message()); + + if (global_system_variables.log_warnings > 1) + { + sql_print_warning("%s, host: %s, user: %s, thread: %lu, query: %-.4096s", + ER_THD(thd, ER_FILSORT_ABORT), + thd->security_ctx->host_or_ip, + &thd->security_ctx->priv_user[0], + (ulong) thd->thread_id, + thd->query()); + } + } else statistic_add(thd->status_var.filesort_rows, (ulong) records, &LOCK_status); @@ -369,6 +385,9 @@ static char **make_char_array(char **old_pos, register uint fields, char *char_pos; DBUG_ENTER("make_char_array"); + DBUG_EXECUTE_IF("make_char_array_fail", + DBUG_SET("+d,simulate_out_of_memory");); + if (old_pos || (old_pos= (char**) my_malloc((uint) fields*(length+sizeof(char*)), my_flag))) |