Commit 173ae631 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-12684 Show what config file a sysvar got a value from

Show the config file in I_S.SYSTEM_VARIABLES
But only if the user has FILE privilege
parent f217612f
...@@ -363,6 +363,7 @@ def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 61 ...@@ -363,6 +363,7 @@ def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 61
def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select NEVER NULL def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select NEVER NULL
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select NEVER NULL def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select NEVER NULL
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_PATH 15 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select NEVER NULL
def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select NEVER NULL
def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select NEVER NULL
def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select NEVER NULL
...@@ -915,6 +916,7 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3) ...@@ -915,6 +916,7 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3)
1.0000 information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST longtext 4294967295 4294967295 utf8 utf8_general_ci longtext 1.0000 information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
3.0000 information_schema SYSTEM_VARIABLES READ_ONLY varchar 3 9 utf8 utf8_general_ci varchar(3) 3.0000 information_schema SYSTEM_VARIABLES READ_ONLY varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE_PATH varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema TABLES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema TABLES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema TABLES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema TABLES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
......
...@@ -363,6 +363,7 @@ def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 61 ...@@ -363,6 +363,7 @@ def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 61
def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext NEVER NULL def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext NEVER NULL
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) NEVER NULL def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) NEVER NULL
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_PATH 15 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) NEVER NULL
def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) NEVER NULL
def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) NEVER NULL
def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) NEVER NULL
...@@ -915,6 +916,7 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3) ...@@ -915,6 +916,7 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3)
1.0000 information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST longtext 4294967295 4294967295 utf8 utf8_general_ci longtext 1.0000 information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
3.0000 information_schema SYSTEM_VARIABLES READ_ONLY varchar 3 9 utf8 utf8_general_ci varchar(3) 3.0000 information_schema SYSTEM_VARIABLES READ_ONLY varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE_PATH varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema TABLES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema TABLES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema TABLES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema TABLES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
......
...@@ -28,6 +28,7 @@ NUMERIC_BLOCK_SIZE 1 ...@@ -28,6 +28,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME SIMPLE_PASSWORD_CHECK_LETTERS_SAME_CASE VARIABLE_NAME SIMPLE_PASSWORD_CHECK_LETTERS_SAME_CASE
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE 1 GLOBAL_VALUE 1
...@@ -42,6 +43,7 @@ NUMERIC_BLOCK_SIZE 1 ...@@ -42,6 +43,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME SIMPLE_PASSWORD_CHECK_MINIMAL_LENGTH VARIABLE_NAME SIMPLE_PASSWORD_CHECK_MINIMAL_LENGTH
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE 8 GLOBAL_VALUE 8
...@@ -56,6 +58,7 @@ NUMERIC_BLOCK_SIZE 1 ...@@ -56,6 +58,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME SIMPLE_PASSWORD_CHECK_OTHER_CHARACTERS VARIABLE_NAME SIMPLE_PASSWORD_CHECK_OTHER_CHARACTERS
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE 1 GLOBAL_VALUE 1
...@@ -70,6 +73,7 @@ NUMERIC_BLOCK_SIZE 1 ...@@ -70,6 +73,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH NULL
create user foo1 identified by 'pwd'; create user foo1 identified by 'pwd';
ERROR HY000: Your password does not satisfy the current policy requirements ERROR HY000: Your password does not satisfy the current policy requirements
create user foo1; create user foo1;
......
...@@ -15,10 +15,11 @@ NUMERIC_BLOCK_SIZE NULL ...@@ -15,10 +15,11 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME DEBUG_BINLOG_FSYNC_SLEEP VARIABLE_NAME DEBUG_BINLOG_FSYNC_SLEEP
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE 314 GLOBAL_VALUE 314
GLOBAL_VALUE_ORIGIN CONFIG GLOBAL_VALUE_ORIGIN COMMAND-LINE
DEFAULT_VALUE 0 DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_TYPE BIGINT UNSIGNED
...@@ -29,6 +30,7 @@ NUMERIC_BLOCK_SIZE 1 ...@@ -29,6 +30,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME DEBUG_DBUG VARIABLE_NAME DEBUG_DBUG
SESSION_VALUE SESSION_VALUE
GLOBAL_VALUE GLOBAL_VALUE
...@@ -43,6 +45,7 @@ NUMERIC_BLOCK_SIZE NULL ...@@ -43,6 +45,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME DEBUG_MUTEX_DEADLOCK_DETECTOR VARIABLE_NAME DEBUG_MUTEX_DEADLOCK_DETECTOR
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE ON GLOBAL_VALUE ON
...@@ -57,6 +60,7 @@ NUMERIC_BLOCK_SIZE NULL ...@@ -57,6 +60,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON ENUM_VALUE_LIST OFF,ON
READ_ONLY YES READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME DEBUG_NO_THREAD_ALARM VARIABLE_NAME DEBUG_NO_THREAD_ALARM
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE OFF GLOBAL_VALUE OFF
...@@ -71,6 +75,7 @@ NUMERIC_BLOCK_SIZE NULL ...@@ -71,6 +75,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON ENUM_VALUE_LIST OFF,ON
READ_ONLY YES READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME DEBUG_SYNC VARIABLE_NAME DEBUG_SYNC
SESSION_VALUE ON - current signal: '' SESSION_VALUE ON - current signal: ''
GLOBAL_VALUE NULL GLOBAL_VALUE NULL
...@@ -85,3 +90,4 @@ NUMERIC_BLOCK_SIZE NULL ...@@ -85,3 +90,4 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL COMMAND_LINE_ARGUMENT NULL
GLOBAL_VALUE_PATH NULL
set completion_type=CHAIN;
set global low_priority_updates=1;
install soname 'sql_errlog';
select * from information_schema.system_variables
where variable_name in (
'completion_type', #session!=global, origin=compile-time
'low_priority_updates', #global!=default, origin=sql
'column_compression_threshold', #origin=command-line
'plugin_maturity', #origin=config
'sql_error_log_rate', #plugin, origin=command-line
'sql_error_log_rotations' #plugin, origin=config
)
order by variable_name;
VARIABLE_NAME COLUMN_COMPRESSION_THRESHOLD
SESSION_VALUE 120
GLOBAL_VALUE 120
GLOBAL_VALUE_ORIGIN COMMAND-LINE
DEFAULT_VALUE 100
VARIABLE_SCOPE SESSION
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Minimum column data length eligible for compression
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME COMPLETION_TYPE
SESSION_VALUE CHAIN
GLOBAL_VALUE NO_CHAIN
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NO_CHAIN
VARIABLE_SCOPE SESSION
VARIABLE_TYPE ENUM
VARIABLE_COMMENT The transaction completion type
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NO_CHAIN,CHAIN,RELEASE
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME LOW_PRIORITY_UPDATES
SESSION_VALUE OFF
GLOBAL_VALUE ON
GLOBAL_VALUE_ORIGIN SQL
DEFAULT_VALUE OFF
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT INSERTvar/UPDATE has lower priority than selects
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME PLUGIN_MATURITY
SESSION_VALUE NULL
GLOBAL_VALUE alpha
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE experimental
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST unknown,experimental,alpha,beta,gamma,stable
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH var/my.cnf
VARIABLE_NAME SQL_ERROR_LOG_RATE
SESSION_VALUE NULL
GLOBAL_VALUE 100
GLOBAL_VALUE_ORIGIN COMMAND-LINE
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Sampling rate. If set to 0(zero), the logging is disabled.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000000
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH NULL
VARIABLE_NAME SQL_ERROR_LOG_ROTATIONS
SESSION_VALUE NULL
GLOBAL_VALUE 5
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 9
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of rotations before log is removed.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 999
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH var/my.cnf
create user foo@localhost;
connect foo,localhost,foo;
select global_value_path from information_schema.system_variables where variable_name='plugin_maturity';
global_value_path NULL
connection default;
select global_value_path from information_schema.system_variables where variable_name='plugin_maturity';
global_value_path var/my.cnf
drop user foo@localhost;
set global low_priority_updates=default;
uninstall soname 'sql_errlog';
!include include/default_my.cnf
[server]
loose-sql-error-log-rotations=5
plugin-maturity=alpha
--column-compression-threshold=120
--loose-sql-error-log-rate=100
#
# MDEV-12684 Show what config file a sysvar got a value from
#
source include/not_embedded.inc;
if (!$SQL_ERRLOG_SO) {
skip No sql_errlog plugin;
}
#system_versioning_alter_history
#binlog_format
set completion_type=CHAIN;
set global low_priority_updates=1;
install soname 'sql_errlog';
vertical_results;
replace_regex /\/.*\//var\//;
select * from information_schema.system_variables
where variable_name in (
'completion_type', #session!=global, origin=compile-time
'low_priority_updates', #global!=default, origin=sql
'column_compression_threshold', #origin=command-line
'plugin_maturity', #origin=config
'sql_error_log_rate', #plugin, origin=command-line
'sql_error_log_rotations' #plugin, origin=config
)
order by variable_name;
create user foo@localhost;
connect foo,localhost,foo;
select global_value_path from information_schema.system_variables where variable_name='plugin_maturity';
connection default;
replace_regex /\/.*\//var\//;
select global_value_path from information_schema.system_variables where variable_name='plugin_maturity';
drop user foo@localhost;
set global low_priority_updates=default;
disable_warnings;
uninstall soname 'sql_errlog';
...@@ -7982,7 +7982,7 @@ static int mysql_init_variables(void) ...@@ -7982,7 +7982,7 @@ static int mysql_init_variables(void)
my_bool my_bool
mysqld_get_one_option(const struct my_option *opt, char *argument, mysqld_get_one_option(const struct my_option *opt, char *argument,
const char *) const char *filename)
{ {
if (opt->app_type) if (opt->app_type)
{ {
...@@ -7992,8 +7992,14 @@ mysqld_get_one_option(const struct my_option *opt, char *argument, ...@@ -7992,8 +7992,14 @@ mysqld_get_one_option(const struct my_option *opt, char *argument,
var->value_origin= sys_var::AUTO; var->value_origin= sys_var::AUTO;
return 0; return 0;
} }
if (*filename)
{
var->origin_filename= filename;
var->value_origin= sys_var::CONFIG; var->value_origin= sys_var::CONFIG;
} }
else
var->value_origin= sys_var::COMMAND_LINE;
}
switch(opt->id) { switch(opt->id) {
case '#': case '#':
......
...@@ -1057,6 +1057,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -1057,6 +1057,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
StringBuffer<STRING_BUFFER_USUAL_SIZE> strbuf(scs); StringBuffer<STRING_BUFFER_USUAL_SIZE> strbuf(scs);
const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : 0; const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : 0;
Field **fields=tables->table->field; Field **fields=tables->table->field;
bool has_file_acl= !check_access(thd, FILE_ACL, any_db, NULL, NULL, 0, 1);
DBUG_ASSERT(tables->table->in_use == thd); DBUG_ASSERT(tables->table->in_use == thd);
...@@ -1091,6 +1092,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -1091,6 +1092,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
static const LEX_CSTRING origins[]= static const LEX_CSTRING origins[]=
{ {
{ STRING_WITH_LEN("CONFIG") }, { STRING_WITH_LEN("CONFIG") },
{ STRING_WITH_LEN("COMMAND-LINE") },
{ STRING_WITH_LEN("AUTO") }, { STRING_WITH_LEN("AUTO") },
{ STRING_WITH_LEN("SQL") }, { STRING_WITH_LEN("SQL") },
{ STRING_WITH_LEN("COMPILE-TIME") }, { STRING_WITH_LEN("COMPILE-TIME") },
...@@ -1219,6 +1221,14 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -1219,6 +1221,14 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
fields[13]->store(arg->str, arg->length, scs); fields[13]->store(arg->str, arg->length, scs);
} }
// GLOBAL_VALUE_PATH
if (var->value_origin == sys_var::CONFIG && has_file_acl)
{
fields[14]->set_notnull();
fields[14]->store(var->origin_filename, strlen(var->origin_filename),
files_charset_info);
}
if (schema_table_store_record(thd, tables->table)) if (schema_table_store_record(thd, tables->table))
goto end; goto end;
thd->get_stmt_da()->inc_current_row_for_warning(); thd->get_stmt_da()->inc_current_row_for_warning();
......
...@@ -66,7 +66,7 @@ class sys_var: protected Value_source // for double_from_string_with_check ...@@ -66,7 +66,7 @@ class sys_var: protected Value_source // for double_from_string_with_check
READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096, READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096,
NO_SET_STATEMENT=8192, AUTO_SET=16384}; NO_SET_STATEMENT=8192, AUTO_SET=16384};
enum { NO_GETOPT=-1, GETOPT_ONLY_HELP=-2 }; enum { NO_GETOPT=-1, GETOPT_ONLY_HELP=-2 };
enum where { CONFIG, AUTO, SQL, COMPILE_TIME, ENV }; enum where { CONFIG, COMMAND_LINE, AUTO, SQL, COMPILE_TIME, ENV };
/** /**
Enumeration type to indicate for a system variable whether Enumeration type to indicate for a system variable whether
...@@ -77,6 +77,7 @@ class sys_var: protected Value_source // for double_from_string_with_check ...@@ -77,6 +77,7 @@ class sys_var: protected Value_source // for double_from_string_with_check
my_option option; ///< min, max, default values are stored here my_option option; ///< min, max, default values are stored here
enum where value_origin; enum where value_origin;
const char *origin_filename;
protected: protected:
typedef bool (*on_check_function)(sys_var *self, THD *thd, set_var *var); typedef bool (*on_check_function)(sys_var *self, THD *thd, set_var *var);
......
...@@ -3985,13 +3985,19 @@ static my_option *construct_help_options(MEM_ROOT *mem_root, ...@@ -3985,13 +3985,19 @@ static my_option *construct_help_options(MEM_ROOT *mem_root,
} }
extern "C" my_bool mark_changed(const struct my_option *, char *, const char *); extern "C" my_bool mark_changed(const struct my_option *, char *, const char *);
my_bool mark_changed(const struct my_option *opt, char *, const char *) my_bool mark_changed(const struct my_option *opt, char *, const char *filename)
{ {
if (opt->app_type) if (opt->app_type)
{ {
sys_var *var= (sys_var*) opt->app_type; sys_var *var= (sys_var*) opt->app_type;
if (*filename)
{
var->origin_filename= filename;
var->value_origin= sys_var::CONFIG; var->value_origin= sys_var::CONFIG;
} }
else
var->value_origin= sys_var::COMMAND_LINE;
}
return 0; return 0;
} }
...@@ -4163,7 +4169,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, ...@@ -4163,7 +4169,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
if (tmp->plugin->system_vars) if (tmp->plugin->system_vars)
{ {
for (opt= tmp->plugin->system_vars; *opt; opt++) if (mysqld_server_started)
{ {
/* /*
PLUGIN_VAR_STR command-line options without PLUGIN_VAR_MEMALLOC, point PLUGIN_VAR_STR command-line options without PLUGIN_VAR_MEMALLOC, point
...@@ -4176,8 +4182,9 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, ...@@ -4176,8 +4182,9 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
Thus, for all plugins loaded after the server was started, Thus, for all plugins loaded after the server was started,
we copy string values to a plugin's memroot. we copy string values to a plugin's memroot.
*/ */
if (mysqld_server_started && for (opt= tmp->plugin->system_vars; *opt; opt++)
(((*opt)->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_NOCMDOPT | {
if ((((*opt)->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_NOCMDOPT |
PLUGIN_VAR_MEMALLOC)) == PLUGIN_VAR_STR)) PLUGIN_VAR_MEMALLOC)) == PLUGIN_VAR_STR))
{ {
sysvar_str_t* str= (sysvar_str_t *)*opt; sysvar_str_t* str= (sysvar_str_t *)*opt;
...@@ -4185,6 +4192,14 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, ...@@ -4185,6 +4192,14 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
*str->value= strdup_root(mem_root, *str->value); *str->value= strdup_root(mem_root, *str->value);
} }
} }
/* same issue with config file names */
for (my_option *mo=opts; mo->name; mo++)
{
sys_var *var= (sys_var*) mo->app_type;
if (var && var->value_origin == sys_var::CONFIG)
var->origin_filename= strdup_root(mem_root, var->origin_filename);
}
}
if (chain.first) if (chain.first)
{ {
......
...@@ -9233,6 +9233,7 @@ ST_FIELD_INFO sysvars_fields_info[]= ...@@ -9233,6 +9233,7 @@ ST_FIELD_INFO sysvars_fields_info[]=
Column("ENUM_VALUE_LIST", Longtext(65535), NULLABLE), Column("ENUM_VALUE_LIST", Longtext(65535), NULLABLE),
Column("READ_ONLY", Yesno(), NOT_NULL), Column("READ_ONLY", Yesno(), NOT_NULL),
Column("COMMAND_LINE_ARGUMENT",Name(), NULLABLE), Column("COMMAND_LINE_ARGUMENT",Name(), NULLABLE),
Column("GLOBAL_VALUE_PATH", Varchar(2048), NULLABLE),
CEnd() CEnd()
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment