Skip to content

Commit

Permalink
MDEV-14581 Warning info not cleared when caching THD
Browse files Browse the repository at this point in the history
In thread caching code, clear THD's warnings before reuse.
  • Loading branch information
vaintroub committed Mar 12, 2018
1 parent 5511e8e commit 248e5d0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mysql-test/t/warnings-master.opt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--loose-skip-innodb
--loose-skip-innodb --thread-handling=one-thread-per-connection
12 changes: 12 additions & 0 deletions mysql-test/t/warnings.test
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,15 @@ SHOW WARNINGS;

DROP TABLE t1;
DROP FUNCTION f1;

# MDEV-14581 Warning info not cleared when caching THD
connect (con1,localhost,root,,);
SELECT TIME('10:10:10.11111111111');
disconnect con1;

connect (con2,localhost,root,,);
SHOW WARNINGS;
disconnect con2;

connection default;

4 changes: 4 additions & 0 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2961,6 +2961,10 @@ static bool cache_thread(THD *thd)
_db_pop_();
#endif

/* Clear warnings. */
if (!thd->get_stmt_da()->is_warning_info_empty())
thd->get_stmt_da()->clear_warning_info(thd->query_id);

set_timespec(abstime, THREAD_CACHE_TIMEOUT);
while (!abort_loop && ! wake_thread && ! kill_cached_threads)
{
Expand Down

0 comments on commit 248e5d0

Please sign in to comment.