Commit 88a84f49 authored by Thirunarayanan Balathandayuthapani's avatar Thirunarayanan Balathandayuthapani Committed by Marko Mäkelä

Bug #25167032 CRASH WHEN ASSIGNING MY_ERRNO - MISSING MY_THREAD_INIT IN BACKGROUND THREAD

Description:
===========
Add my_thread_init() and my_thread_exit() for background threads which
initializes and frees the st_my_thread_var structure.

Reviewed-by: Jimmy Yang<jimmy.yang@oracle.com>
RB: 15003
parent e180f3c5
/***************************************************************************** /*****************************************************************************
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved. Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -796,6 +796,7 @@ extern "C" ...@@ -796,6 +796,7 @@ extern "C"
os_thread_ret_t os_thread_ret_t
DECLARE_THREAD(buf_dump_thread)(void*) DECLARE_THREAD(buf_dump_thread)(void*)
{ {
my_thread_init();
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
/* JAN: TODO: MySQL 5.7 PSI /* JAN: TODO: MySQL 5.7 PSI
#ifdef UNIV_PFS_THREAD #ifdef UNIV_PFS_THREAD
...@@ -836,6 +837,7 @@ DECLARE_THREAD(buf_dump_thread)(void*) ...@@ -836,6 +837,7 @@ DECLARE_THREAD(buf_dump_thread)(void*)
srv_buf_dump_thread_active = false; srv_buf_dump_thread_active = false;
my_thread_end();
/* We count the number of threads in os_thread_exit(). A created /* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */ thread should always use that to exit and not use return() to exit. */
os_thread_exit(); os_thread_exit();
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2017, MariaDB Corporation. Copyright (c) 2013, 2017, MariaDB Corporation.
...@@ -532,6 +532,7 @@ DECLARE_THREAD(recv_writer_thread)( ...@@ -532,6 +532,7 @@ DECLARE_THREAD(recv_writer_thread)(
/*!< in: a dummy parameter required by /*!< in: a dummy parameter required by
os_thread_create */ os_thread_create */
{ {
my_thread_init();
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
#ifdef UNIV_PFS_THREAD #ifdef UNIV_PFS_THREAD
...@@ -568,6 +569,7 @@ DECLARE_THREAD(recv_writer_thread)( ...@@ -568,6 +569,7 @@ DECLARE_THREAD(recv_writer_thread)(
recv_writer_thread_active = false; recv_writer_thread_active = false;
my_thread_end();
/* We count the number of threads in os_thread_exit(). /* We count the number of threads in os_thread_exit().
A created thread should always use that to exit and not A created thread should always use that to exit and not
use return() to exit. */ use return() to exit. */
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2017, MariaDB Corporation. Copyright (c) 2016, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
...@@ -868,6 +868,8 @@ DECLARE_THREAD(trx_rollback_or_clean_all_recovered)( ...@@ -868,6 +868,8 @@ DECLARE_THREAD(trx_rollback_or_clean_all_recovered)(
/*!< in: a dummy parameter required by /*!< in: a dummy parameter required by
os_thread_create */ os_thread_create */
{ {
my_thread_init();
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
#ifdef UNIV_PFS_THREAD #ifdef UNIV_PFS_THREAD
...@@ -878,6 +880,7 @@ DECLARE_THREAD(trx_rollback_or_clean_all_recovered)( ...@@ -878,6 +880,7 @@ DECLARE_THREAD(trx_rollback_or_clean_all_recovered)(
trx_rollback_or_clean_is_active = false; trx_rollback_or_clean_is_active = false;
my_thread_end();
/* We count the number of threads in os_thread_exit(). A created /* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */ thread should always use that to exit and not use return() to exit. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment