summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-09-29 22:07:48 +0200
committerSergei Golubchik <serg@mariadb.org>2019-10-13 20:03:07 +0200
commitf9de1c225ad7a9d190173a71022671cdcdfb76f6 (patch)
treeb7199f3803f8513cfa6d2c8109da3ba90e0b8872
parent44eac65ce73c332afa5243a9cc3cd078ba26220b (diff)
downloadmariadb-git-f9de1c225ad7a9d190173a71022671cdcdfb76f6.tar.gz
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
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result2
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is_embedded.result2
-rw-r--r--mysql-test/suite/plugins/r/simple_password_check.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_debug.result8
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_star.result113
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_wsrep.result49
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_star.cnf5
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_star.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_star.test41
-rw-r--r--sql/mysqld.cc10
-rw-r--r--sql/set_var.cc10
-rw-r--r--sql/set_var.h3
-rw-r--r--sql/sql_plugin.cc33
-rw-r--r--sql/sql_show.cc1
14 files changed, 270 insertions, 13 deletions
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result
index 00f9f347067..27441bb4ebb 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -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 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_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_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
@@ -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
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 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_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)
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
index 072a90eaa50..907bcb01cab 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
@@ -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 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_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_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
@@ -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
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 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_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)
diff --git a/mysql-test/suite/plugins/r/simple_password_check.result b/mysql-test/suite/plugins/r/simple_password_check.result
index 2e706115bd1..f8f56bc8b15 100644
--- a/mysql-test/suite/plugins/r/simple_password_check.result
+++ b/mysql-test/suite/plugins/r/simple_password_check.result
@@ -28,6 +28,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME SIMPLE_PASSWORD_CHECK_LETTERS_SAME_CASE
SESSION_VALUE NULL
GLOBAL_VALUE 1
@@ -42,6 +43,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME SIMPLE_PASSWORD_CHECK_MINIMAL_LENGTH
SESSION_VALUE NULL
GLOBAL_VALUE 8
@@ -56,6 +58,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME SIMPLE_PASSWORD_CHECK_OTHER_CHARACTERS
SESSION_VALUE NULL
GLOBAL_VALUE 1
@@ -70,6 +73,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
create user foo1 identified by 'pwd';
ERROR HY000: Your password does not satisfy the current policy requirements
create user foo1;
diff --git a/mysql-test/suite/sys_vars/r/sysvars_debug.result b/mysql-test/suite/sys_vars/r/sysvars_debug.result
index f50e796bff4..0d77b0211a1 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_debug.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_debug.result
@@ -15,10 +15,11 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME DEBUG_BINLOG_FSYNC_SLEEP
SESSION_VALUE NULL
GLOBAL_VALUE 314
-GLOBAL_VALUE_ORIGIN CONFIG
+GLOBAL_VALUE_ORIGIN COMMAND-LINE
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
@@ -29,6 +30,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME DEBUG_DBUG
SESSION_VALUE
GLOBAL_VALUE
@@ -43,6 +45,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME DEBUG_MUTEX_DEADLOCK_DETECTOR
SESSION_VALUE NULL
GLOBAL_VALUE ON
@@ -57,6 +60,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME DEBUG_NO_THREAD_ALARM
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -71,6 +75,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME DEBUG_SYNC
SESSION_VALUE ON - current signal: ''
GLOBAL_VALUE NULL
@@ -85,3 +90,4 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
+GLOBAL_VALUE_PATH NULL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_star.result b/mysql-test/suite/sys_vars/r/sysvars_star.result
new file mode 100644
index 00000000000..b8a49a089b4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/sysvars_star.result
@@ -0,0 +1,113 @@
+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';
diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
index 5ec5b9ccf30..67209c5e846 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
@@ -15,6 +15,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_CAUSAL_READS
SESSION_VALUE OFF
GLOBAL_VALUE OFF
@@ -29,6 +30,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_CERTIFICATION_RULES
SESSION_VALUE NULL
GLOBAL_VALUE strict
@@ -43,6 +45,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST strict,optimized
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_CERTIFY_NONPK
SESSION_VALUE NULL
GLOBAL_VALUE ON
@@ -57,6 +60,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_CLUSTER_ADDRESS
SESSION_VALUE NULL
GLOBAL_VALUE
@@ -71,6 +75,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_CLUSTER_NAME
SESSION_VALUE NULL
GLOBAL_VALUE my_wsrep_cluster
@@ -85,6 +90,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_CONVERT_LOCK_TO_TRX
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -99,6 +105,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_DATA_HOME_DIR
SESSION_VALUE NULL
GLOBAL_VALUE DATADIR
@@ -113,6 +120,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_DBUG_OPTION
SESSION_VALUE NULL
GLOBAL_VALUE
@@ -127,6 +135,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_DEBUG
SESSION_VALUE NULL
GLOBAL_VALUE NONE
@@ -141,6 +150,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NONE,SERVER,TRANSACTION,STREAMING,CLIENT
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_DESYNC
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -155,6 +165,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_DIRTY_READS
SESSION_VALUE OFF
GLOBAL_VALUE OFF
@@ -169,6 +180,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_DRUPAL_282555_WORKAROUND
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -183,6 +195,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_FORCED_BINLOG_FORMAT
SESSION_VALUE NULL
GLOBAL_VALUE NONE
@@ -197,6 +210,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST MIXED,STATEMENT,ROW,NONE
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_GTID_DOMAIN_ID
SESSION_VALUE NULL
GLOBAL_VALUE 0
@@ -211,6 +225,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_GTID_MODE
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -225,6 +240,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_IGNORE_APPLY_ERRORS
SESSION_VALUE NULL
GLOBAL_VALUE 7
@@ -239,6 +255,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_LOAD_DATA_SPLITTING
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -253,6 +270,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_LOG_CONFLICTS
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -267,6 +285,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_MAX_WS_ROWS
SESSION_VALUE NULL
GLOBAL_VALUE 0
@@ -281,6 +300,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_MAX_WS_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 2147483647
@@ -295,6 +315,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_MYSQL_REPLICATION_BUNDLE
SESSION_VALUE NULL
GLOBAL_VALUE 0
@@ -309,6 +330,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_NODE_ADDRESS
SESSION_VALUE NULL
GLOBAL_VALUE
@@ -323,6 +345,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_NODE_INCOMING_ADDRESS
SESSION_VALUE NULL
GLOBAL_VALUE AUTO
@@ -337,6 +360,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_NODE_NAME
SESSION_VALUE NULL
GLOBAL_VALUE HOSTNAME
@@ -351,6 +375,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_NOTIFY_CMD
SESSION_VALUE NULL
GLOBAL_VALUE
@@ -365,6 +390,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_ON
SESSION_VALUE OFF
GLOBAL_VALUE OFF
@@ -379,6 +405,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_OSU_METHOD
SESSION_VALUE TOI
GLOBAL_VALUE TOI
@@ -393,6 +420,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST TOI,RSU
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_PATCH_VERSION
SESSION_VALUE NULL
GLOBAL_VALUE wsrep_MAJVER.MINVER
@@ -407,6 +435,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_PROVIDER
SESSION_VALUE NULL
GLOBAL_VALUE none
@@ -421,6 +450,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_PROVIDER_OPTIONS
SESSION_VALUE NULL
GLOBAL_VALUE
@@ -435,6 +465,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_RECOVER
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -449,6 +480,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_REJECT_QUERIES
SESSION_VALUE NULL
GLOBAL_VALUE NONE
@@ -463,6 +495,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NONE,ALL,ALL_KILL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_REPLICATE_MYISAM
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -477,6 +510,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_RESTART_SLAVE
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -491,6 +525,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_RETRY_AUTOCOMMIT
SESSION_VALUE 1
GLOBAL_VALUE 1
@@ -505,6 +540,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SLAVE_FK_CHECKS
SESSION_VALUE NULL
GLOBAL_VALUE ON
@@ -519,6 +555,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SLAVE_THREADS
SESSION_VALUE NULL
GLOBAL_VALUE 1
@@ -533,6 +570,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SLAVE_UK_CHECKS
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -547,6 +585,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SR_STORE
SESSION_VALUE NULL
GLOBAL_VALUE table
@@ -561,6 +600,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST none,table
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SST_AUTH
SESSION_VALUE NULL
GLOBAL_VALUE
@@ -575,6 +615,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SST_DONOR
SESSION_VALUE NULL
GLOBAL_VALUE
@@ -589,6 +630,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SST_DONOR_REJECTS_QUERIES
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -603,6 +645,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SST_METHOD
SESSION_VALUE NULL
GLOBAL_VALUE rsync
@@ -617,6 +660,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SST_RECEIVE_ADDRESS
SESSION_VALUE NULL
GLOBAL_VALUE AUTO
@@ -631,6 +675,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_START_POSITION
SESSION_VALUE NULL
GLOBAL_VALUE 00000000-0000-0000-0000-000000000000:-1
@@ -645,6 +690,7 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SYNC_WAIT
SESSION_VALUE 0
GLOBAL_VALUE 0
@@ -659,6 +705,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_TRX_FRAGMENT_SIZE
SESSION_VALUE 0
GLOBAL_VALUE 0
@@ -673,6 +720,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_TRX_FRAGMENT_UNIT
SESSION_VALUE bytes
GLOBAL_VALUE bytes
@@ -687,3 +735,4 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST bytes,rows,statements
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
diff --git a/mysql-test/suite/sys_vars/t/sysvars_star.cnf b/mysql-test/suite/sys_vars/t/sysvars_star.cnf
new file mode 100644
index 00000000000..d1dacd8c9cb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_star.cnf
@@ -0,0 +1,5 @@
+!include include/default_my.cnf
+
+[server]
+loose-sql-error-log-rotations=5
+plugin-maturity=alpha
diff --git a/mysql-test/suite/sys_vars/t/sysvars_star.opt b/mysql-test/suite/sys_vars/t/sysvars_star.opt
new file mode 100644
index 00000000000..58af6adeed4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_star.opt
@@ -0,0 +1,2 @@
+--column-compression-threshold=120
+--loose-sql-error-log-rate=100
diff --git a/mysql-test/suite/sys_vars/t/sysvars_star.test b/mysql-test/suite/sys_vars/t/sysvars_star.test
new file mode 100644
index 00000000000..2f0ef5c9ab0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_star.test
@@ -0,0 +1,41 @@
+#
+# 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';
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index fba19622995..2a7470dc689 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -7982,7 +7982,7 @@ static int mysql_init_variables(void)
my_bool
mysqld_get_one_option(const struct my_option *opt, char *argument,
- const char *)
+ const char *filename)
{
if (opt->app_type)
{
@@ -7992,7 +7992,13 @@ mysqld_get_one_option(const struct my_option *opt, char *argument,
var->value_origin= sys_var::AUTO;
return 0;
}
- var->value_origin= sys_var::CONFIG;
+ if (*filename)
+ {
+ var->origin_filename= filename;
+ var->value_origin= sys_var::CONFIG;
+ }
+ else
+ var->value_origin= sys_var::COMMAND_LINE;
}
switch(opt->id) {
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 84431d1f7a8..fac409f8ef9 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1057,6 +1057,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
StringBuffer<STRING_BUFFER_USUAL_SIZE> strbuf(scs);
const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : 0;
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);
@@ -1091,6 +1092,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
static const LEX_CSTRING origins[]=
{
{ STRING_WITH_LEN("CONFIG") },
+ { STRING_WITH_LEN("COMMAND-LINE") },
{ STRING_WITH_LEN("AUTO") },
{ STRING_WITH_LEN("SQL") },
{ STRING_WITH_LEN("COMPILE-TIME") },
@@ -1219,6 +1221,14 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
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))
goto end;
thd->get_stmt_da()->inc_current_row_for_warning();
diff --git a/sql/set_var.h b/sql/set_var.h
index 31ff0493942..e1e4d6ea0b9 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -66,7 +66,7 @@ public:
READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096,
NO_SET_STATEMENT=8192, AUTO_SET=16384};
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
@@ -77,6 +77,7 @@ public:
my_option option; ///< min, max, default values are stored here
enum where value_origin;
+ const char *origin_filename;
protected:
typedef bool (*on_check_function)(sys_var *self, THD *thd, set_var *var);
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 9807a1235f5..b108dfcd11f 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -3985,12 +3985,18 @@ static my_option *construct_help_options(MEM_ROOT *mem_root,
}
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)
{
sys_var *var= (sys_var*) opt->app_type;
- var->value_origin= sys_var::CONFIG;
+ if (*filename)
+ {
+ var->origin_filename= filename;
+ var->value_origin= sys_var::CONFIG;
+ }
+ else
+ var->value_origin= sys_var::COMMAND_LINE;
}
return 0;
}
@@ -4163,7 +4169,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
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
@@ -4176,13 +4182,22 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
Thus, for all plugins loaded after the server was started,
we copy string values to a plugin's memroot.
*/
- if (mysqld_server_started &&
- (((*opt)->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_NOCMDOPT |
- PLUGIN_VAR_MEMALLOC)) == PLUGIN_VAR_STR))
+ for (opt= tmp->plugin->system_vars; *opt; opt++)
+ {
+ if ((((*opt)->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_NOCMDOPT |
+ PLUGIN_VAR_MEMALLOC)) == PLUGIN_VAR_STR))
+ {
+ sysvar_str_t* str= (sysvar_str_t *)*opt;
+ if (*str->value)
+ *str->value= strdup_root(mem_root, *str->value);
+ }
+ }
+ /* same issue with config file names */
+ for (my_option *mo=opts; mo->name; mo++)
{
- sysvar_str_t* str= (sysvar_str_t *)*opt;
- if (*str->value)
- *str->value= strdup_root(mem_root, *str->value);
+ 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);
}
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index cc04410abdd..6552d91df03 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -9233,6 +9233,7 @@ ST_FIELD_INFO sysvars_fields_info[]=
Column("ENUM_VALUE_LIST", Longtext(65535), NULLABLE),
Column("READ_ONLY", Yesno(), NOT_NULL),
Column("COMMAND_LINE_ARGUMENT",Name(), NULLABLE),
+ Column("GLOBAL_VALUE_PATH", Varchar(2048), NULLABLE),
CEnd()
};