Commit 3e64e7f2 authored by mkaruza's avatar mkaruza

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.
parent c2c637c5
...@@ -122,7 +122,7 @@ extern struct wsrep_service_st { ...@@ -122,7 +122,7 @@ extern struct wsrep_service_st {
#else #else
#define MYSQL_SERVICE_WSREP_STATIC_INCLUDED #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_log_conflicts;
extern my_bool wsrep_certify_nonPK; extern my_bool wsrep_certify_nonPK;
extern my_bool wsrep_load_data_splitting; extern my_bool wsrep_load_data_splitting;
......
...@@ -26,7 +26,7 @@ WSREP_CLUSTER_ADDRESS gcomm:// ...@@ -26,7 +26,7 @@ WSREP_CLUSTER_ADDRESS gcomm://
WSREP_CLUSTER_NAME my_wsrep_cluster WSREP_CLUSTER_NAME my_wsrep_cluster
WSREP_CONVERT_LOCK_TO_TRX OFF WSREP_CONVERT_LOCK_TO_TRX OFF
WSREP_DBUG_OPTION WSREP_DBUG_OPTION
WSREP_DEBUG OFF WSREP_DEBUG NONE
WSREP_DESYNC OFF WSREP_DESYNC OFF
WSREP_DIRTY_READS OFF WSREP_DIRTY_READS OFF
WSREP_DRUPAL_282555_WORKAROUND OFF WSREP_DRUPAL_282555_WORKAROUND OFF
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
[mysqld] [mysqld]
wsrep_sst_method=mariabackup wsrep_sst_method=mariabackup
wsrep_sst_auth="root:" wsrep_sst_auth="root:"
wsrep_debug=ON wsrep_debug=1
[mysqld.1] [mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
[mysqld] [mysqld]
wsrep_sst_method=mariabackup wsrep_sst_method=mariabackup
wsrep_sst_auth="root:" wsrep_sst_auth="root:"
wsrep_debug=ON wsrep_debug=1
[mysqld.1] [mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
[mysqld] [mysqld]
wsrep_sst_method=mariabackup wsrep_sst_method=mariabackup
wsrep_sst_auth="root:" wsrep_sst_auth="root:"
wsrep_debug=ON wsrep_debug=1
[SST] [SST]
tkey=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem tkey=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
[mysqld] [mysqld]
wsrep_sst_method=mariabackup wsrep_sst_method=mariabackup
wsrep_sst_auth="root:" wsrep_sst_auth="root:"
wsrep_debug=ON wsrep_debug=1
[mysqld.1] [mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
......
...@@ -14,7 +14,7 @@ wsrep_causal_reads=0 ...@@ -14,7 +14,7 @@ wsrep_causal_reads=0
wsrep_sync_wait=0 wsrep_sync_wait=0
[mysqld] [mysqld]
wsrep_debug=ON wsrep_debug=1
[client] [client]
ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
......
...@@ -115,18 +115,18 @@ READ_ONLY NO ...@@ -115,18 +115,18 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME WSREP_DEBUG VARIABLE_NAME WSREP_DEBUG
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE OFF GLOBAL_VALUE NONE
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE OFF DEFAULT_VALUE NONE
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN VARIABLE_TYPE ENUM
VARIABLE_COMMENT To enable debug level logging VARIABLE_COMMENT WSREP debug level logging
NUMERIC_MIN_VALUE NULL NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON ENUM_VALUE_LIST NONE,SERVER,TRANSACTION,STREAMING,CLIENT
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME WSREP_DESYNC VARIABLE_NAME WSREP_DESYNC
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE OFF GLOBAL_VALUE OFF
......
...@@ -6,39 +6,41 @@ SET @wsrep_debug_global_saved = @@global.wsrep_debug; ...@@ -6,39 +6,41 @@ SET @wsrep_debug_global_saved = @@global.wsrep_debug;
# default # default
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
@@global.wsrep_debug @@global.wsrep_debug
0 NONE
# scope # scope
SELECT @@session.wsrep_debug; SELECT @@session.wsrep_debug;
ERROR HY000: Variable 'wsrep_debug' is a GLOBAL variable ERROR HY000: Variable 'wsrep_debug' is a GLOBAL variable
SET @@global.wsrep_debug=OFF; SET @@global.wsrep_debug=0;
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
@@global.wsrep_debug @@global.wsrep_debug
0 NONE
SET @@global.wsrep_debug=ON; SET @@global.wsrep_debug=1;
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
@@global.wsrep_debug @@global.wsrep_debug
1 SERVER
# valid values # valid values
SET @@global.wsrep_debug='OFF'; SET @@global.wsrep_debug=NONE;
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
@@global.wsrep_debug @@global.wsrep_debug
0 NONE
SET @@global.wsrep_debug=ON; SET @@global.wsrep_debug=SERVER;
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
@@global.wsrep_debug @@global.wsrep_debug
1 SERVER
SET @@global.wsrep_debug=default; SET @@global.wsrep_debug=default;
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
@@global.wsrep_debug @@global.wsrep_debug
0 NONE
# invalid values # invalid values
SET @@global.wsrep_debug=NULL; SET @@global.wsrep_debug=NULL;
ERROR 42000: Variable 'wsrep_debug' can't be set to the value of 'NULL' ERROR 42000: Variable 'wsrep_debug' can't be set to the value of 'NULL'
SET @@global.wsrep_debug='junk'; SET @@global.wsrep_debug='junk';
ERROR 42000: Variable 'wsrep_debug' can't be set to the value of '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 # restore the initial value
SET @@global.wsrep_debug = @wsrep_debug_global_saved; SET @@global.wsrep_debug = @wsrep_debug_global_saved;
......
...@@ -14,16 +14,16 @@ SELECT @@global.wsrep_debug; ...@@ -14,16 +14,16 @@ SELECT @@global.wsrep_debug;
--echo # scope --echo # scope
--error ER_INCORRECT_GLOBAL_LOCAL_VAR --error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.wsrep_debug; SELECT @@session.wsrep_debug;
SET @@global.wsrep_debug=OFF; SET @@global.wsrep_debug=0;
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
SET @@global.wsrep_debug=ON; SET @@global.wsrep_debug=1;
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
--echo --echo
--echo # valid values --echo # valid values
SET @@global.wsrep_debug='OFF'; SET @@global.wsrep_debug=NONE;
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
SET @@global.wsrep_debug=ON; SET @@global.wsrep_debug=SERVER;
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
SET @@global.wsrep_debug=default; SET @@global.wsrep_debug=default;
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
...@@ -34,6 +34,8 @@ SELECT @@global.wsrep_debug; ...@@ -34,6 +34,8 @@ SELECT @@global.wsrep_debug;
SET @@global.wsrep_debug=NULL; SET @@global.wsrep_debug=NULL;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_debug='junk'; SET @@global.wsrep_debug='junk';
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_debug=ON;
--echo --echo
--echo # restore the initial value --echo # restore the initial value
......
...@@ -5364,9 +5364,14 @@ static Sys_var_charptr Sys_wsrep_dbug_option( ...@@ -5364,9 +5364,14 @@ static Sys_var_charptr Sys_wsrep_dbug_option(
GLOBAL_VAR(wsrep_dbug_option),CMD_LINE(REQUIRED_ARG), GLOBAL_VAR(wsrep_dbug_option),CMD_LINE(REQUIRED_ARG),
IN_SYSTEM_CHARSET, DEFAULT("")); IN_SYSTEM_CHARSET, DEFAULT(""));
static Sys_var_mybool Sys_wsrep_debug( static const char *wsrep_debug_names[]=
"wsrep_debug", "To enable debug level logging", { "NONE", "SERVER", "TRANSACTION", "STREAMING", "CLIENT", NullS };
GLOBAL_VAR(wsrep_debug), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); 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( static Sys_var_mybool Sys_wsrep_convert_LOCK_to_trx(
"wsrep_convert_LOCK_to_trx", "To convert locking sessions " "wsrep_convert_LOCK_to_trx", "To convert locking sessions "
......
...@@ -85,7 +85,7 @@ const char *wsrep_data_home_dir; ...@@ -85,7 +85,7 @@ const char *wsrep_data_home_dir;
const char *wsrep_dbug_option; const char *wsrep_dbug_option;
const char *wsrep_notify_cmd; 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_convert_LOCK_to_trx; // Convert locking sessions to trx
my_bool wsrep_auto_increment_control; // Control auto increment variables my_bool wsrep_auto_increment_control; // Control auto increment variables
my_bool wsrep_drupal_282555_workaround; // Retry autoinc insert after dupkey my_bool wsrep_drupal_282555_workaround; // Retry autoinc insert after dupkey
...@@ -638,6 +638,7 @@ int wsrep_init_server() ...@@ -638,6 +638,7 @@ int wsrep_init_server()
working_dir, working_dir,
initial_position, initial_position,
wsrep_max_protocol_version); wsrep_max_protocol_version);
Wsrep_server_state::instance().debug_log_level(wsrep_debug);
} }
catch (const wsrep::runtime_error& e) catch (const wsrep::runtime_error& e)
{ {
......
...@@ -64,7 +64,7 @@ extern const char* wsrep_data_home_dir; ...@@ -64,7 +64,7 @@ extern const char* wsrep_data_home_dir;
extern const char* wsrep_dbug_option; extern const char* wsrep_dbug_option;
extern long wsrep_slave_threads; extern long wsrep_slave_threads;
extern int wsrep_slave_count_change; 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 my_bool wsrep_convert_LOCK_to_trx;
extern ulong wsrep_retry_autocommit; extern ulong wsrep_retry_autocommit;
extern my_bool wsrep_auto_increment_control; extern my_bool wsrep_auto_increment_control;
...@@ -75,7 +75,7 @@ extern ulong wsrep_max_ws_size; ...@@ -75,7 +75,7 @@ extern ulong wsrep_max_ws_size;
extern ulong wsrep_max_ws_rows; extern ulong wsrep_max_ws_rows;
extern const char* wsrep_notify_cmd; extern const char* wsrep_notify_cmd;
extern my_bool wsrep_certify_nonPK; 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 ulong wsrep_forced_binlog_format;
extern my_bool wsrep_desync; extern my_bool wsrep_desync;
extern ulong wsrep_reject_queries; extern ulong wsrep_reject_queries;
......
...@@ -430,6 +430,12 @@ bool wsrep_reject_queries_update(sys_var *self, THD* thd, enum_var_type type) ...@@ -430,6 +430,12 @@ bool wsrep_reject_queries_update(sys_var *self, THD* thd, enum_var_type type)
return false; 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) static int wsrep_cluster_address_verify (const char* cluster_address_str)
{ {
/* There is no predefined address format, it depends on provider. */ /* There is no predefined address format, it depends on provider. */
......
...@@ -100,6 +100,8 @@ extern bool wsrep_max_ws_size_update UPDATE_ARGS; ...@@ -100,6 +100,8 @@ extern bool wsrep_max_ws_size_update UPDATE_ARGS;
extern bool wsrep_reject_queries_update UPDATE_ARGS; extern bool wsrep_reject_queries_update UPDATE_ARGS;
extern bool wsrep_debug_update UPDATE_ARGS;
#else /* WITH_WSREP */ #else /* WITH_WSREP */
#define wsrep_provider_init(X) #define wsrep_provider_init(X)
......
Subproject commit 20b52ff1ddc3b2f547b7081471f46dcfa5efabc7 Subproject commit af8383daf03bee80b8e54ce207fa9ef1f9d83f94
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