Skip to content

Commit 248e5d0

Browse files
committed
MDEV-14581 Warning info not cleared when caching THD
In thread caching code, clear THD's warnings before reuse.
1 parent 5511e8e commit 248e5d0

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

mysql-test/t/warnings-master.opt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--loose-skip-innodb
1+
--loose-skip-innodb --thread-handling=one-thread-per-connection

mysql-test/t/warnings.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,15 @@ SHOW WARNINGS;
286286

287287
DROP TABLE t1;
288288
DROP FUNCTION f1;
289+
290+
# MDEV-14581 Warning info not cleared when caching THD
291+
connect (con1,localhost,root,,);
292+
SELECT TIME('10:10:10.11111111111');
293+
disconnect con1;
294+
295+
connect (con2,localhost,root,,);
296+
SHOW WARNINGS;
297+
disconnect con2;
298+
299+
connection default;
300+

sql/mysqld.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,6 +2961,10 @@ static bool cache_thread(THD *thd)
29612961
_db_pop_();
29622962
#endif
29632963

2964+
/* Clear warnings. */
2965+
if (!thd->get_stmt_da()->is_warning_info_empty())
2966+
thd->get_stmt_da()->clear_warning_info(thd->query_id);
2967+
29642968
set_timespec(abstime, THREAD_CACHE_TIMEOUT);
29652969
while (!abort_loop && ! wake_thread && ! kill_cached_threads)
29662970
{

0 commit comments

Comments
 (0)