summaryrefslogtreecommitdiff
path: root/mysql-test/t/errors.test
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2017-08-05 19:26:10 +0300
committerMonty <monty@mariadb.org>2017-08-07 03:48:58 +0300
commit74543698a76c02d1a81e17e5918ecbf6b795607b (patch)
tree5f814415c2d08f1c9ab0303d673cfe64a9a048d4 /mysql-test/t/errors.test
parent008786aedb7cacf41a371937c6215c41638c1f96 (diff)
downloadmariadb-git-74543698a76c02d1a81e17e5918ecbf6b795607b.tar.gz
MDEV-13179 main.errors fails with wrong errno
The problem was that the introduction of max-thread-mem-used can cause an allocation error very early, even before mysql_parse() is called. As mysql_parse() calls thd->reset_for_next_command(), which called clear_error(), the error number was lost. Fixed by adding an option to have unique messages for each KILL signal and change max-thread-mem-used to use this new feature. This removes a lot of problems with the original approach, where one could get errors signaled silenty almost any time. ixed by moving clear_error() from reset_for_next_command() to do_command(), before any memory allocation for the thread. Related changes: - reset_for_next_command() now have an optional parameter if we should call clear_error() or not. By default it's called, but not anymore from dispatch_command() which was the original problem. - Added optional paramater to clear_error() to force calling of reset_diagnostics_area(). Before clear_error() only called reset_diagnostics_area() if there was no error, so we normally called reset_diagnostics_area() twice. - This change removed several duplicated calls to clear_error() when starting a query. - Reset max_mem_used on COM_QUIT, to protect against kill during quit. - Use fatal_error() instead of setting is_fatal_error (cleanup) - Set fatal_error if max_thead_mem_used is signaled. (Same logic we use for other places where we are out of resources)
Diffstat (limited to 'mysql-test/t/errors.test')
-rw-r--r--mysql-test/t/errors.test10
1 files changed, 8 insertions, 2 deletions
diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test
index d1d83248df4..55461002fd4 100644
--- a/mysql-test/t/errors.test
+++ b/mysql-test/t/errors.test
@@ -203,7 +203,13 @@ drop table t1;
#
# errors caused by max_session_mem_used
#
+--disable_result_log
+set max_session_mem_used = 50000;
+--error 0,ER_OPTION_PREVENTS_STATEMENT
+select * from seq_1_to_1000;
set max_session_mem_used = 8192;
---error ER_SQL_DISCOVER_ERROR,ER_OPTION_PREVENTS_STATEMENT
+--error 0,ER_OPTION_PREVENTS_STATEMENT
select * from seq_1_to_1000;
-set global max_session_mem_used = default;
+--enable_result_log
+# We may not be able to execute any more queries with this connection
+# because of too little memory#