Commit graph

3 commits

Author SHA1 Message Date
Tor Didriksen
a930e4745e Bug#13832772 ASSERTION `THD->IS_ERROR() || KILL_ERRNO'
We are trying to sort a lot of text/blob fields, 
so the buffer is indeed too small.
Memory available = thd->variables.sortbuff_size = 262144
min_sort_memory = param.sort_length*MERGEBUFF2 = 292245
So the decision to abort the query is correct.

filesort() calls my_error(), the error is reported.
But, since we have DELETE IGNORE ... the error is converted to a warning by
THD::raise_condition

filesort currently expects an error to be recorded in the THD diagnostics
area.
If we lift this restriction (remove the assert) we end up in the familiar
void Protocol::end_statement()
  default:
    DBUG_ASSERT(0);

The solution seems to be to call my_error(ME_FATALERROR) in filesort,
so that the error is propagated as an error rather than a warning.


mysql-test/r/filesort_debug.result:
  New test case.
mysql-test/t/filesort_debug.test:
  New test case.
2012-03-14 12:28:41 +01:00
Tor Didriksen
69b8293759 Bug #11747102 30771: LOG MORE INFO ABOUT THREADS KILL'D AND SORT ABORTED MESSAGES
mysql-test/r/filesort_debug.result:
  New test case.
mysql-test/t/filesort_debug.test:
  New test case.
sql/filesort.cc:
  thd->killed does not imply thd->is_error(), so test for that separately.
2011-02-24 08:00:12 +01:00
Tor Didriksen
c711ce6726 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.
2011-02-02 12:54:49 +01:00