summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorNayuta Yanagisawa <nayuta.yanagisawa@hey.com>2022-02-15 16:18:55 +0900
committerNayuta Yanagisawa <nayuta.yanagisawa@hey.com>2022-02-18 13:10:20 +0900
commit66f55a018bb3a6cc3e68dd4578f487c18a2fa639 (patch)
tree434b3bd6364c6457ced69c5d34ff409626a56b6c /sql
parent5b237e5965c613842a897516eebf0d4e9fe12f98 (diff)
downloadmariadb-git-66f55a018bb3a6cc3e68dd4578f487c18a2fa639.tar.gz
MDEV-27730 Add PLUGIN_VAR_DEPRECATED flag to plugin variables
The sys_var class has the deprecation_substitute member to mark the deprecated variables. As it's set, the server produces warnings when these variables are used. However, the plugin has no means to utilize that functionality. So, the PLUGIN_VAR_DEPRECATED flag is introduced to set the deprecation_substitute with the empty string. A non-empty string can make the warning more informative, but there's no nice way seen to specify it, and not that needed at the moment.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_plugin.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 33b43bdd85d..cee028b7b05 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -291,7 +291,8 @@ public:
struct st_mysql_sys_var *plugin_var;
sys_var_pluginvar(sys_var_chain *chain, const char *name_arg,
- st_plugin_int *p, st_mysql_sys_var *plugin_var_arg);
+ st_plugin_int *p, st_mysql_sys_var *plugin_var_arg,
+ const char *substitute);
sys_var_pluginvar *cast_pluginvar() { return this; }
uchar* real_value_ptr(THD *thd, enum_var_type type) const;
TYPELIB* plugin_var_typelib(void) const;
@@ -3338,11 +3339,11 @@ static int pluginvar_sysvar_flags(const st_mysql_sys_var *p)
}
sys_var_pluginvar::sys_var_pluginvar(sys_var_chain *chain, const char *name_arg,
- st_plugin_int *p, st_mysql_sys_var *pv)
+ st_plugin_int *p, st_mysql_sys_var *pv, const char *substitute)
: sys_var(chain, name_arg, pv->comment, pluginvar_sysvar_flags(pv),
0, pv->flags & PLUGIN_VAR_NOCMDOPT ? -1 : 0, NO_ARG,
pluginvar_show_type(pv), 0,
- NULL, VARIABLE_NOT_IN_BINLOG, NULL, NULL, NULL),
+ NULL, VARIABLE_NOT_IN_BINLOG, NULL, NULL, substitute),
plugin(p), plugin_var(pv)
{
plugin_var->name= name_arg;
@@ -4076,7 +4077,8 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
my_casedn_str(&my_charset_latin1, varname);
convert_dash_to_underscore(varname, len-1);
}
- v= new (mem_root) sys_var_pluginvar(&chain, varname, tmp, o);
+ const char *s= o->flags & PLUGIN_VAR_DEPRECATED ? "" : NULL;
+ v= new (mem_root) sys_var_pluginvar(&chain, varname, tmp, o, s);
v->test_load= (var ? &var->loaded : &static_unload);
DBUG_ASSERT(static_unload == FALSE);