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 | c711ce6726102a2c4872e1bd6918e2a9772b7c2d (patch) | |
tree | 28afe03c7912a95367973f279a71006e76e08162 /sql | |
parent | b503d77d5c07166956374e230333b5095a44586a (diff) | |
download | mariadb-git-c711ce6726102a2c4872e1bd6918e2a9772b7c2d.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.
include/my_sys.h:
Update comment for ME_NOREFRESH
mysql-test/include/mtr_warnings.sql:
Remove global filtering of "Out of sort memory", let each individual test set it instead.
mysql-test/r/filesort_debug.result:
New test case.
mysql-test/r/order_by.result:
Ignore "Out of memory" for this test.
mysql-test/t/filesort_debug.test:
New test case.
mysql-test/t/order_by.test:
Ignore "Out of memory" for this test.
sql/filesort.cc:
Output an explanation using the error message from the THD Diagnostics_area.
sql/protocol.cc:
Do not DBUG_RETURN(function_call_with DBUG_RETURN)
as it messes up the call stack in the debug output.
sql/share/errmsg-utf8.txt:
Change error message for "Out of sort memory"
sql/unireg.h:
Remove unused/confusing ERRMAPP macro.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/filesort.cc | 23 | ||||
-rw-r--r-- | sql/protocol.cc | 17 | ||||
-rw-r--r-- | sql/share/errmsg-utf8.txt | 8 | ||||
-rw-r--r-- | sql/unireg.h | 4 |
4 files changed, 35 insertions, 17 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))) diff --git a/sql/protocol.cc b/sql/protocol.cc index 03b151e4346..c50861d73a0 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011 Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -543,9 +543,10 @@ bool Protocol::send_ok(uint server_status, uint statement_warn_count, const char *message) { DBUG_ENTER("Protocol::send_ok"); - - DBUG_RETURN(net_send_ok(thd, server_status, statement_warn_count, - affected_rows, last_insert_id, message)); + const bool retval= + net_send_ok(thd, server_status, statement_warn_count, + affected_rows, last_insert_id, message); + DBUG_RETURN(retval); } @@ -558,8 +559,8 @@ bool Protocol::send_ok(uint server_status, uint statement_warn_count, bool Protocol::send_eof(uint server_status, uint statement_warn_count) { DBUG_ENTER("Protocol::send_eof"); - - DBUG_RETURN(net_send_eof(thd, server_status, statement_warn_count)); + const bool retval= net_send_eof(thd, server_status, statement_warn_count); + DBUG_RETURN(retval); } @@ -573,8 +574,8 @@ bool Protocol::send_error(uint sql_errno, const char *err_msg, const char *sql_state) { DBUG_ENTER("Protocol::send_error"); - - DBUG_RETURN(net_send_error_packet(thd, sql_errno, err_msg, sql_state)); + const bool retval= net_send_error_packet(thd, sql_errno, err_msg, sql_state); + DBUG_RETURN(retval); } diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index b0dc4d9195b..a8b0c27d115 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -897,7 +897,7 @@ ER_OUT_OF_SORTMEMORY HY001 S1001 cze "M-Bálo paměti pro třídění. Zvyšte velikost třídícího bufferu" dan "Ikke mere sorteringshukommelse. Øg sorteringshukommelse (sort buffer size) for serveren" nla "Geen geheugen om te sorteren. Verhoog de server sort buffer size" - eng "Out of sort memory; increase server sort buffer size" + eng "Out of sort memory, consider increasing server sort buffer size" jps "Out of sort memory. sort buffer size が足りないようです.", est "Mälu sai sorteerimisel otsa. Suurenda MySQL-i sorteerimispuhvrit" fre "Manque de mémoire pour le tri. Augmentez-la." @@ -907,10 +907,10 @@ ER_OUT_OF_SORTMEMORY HY001 S1001 ita "Memoria per gli ordinamenti esaurita. Incrementare il 'sort_buffer' al demone" jpn "Out of sort memory. sort buffer size が足りないようです." kor "Out of sort memory. daemon sort buffer의 크기를 증가시키세요" - nor "Ikke mer sorteringsminne. Øk sorteringsminnet (sort buffer size) for tjenesten" - norwegian-ny "Ikkje meir sorteringsminne. Auk sorteringsminnet (sorteringsbffer storleik) for tenesten" + nor "Ikke mer sorteringsminne. Vurder å øke sorteringsminnet (sort buffer size) for tjenesten" + norwegian-ny "Ikkje meir sorteringsminne. Vurder å auke sorteringsminnet (sorteringsbuffer storleik) for tenesten" pol "Zbyt mało pamięci dla sortowania. Zwiększ wielko?ć bufora demona dla sortowania" - por "Sem memória para ordenação. Aumente tamanho do 'buffer' de ordenação" + por "Não há memória suficiente para ordenação. Considere aumentar o tamanho do retentor (buffer) de ordenação." rum "Out of memory pentru sortare. Largeste marimea buffer-ului pentru sortare in daemon (sort buffer size)" rus "Недостаточно памяти для сортировки. Увеличьте размер буфера сортировки на сервере" serbian "Nema memorije za sortiranje. Povećajte veličinu sort buffer-a MySQL server-u" diff --git a/sql/unireg.h b/sql/unireg.h index b897c887c89..1bf956efb4f 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -1,7 +1,7 @@ #ifndef UNIREG_INCLUDED #define UNIREG_INCLUDED -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -56,8 +56,6 @@ typedef struct st_ha_create_information HA_CREATE_INFO; #define ER_THD_OR_DEFAULT(thd,X) ((thd) ? ER_THD(thd, X) : ER_DEFAULT(X)) -#define ERRMAPP 1 /* Errormap f|r my_error */ - #define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH) #define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH) #define MYF_RW MYF(MY_WME+MY_NABP) /* Vid my_read & my_write */ |