[Commits] 46b3b771672: MDEV-16689: core-file should become a real server variable
revision-id: 46b3b77167242d97069e197ffe2fef25d6e53170 (mariadb-10.1.34-28-g46b3b771672) parent(s): 323f269d4099b4a47530f0574af63292dfd89b8f author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2018-07-20 13:35:58 +0200 message: MDEV-16689: core-file should become a real server variable Port from mysql Bug#56124 --- .../sys_vars/r/sysvars_server_embedded.result | 14 ++++++++++ .../sys_vars/r/sysvars_server_notembedded.result | 14 ++++++++++ sql/sys_vars.cc | 4 +++ sql/sys_vars.ic | 31 ++++++++++++++++++++++ 4 files changed, 63 insertions(+) diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 7f046a188cc..2b3ecc36772 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -471,6 +471,20 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME CORE_FILE +SESSION_VALUE NULL +GLOBAL_VALUE ON +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE NULL +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT write a core-file on crashes +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY YES +COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME DATADIR SESSION_VALUE NULL GLOBAL_VALUE PATH diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 72550ffb3af..8df07cdefbd 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -471,6 +471,20 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME CORE_FILE +SESSION_VALUE NULL +GLOBAL_VALUE ON +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE NULL +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT write a core-file on crashes +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY YES +COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME DATADIR SESSION_VALUE NULL GLOBAL_VALUE PATH diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 5470acc7892..c6e4b87ae25 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -440,6 +440,10 @@ bool check_has_super(sys_var *self, THD *thd, set_var *var) #endif return false; } + +static Sys_var_test_flag Sys_core_file( + "core_file", "write a core-file on crashes", TEST_CORE_ON_SIGNAL); + static bool binlog_format_check(sys_var *self, THD *thd, set_var *var) { if (check_has_super(self, thd, var)) diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic index cbc10c85351..f90d81fa8c4 100644 --- a/sql/sys_vars.ic +++ b/sql/sys_vars.ic @@ -1059,6 +1059,37 @@ class Sys_var_double: public sys_var { var->save_result.double_value= getopt_ulonglong2double(option.def_value); } }; + +/** + The class for @test_flags (core_file for now). + It's derived from Sys_var_mybool. + + Class specific constructor arguments: + Caller need not pass in a variable as we make up the value on the + fly, that is, we derive it from the global test_flags bit vector. + + Backing store: my_bool +*/ +class Sys_var_test_flag: public Sys_var_mybool +{ +private: + my_bool test_flag_value; + uint test_flag_mask; +public: + Sys_var_test_flag(const char *name_arg, const char *comment, uint mask) + : Sys_var_mybool(name_arg, comment, READ_ONLY GLOBAL_VAR(test_flag_value), + NO_CMD_LINE, DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, + 0, 0, 0) + { + test_flag_mask= mask; + } + uchar *global_value_ptr(THD *thd, const LEX_STRING *base) + { + test_flag_value= ((test_flags & test_flag_mask) > 0); + return (uchar*) &test_flag_value; + } +}; + /** The class for the @max_user_connections. It's derived from Sys_var_uint, but non-standard session value
participants (1)
-
Oleksandr Byelkin