1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-28671 Enable var deprecation for mysqld help output

Currently there are mechanism to mark a system variable as
deprecated, but they are only used to print warning messages
when a deprecated variable is set.

Leverage the existing mechanisms in order to make the
deprecation information available at the --help output of mysqld by:

* Moving the deprecation information (i.e `deprecation_substitute`
  attribute) from the `sys_var` class into the `my_option` struct.
  As every `sys_var` contains its own `my_option` struct, the access
  to the deprecation information remains available to `sys_var`
  objects. `my_getotp` functions, which works directly with
  `my_option` structs, gain access to this information while building
  the --help output.

* For plugin variables, leverages the `PLUGIN_VAR_DEPRECATED` flag
  and set the `deprecation_substitute` attribute  accordingly when
  building the `my_option` objects.

* Change the `option_cmp` function to use the `deprecation_substitute`
  attribute instead of the name when sorting the options. This way
  deprecated options and the substitutes will be grouped together.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer
Amazon Web Services, Inc.
This commit is contained in:
Christian Gonzalez
2023-05-17 19:21:29 +00:00
committed by Sergei Golubchik
parent 25094f339b
commit 4186fa72fb
41 changed files with 223 additions and 143 deletions

View File

@ -1535,20 +1535,6 @@ uchar *get_bookmark_hash_key(const uchar *buff, size_t *length,
return (uchar*) var->key;
}
static inline void convert_dash_to_underscore(char *str, size_t len)
{
for (char *p= str; p <= str+len; p++)
if (*p == '-')
*p= '_';
}
static inline void convert_underscore_to_dash(char *str, size_t len)
{
for (char *p= str; p <= str+len; p++)
if (*p == '_')
*p= '-';
}
#ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key key_LOCK_plugin;
@ -3718,8 +3704,6 @@ bool sys_var_pluginvar::global_update(THD *thd, set_var *var)
void plugin_opt_set_limits(struct my_option *options,
const struct st_mysql_sys_var *opt)
{
options->sub_size= 0;
switch (opt->flags & (PLUGIN_VAR_TYPEMASK |
PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL)) {
/* global system variables */
@ -4078,6 +4062,9 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
else
options->value= options->u_max_value= *(uchar***) (opt + 1);
if (opt->flags & PLUGIN_VAR_DEPRECATED)
options->deprecation_substitute= "";
char *option_name_ptr;
options[1]= options[0];
options[1].name= option_name_ptr= (char*) alloc_root(mem_root,