diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2016-04-15 20:40:25 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2016-08-31 17:17:46 +0200 |
commit | e7608a78ef45cc46f4e4d5abbda788ad54e80e71 (patch) | |
tree | 72d74018fbb72dcb417875399b2a3bd7bdbe7791 /sql/set_var.cc | |
parent | 468a6ad722778768eb4ee5003dd818945b363261 (diff) | |
download | mariadb-git-e7608a78ef45cc46f4e4d5abbda788ad54e80e71.tar.gz |
MDEV-8931: (server part of) session state tracking
initial commit to test
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index b178681e952..68d57abcdf6 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -204,8 +204,28 @@ bool sys_var::update(THD *thd, set_var *var) (on_update && on_update(this, thd, OPT_GLOBAL)); } else - return session_update(thd, var) || + { + bool ret= session_update(thd, var) || (on_update && on_update(this, thd, OPT_SESSION)); + + /* + Make sure we don't session-track variables that are not actually + part of the session. tx_isolation and and tx_read_only for example + exist as GLOBAL, SESSION, and one-shot ("for next transaction only"). + */ + if ((var->type == OPT_SESSION) && (!ret)) + { + /* + Here MySQL sends variable name to avoid reporting change of + the tracker itself, but we decided that it is not needed + */ + thd->session_tracker.mark_as_changed(thd, SESSION_STATE_CHANGE_TRACKER, + NULL); + + } + + return ret; + } } uchar *sys_var::session_value_ptr(THD *thd, const LEX_STRING *base) @@ -867,6 +887,8 @@ int set_var_user::update(THD *thd) MYF(0)); return -1; } + + thd->session_tracker.mark_as_changed(thd, SESSION_STATE_CHANGE_TRACKER, NULL); return 0; } @@ -914,7 +936,11 @@ int set_var_role::check(THD *thd) int set_var_role::update(THD *thd) { #ifndef NO_EMBEDDED_ACCESS_CHECKS - return acl_setrole(thd, role.str, access); + int res= acl_setrole(thd, role.str, access); + if (!res) + thd->session_tracker.mark_as_changed(thd, SESSION_STATE_CHANGE_TRACKER, + NULL); + return res; #else return 0; #endif @@ -968,6 +994,8 @@ int set_var_collation_client::update(THD *thd) { thd->update_charset(character_set_client, collation_connection, character_set_results); + + thd->session_tracker.mark_as_changed(thd, SESSION_STATE_CHANGE_TRACKER, NULL); thd->protocol_text.init(thd); thd->protocol_binary.init(thd); return 0; |