mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 09:14:17 +01:00
Cleanup session tracker redundancy
- m_enabled is initialised by the base class constructor - removed unused schema_track_inited - moved Transaction_state_tracker constructor to declaration - common enable() - removed unused Session_sysvars_tracker::check_str() - classes are "private" by default - don't even try to compile for embedded Part of MDEV-14984 - regression in connect performance
This commit is contained in:
parent
8f594b3384
commit
19d5ddccfd
3 changed files with 7 additions and 58 deletions
|
@ -117,7 +117,6 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
|
||||||
../sql/sql_sequence.cc ../sql/sql_sequence.h
|
../sql/sql_sequence.cc ../sql/sql_sequence.h
|
||||||
../sql/ha_sequence.cc ../sql/ha_sequence.h
|
../sql/ha_sequence.cc ../sql/ha_sequence.h
|
||||||
../sql/temporary_tables.cc
|
../sql/temporary_tables.cc
|
||||||
../sql/session_tracker.cc
|
|
||||||
../sql/proxy_protocol.cc
|
../sql/proxy_protocol.cc
|
||||||
../sql/sql_tvc.cc ../sql/sql_tvc.h
|
../sql/sql_tvc.cc ../sql/sql_tvc.h
|
||||||
../sql/opt_split.cc
|
../sql/opt_split.cc
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||||
|
|
||||||
|
|
||||||
#ifndef EMBEDDED_LIBRARY
|
|
||||||
#include "sql_plugin.h"
|
#include "sql_plugin.h"
|
||||||
#include "session_tracker.h"
|
#include "session_tracker.h"
|
||||||
|
|
||||||
|
@ -60,8 +59,6 @@ public:
|
||||||
|
|
||||||
class Session_sysvars_tracker : public State_tracker
|
class Session_sysvars_tracker : public State_tracker
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
|
|
||||||
struct sysvar_node_st {
|
struct sysvar_node_st {
|
||||||
sys_var *m_svar;
|
sys_var *m_svar;
|
||||||
bool *test_load;
|
bool *test_load;
|
||||||
|
@ -216,7 +213,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enable(THD *thd);
|
bool enable(THD *thd);
|
||||||
bool check_str(THD *thd, LEX_STRING *val);
|
|
||||||
bool update(THD *thd, set_var *var);
|
bool update(THD *thd, set_var *var);
|
||||||
bool store(THD *thd, String *buf);
|
bool store(THD *thd, String *buf);
|
||||||
void mark_as_changed(THD *thd, LEX_CSTRING *tracked_item_name);
|
void mark_as_changed(THD *thd, LEX_CSTRING *tracked_item_name);
|
||||||
|
@ -239,18 +235,7 @@ public:
|
||||||
|
|
||||||
class Current_schema_tracker : public State_tracker
|
class Current_schema_tracker : public State_tracker
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
bool schema_track_inited;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Current_schema_tracker()
|
|
||||||
{
|
|
||||||
schema_track_inited= false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool enable(THD *thd)
|
|
||||||
{ return update(thd, NULL); }
|
|
||||||
bool update(THD *thd, set_var *var);
|
bool update(THD *thd, set_var *var);
|
||||||
bool store(THD *thd, String *buf);
|
bool store(THD *thd, String *buf);
|
||||||
};
|
};
|
||||||
|
@ -272,8 +257,6 @@ public:
|
||||||
class Session_state_change_tracker : public State_tracker
|
class Session_state_change_tracker : public State_tracker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool enable(THD *thd)
|
|
||||||
{ return update(thd, NULL); };
|
|
||||||
bool update(THD *thd, set_var *var);
|
bool update(THD *thd, set_var *var);
|
||||||
bool store(THD *thd, String *buf);
|
bool store(THD *thd, String *buf);
|
||||||
};
|
};
|
||||||
|
@ -654,27 +637,6 @@ bool Session_sysvars_tracker::enable(THD *thd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Check system variable name(s).
|
|
||||||
|
|
||||||
@note This function is called from the ON_CHECK() function of the
|
|
||||||
session_track_system_variables' sys_var class.
|
|
||||||
|
|
||||||
@param thd [IN] The thd handle.
|
|
||||||
@param var [IN] A pointer to set_var holding the specified list of
|
|
||||||
system variable names.
|
|
||||||
|
|
||||||
@retval true Error
|
|
||||||
@retval false Success
|
|
||||||
*/
|
|
||||||
|
|
||||||
inline bool Session_sysvars_tracker::check_str(THD *thd, LEX_STRING *val)
|
|
||||||
{
|
|
||||||
return Session_sysvars_tracker::check_var_list(thd, *val, true,
|
|
||||||
thd->charset(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Once the value of the @@session_track_system_variables has been
|
Once the value of the @@session_track_system_variables has been
|
||||||
successfully updated, this function calls
|
successfully updated, this function calls
|
||||||
|
@ -936,17 +898,6 @@ bool Current_schema_tracker::store(THD *thd, String *buf)
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
Transaction_state_tracker::Transaction_state_tracker()
|
|
||||||
{
|
|
||||||
m_enabled = false;
|
|
||||||
tx_changed = TX_CHG_NONE;
|
|
||||||
tx_curr_state =
|
|
||||||
tx_reported_state= TX_EMPTY;
|
|
||||||
tx_read_flags = TX_READ_INHERIT;
|
|
||||||
tx_isol_level = TX_ISOL_INHERIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enable/disable the tracker based on @@session_track_transaction_info.
|
Enable/disable the tracker based on @@session_track_transaction_info.
|
||||||
|
|
||||||
|
@ -1597,5 +1548,3 @@ void Session_tracker::store(THD *thd, String *buf)
|
||||||
|
|
||||||
net_store_length(data - 1, length);
|
net_store_length(data - 1, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //EMBEDDED_LIBRARY
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
void reset_changed() { m_changed= false; }
|
void reset_changed() { m_changed= false; }
|
||||||
|
|
||||||
/** Called in the constructor of THD*/
|
/** Called in the constructor of THD*/
|
||||||
virtual bool enable(THD *thd)= 0;
|
virtual bool enable(THD *thd) { return update(thd, 0); }
|
||||||
|
|
||||||
/** To be invoked when the tracker's system variable is updated (ON_UPDATE).*/
|
/** To be invoked when the tracker's system variable is updated (ON_UPDATE).*/
|
||||||
virtual bool update(THD *thd, set_var *var)= 0;
|
virtual bool update(THD *thd, set_var *var)= 0;
|
||||||
|
@ -119,7 +119,6 @@ bool sysvartrack_value_construct(THD *thd, char *val, size_t len);
|
||||||
|
|
||||||
class Session_tracker
|
class Session_tracker
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
State_tracker *m_trackers[SESSION_TRACKER_END];
|
State_tracker *m_trackers[SESSION_TRACKER_END];
|
||||||
|
|
||||||
/* The following two functions are private to disable copying. */
|
/* The following two functions are private to disable copying. */
|
||||||
|
@ -234,14 +233,16 @@ enum enum_session_track_transaction_info {
|
||||||
|
|
||||||
class Transaction_state_tracker : public State_tracker
|
class Transaction_state_tracker : public State_tracker
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
/** Helper function: turn table info into table access flag */
|
/** Helper function: turn table info into table access flag */
|
||||||
enum_tx_state calc_trx_state(THD *thd, thr_lock_type l, bool has_trx);
|
enum_tx_state calc_trx_state(THD *thd, thr_lock_type l, bool has_trx);
|
||||||
public:
|
public:
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
Transaction_state_tracker();
|
Transaction_state_tracker(): tx_changed(TX_CHG_NONE),
|
||||||
bool enable(THD *thd)
|
tx_curr_state(TX_EMPTY),
|
||||||
{ return update(thd, NULL); }
|
tx_reported_state(TX_EMPTY),
|
||||||
|
tx_read_flags(TX_READ_INHERIT),
|
||||||
|
tx_isol_level(TX_ISOL_INHERIT) {}
|
||||||
|
|
||||||
bool update(THD *thd, set_var *var);
|
bool update(THD *thd, set_var *var);
|
||||||
bool store(THD *thd, String *buf);
|
bool store(THD *thd, String *buf);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue