diff options
author | mkaruza <mario.karuza@galeracluster.com> | 2019-02-12 12:32:42 +0100 |
---|---|---|
committer | mkaruza <mario.karuza@galeracluster.com> | 2019-02-13 18:47:27 +0100 |
commit | 3e64e7f24c74da786e0f31bded61f59d9f772241 (patch) | |
tree | 301d24574106c5627514942a418a41bb19a016a6 | |
parent | c2c637c583b9803a358d2b07ca98f3cb9868bb68 (diff) | |
download | mariadb-git-3e64e7f24c74da786e0f31bded61f59d9f772241.tar.gz |
WSREP debug log levels support
Global variable wsrep_debug now can be used to filter wsrep-lib messages based on debug level provided.
Type of wsrep_debug is now set to be unsigned int, so tests and configuration files changed accordingly.
-rw-r--r-- | include/mysql/service_wsrep.h | 2 | ||||
-rw-r--r-- | mysql-test/suite/galera/r/galera_defaults.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_sst_mariabackup.cnf | 2 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf | 2 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.cnf | 2 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf | 2 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf | 2 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/sysvars_wsrep.result | 12 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/wsrep_debug_basic.result | 22 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/wsrep_debug_basic.test | 10 | ||||
-rw-r--r-- | sql/sys_vars.cc | 11 | ||||
-rw-r--r-- | sql/wsrep_mysqld.cc | 3 | ||||
-rw-r--r-- | sql/wsrep_mysqld.h | 4 | ||||
-rw-r--r-- | sql/wsrep_var.cc | 6 | ||||
-rw-r--r-- | sql/wsrep_var.h | 2 | ||||
m--------- | wsrep-lib | 0 |
16 files changed, 51 insertions, 33 deletions
diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h index 5aa97cdb47e..2df497ec149 100644 --- a/include/mysql/service_wsrep.h +++ b/include/mysql/service_wsrep.h @@ -122,7 +122,7 @@ extern struct wsrep_service_st { #else #define MYSQL_SERVICE_WSREP_STATIC_INCLUDED -extern my_bool wsrep_debug; +extern ulong wsrep_debug; extern my_bool wsrep_log_conflicts; extern my_bool wsrep_certify_nonPK; extern my_bool wsrep_load_data_splitting; diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result index 4aef4f5e48c..d0eb22ffcbc 100644 --- a/mysql-test/suite/galera/r/galera_defaults.result +++ b/mysql-test/suite/galera/r/galera_defaults.result @@ -26,7 +26,7 @@ WSREP_CLUSTER_ADDRESS gcomm:// WSREP_CLUSTER_NAME my_wsrep_cluster WSREP_CONVERT_LOCK_TO_TRX OFF WSREP_DBUG_OPTION -WSREP_DEBUG OFF +WSREP_DEBUG NONE WSREP_DESYNC OFF WSREP_DIRTY_READS OFF WSREP_DRUPAL_282555_WORKAROUND OFF diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf index 336296e9bfe..be2ca0d1f09 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf @@ -3,7 +3,7 @@ [mysqld] wsrep_sst_method=mariabackup wsrep_sst_auth="root:" -wsrep_debug=ON +wsrep_debug=1 [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf index aeb2301925e..b1caf700a12 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf @@ -3,7 +3,7 @@ [mysqld] wsrep_sst_method=mariabackup wsrep_sst_auth="root:" -wsrep_debug=ON +wsrep_debug=1 [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.cnf index 646d7322b41..60db7ddba77 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.cnf @@ -3,7 +3,7 @@ [mysqld] wsrep_sst_method=mariabackup wsrep_sst_auth="root:" -wsrep_debug=ON +wsrep_debug=1 [SST] tkey=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf index 336296e9bfe..be2ca0d1f09 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf @@ -3,7 +3,7 @@ [mysqld] wsrep_sst_method=mariabackup wsrep_sst_auth="root:" -wsrep_debug=ON +wsrep_debug=1 [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf index b7bca487fc5..ebd116a359f 100644 --- a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf @@ -14,7 +14,7 @@ wsrep_causal_reads=0 wsrep_sync_wait=0 [mysqld] -wsrep_debug=ON +wsrep_debug=1 [client] ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result index 49eaaa965dc..23a45f39896 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result +++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result @@ -115,18 +115,18 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME WSREP_DEBUG SESSION_VALUE NULL -GLOBAL_VALUE OFF +GLOBAL_VALUE NONE GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE OFF +DEFAULT_VALUE NONE VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT To enable debug level logging +VARIABLE_TYPE ENUM +VARIABLE_COMMENT WSREP debug level logging NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST OFF,ON +ENUM_VALUE_LIST NONE,SERVER,TRANSACTION,STREAMING,CLIENT READ_ONLY NO -COMMAND_LINE_ARGUMENT OPTIONAL +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME WSREP_DESYNC SESSION_VALUE NULL GLOBAL_VALUE OFF diff --git a/mysql-test/suite/sys_vars/r/wsrep_debug_basic.result b/mysql-test/suite/sys_vars/r/wsrep_debug_basic.result index 96c262c110c..47d00f5dede 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_debug_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_debug_basic.result @@ -6,39 +6,41 @@ SET @wsrep_debug_global_saved = @@global.wsrep_debug; # default SELECT @@global.wsrep_debug; @@global.wsrep_debug -0 +NONE # scope SELECT @@session.wsrep_debug; ERROR HY000: Variable 'wsrep_debug' is a GLOBAL variable -SET @@global.wsrep_debug=OFF; +SET @@global.wsrep_debug=0; SELECT @@global.wsrep_debug; @@global.wsrep_debug -0 -SET @@global.wsrep_debug=ON; +NONE +SET @@global.wsrep_debug=1; SELECT @@global.wsrep_debug; @@global.wsrep_debug -1 +SERVER # valid values -SET @@global.wsrep_debug='OFF'; +SET @@global.wsrep_debug=NONE; SELECT @@global.wsrep_debug; @@global.wsrep_debug -0 -SET @@global.wsrep_debug=ON; +NONE +SET @@global.wsrep_debug=SERVER; SELECT @@global.wsrep_debug; @@global.wsrep_debug -1 +SERVER SET @@global.wsrep_debug=default; SELECT @@global.wsrep_debug; @@global.wsrep_debug -0 +NONE # invalid values SET @@global.wsrep_debug=NULL; ERROR 42000: Variable 'wsrep_debug' can't be set to the value of 'NULL' SET @@global.wsrep_debug='junk'; ERROR 42000: Variable 'wsrep_debug' can't be set to the value of 'junk' +SET @@global.wsrep_debug=ON; +ERROR 42000: Variable 'wsrep_debug' can't be set to the value of 'ON' # restore the initial value SET @@global.wsrep_debug = @wsrep_debug_global_saved; diff --git a/mysql-test/suite/sys_vars/t/wsrep_debug_basic.test b/mysql-test/suite/sys_vars/t/wsrep_debug_basic.test index 50576ff064e..165560bb25a 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_debug_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_debug_basic.test @@ -14,16 +14,16 @@ SELECT @@global.wsrep_debug; --echo # scope --error ER_INCORRECT_GLOBAL_LOCAL_VAR SELECT @@session.wsrep_debug; -SET @@global.wsrep_debug=OFF; +SET @@global.wsrep_debug=0; SELECT @@global.wsrep_debug; -SET @@global.wsrep_debug=ON; +SET @@global.wsrep_debug=1; SELECT @@global.wsrep_debug; --echo --echo # valid values -SET @@global.wsrep_debug='OFF'; +SET @@global.wsrep_debug=NONE; SELECT @@global.wsrep_debug; -SET @@global.wsrep_debug=ON; +SET @@global.wsrep_debug=SERVER; SELECT @@global.wsrep_debug; SET @@global.wsrep_debug=default; SELECT @@global.wsrep_debug; @@ -34,6 +34,8 @@ SELECT @@global.wsrep_debug; SET @@global.wsrep_debug=NULL; --error ER_WRONG_VALUE_FOR_VAR SET @@global.wsrep_debug='junk'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_debug=ON; --echo --echo # restore the initial value diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index ad576280d3d..09a3de37c70 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -5364,9 +5364,14 @@ static Sys_var_charptr Sys_wsrep_dbug_option( GLOBAL_VAR(wsrep_dbug_option),CMD_LINE(REQUIRED_ARG), IN_SYSTEM_CHARSET, DEFAULT("")); -static Sys_var_mybool Sys_wsrep_debug( - "wsrep_debug", "To enable debug level logging", - GLOBAL_VAR(wsrep_debug), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); +static const char *wsrep_debug_names[]= +{ "NONE", "SERVER", "TRANSACTION", "STREAMING", "CLIENT", NullS }; +static Sys_var_enum Sys_wsrep_debug( + "wsrep_debug", "WSREP debug level logging", + GLOBAL_VAR(wsrep_debug), CMD_LINE(REQUIRED_ARG), + wsrep_debug_names, DEFAULT(0), + NO_MUTEX_GUARD, NOT_IN_BINLOG, + ON_CHECK(0), ON_UPDATE(wsrep_debug_update)); static Sys_var_mybool Sys_wsrep_convert_LOCK_to_trx( "wsrep_convert_LOCK_to_trx", "To convert locking sessions " diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 06e713ceda0..18c2e7072e2 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -85,7 +85,7 @@ const char *wsrep_data_home_dir; const char *wsrep_dbug_option; const char *wsrep_notify_cmd; -my_bool wsrep_debug; // Enable debug level logging +ulong wsrep_debug; // Debug level logging my_bool wsrep_convert_LOCK_to_trx; // Convert locking sessions to trx my_bool wsrep_auto_increment_control; // Control auto increment variables my_bool wsrep_drupal_282555_workaround; // Retry autoinc insert after dupkey @@ -638,6 +638,7 @@ int wsrep_init_server() working_dir, initial_position, wsrep_max_protocol_version); + Wsrep_server_state::instance().debug_log_level(wsrep_debug); } catch (const wsrep::runtime_error& e) { diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 3c430ccf487..9cf998c8afd 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -64,7 +64,7 @@ extern const char* wsrep_data_home_dir; extern const char* wsrep_dbug_option; extern long wsrep_slave_threads; extern int wsrep_slave_count_change; -extern MYSQL_PLUGIN_IMPORT my_bool wsrep_debug; +extern ulong wsrep_debug; extern my_bool wsrep_convert_LOCK_to_trx; extern ulong wsrep_retry_autocommit; extern my_bool wsrep_auto_increment_control; @@ -75,7 +75,7 @@ extern ulong wsrep_max_ws_size; extern ulong wsrep_max_ws_rows; extern const char* wsrep_notify_cmd; extern my_bool wsrep_certify_nonPK; -extern long int wsrep_protocol_version; +extern long int wsrep_protocol_version; extern ulong wsrep_forced_binlog_format; extern my_bool wsrep_desync; extern ulong wsrep_reject_queries; diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 8a0968639c2..7ba4ed3c14c 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -430,6 +430,12 @@ bool wsrep_reject_queries_update(sys_var *self, THD* thd, enum_var_type type) return false; } +bool wsrep_debug_update(sys_var *self, THD* thd, enum_var_type type) +{ + Wsrep_server_state::instance().debug_log_level(wsrep_debug); + return false; +} + static int wsrep_cluster_address_verify (const char* cluster_address_str) { /* There is no predefined address format, it depends on provider. */ diff --git a/sql/wsrep_var.h b/sql/wsrep_var.h index b732fb48b38..0acb61432f0 100644 --- a/sql/wsrep_var.h +++ b/sql/wsrep_var.h @@ -100,6 +100,8 @@ extern bool wsrep_max_ws_size_update UPDATE_ARGS; extern bool wsrep_reject_queries_update UPDATE_ARGS; +extern bool wsrep_debug_update UPDATE_ARGS; + #else /* WITH_WSREP */ #define wsrep_provider_init(X) diff --git a/wsrep-lib b/wsrep-lib -Subproject 20b52ff1ddc3b2f547b7081471f46dcfa5efabc +Subproject af8383daf03bee80b8e54ce207fa9ef1f9d83f9 |