Extended debug_sync_control life time
It now lives from THD constructor to THD destructor. Reset before THD is released to a cache. Change user doesn't reset debug_sync_control anymore. Needed to be able to make use of DEBUG_SYNC() at later stages like ha_close_connection().
This commit is contained in:
parent
c58686447f
commit
662d8a8638
@ -287,12 +287,6 @@ void debug_sync_end_thread(THD *thd)
|
||||
{
|
||||
st_debug_sync_control *ds_control= thd->debug_sync_control;
|
||||
|
||||
/*
|
||||
This synchronization point can be used to synchronize on thread end.
|
||||
This is the latest point in a THD's life, where this can be done.
|
||||
*/
|
||||
DEBUG_SYNC(thd, "thread_end");
|
||||
|
||||
if (ds_control->ds_action)
|
||||
{
|
||||
st_debug_sync_action *action= ds_control->ds_action;
|
||||
@ -322,6 +316,20 @@ void debug_sync_end_thread(THD *thd)
|
||||
}
|
||||
|
||||
|
||||
void debug_sync_reset_thread(THD *thd)
|
||||
{
|
||||
if (thd->debug_sync_control)
|
||||
{
|
||||
/*
|
||||
This synchronization point can be used to synchronize on thread end.
|
||||
This is the latest point in a THD's life, where this can be done.
|
||||
*/
|
||||
DEBUG_SYNC(thd, "thread_end");
|
||||
thd->debug_sync_control->ds_active= 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Move a string by length.
|
||||
|
||||
|
@ -41,10 +41,14 @@ extern int debug_sync_init(void);
|
||||
extern void debug_sync_end(void);
|
||||
extern void debug_sync_init_thread(THD *thd);
|
||||
extern void debug_sync_end_thread(THD *thd);
|
||||
void debug_sync_reset_thread(THD *thd);
|
||||
extern bool debug_sync_set_action(THD *thd, const char *action_str, size_t len);
|
||||
extern bool debug_sync_update(THD *thd, char *val_str, size_t len);
|
||||
extern uchar *debug_sync_value_ptr(THD *thd);
|
||||
|
||||
#else
|
||||
static inline void debug_sync_init_thread(THD *thd) {}
|
||||
static inline void debug_sync_end_thread(THD *thd) {}
|
||||
static inline void debug_sync_reset_thread(THD *thd) {}
|
||||
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
||||
|
||||
#endif /* DEBUG_SYNC_INCLUDED */
|
||||
|
@ -840,6 +840,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
|
||||
reset_open_tables_state(this);
|
||||
|
||||
init();
|
||||
debug_sync_init_thread(this);
|
||||
#if defined(ENABLED_PROFILING)
|
||||
profiling.set_thd(this);
|
||||
#endif
|
||||
@ -1320,11 +1321,6 @@ void THD::init()
|
||||
/* Set to handle counting of aborted connections */
|
||||
userstat_running= opt_userstat_running;
|
||||
last_global_update_time= current_connect_time= time(NULL);
|
||||
#if defined(ENABLED_DEBUG_SYNC)
|
||||
/* Initialize the Debug Sync Facility. See debug_sync.cc. */
|
||||
debug_sync_init_thread(this);
|
||||
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
session_tracker.enable(this);
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
@ -1576,11 +1572,6 @@ void THD::cleanup(void)
|
||||
}
|
||||
wt_thd_destroy(&transaction.wt);
|
||||
|
||||
#if defined(ENABLED_DEBUG_SYNC)
|
||||
/* End the Debug Sync Facility. See debug_sync.cc. */
|
||||
debug_sync_end_thread(this);
|
||||
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
||||
|
||||
my_hash_free(&user_vars);
|
||||
my_hash_free(&sequences);
|
||||
sp_cache_clear(&sp_proc_cache);
|
||||
@ -1634,6 +1625,7 @@ void THD::free_connection()
|
||||
#if defined(ENABLED_PROFILING)
|
||||
profiling.restart(); // Reset profiling
|
||||
#endif
|
||||
debug_sync_reset_thread(this);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1742,6 +1734,7 @@ THD::~THD()
|
||||
lf_hash_put_pins(tdc_hash_pins);
|
||||
if (xid_hash_pins)
|
||||
lf_hash_put_pins(xid_hash_pins);
|
||||
debug_sync_end_thread(this);
|
||||
/* Ensure everything is freed */
|
||||
status_var.local_memory_used-= sizeof(THD);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user