mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Update wsrep-lib (new logger interface)
Ensure consistent use of logging macros in wsrep-related code Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
This commit is contained in:
committed by
Jan Lindström
parent
7edbd27258
commit
033f8d13ce
@ -316,29 +316,31 @@ wsp::node_status local_status;
|
||||
*/
|
||||
Wsrep_schema *wsrep_schema= 0;
|
||||
|
||||
static void wsrep_log_cb(wsrep::log::level level, const char *msg)
|
||||
static void wsrep_log_cb(wsrep::log::level level,
|
||||
const char*, const char *msg)
|
||||
{
|
||||
/*
|
||||
Silence all wsrep related logging from lib and provider if
|
||||
wsrep is not enabled.
|
||||
*/
|
||||
if (WSREP_ON)
|
||||
{
|
||||
if (!WSREP_ON) return;
|
||||
|
||||
switch (level) {
|
||||
case wsrep::log::info:
|
||||
sql_print_information("WSREP: %s", msg);
|
||||
WSREP_INFO("%s", msg);
|
||||
break;
|
||||
case wsrep::log::warning:
|
||||
sql_print_warning("WSREP: %s", msg);
|
||||
WSREP_WARN("%s", msg);
|
||||
break;
|
||||
case wsrep::log::error:
|
||||
sql_print_error("WSREP: %s", msg);
|
||||
WSREP_ERROR("%s", msg);
|
||||
break;
|
||||
case wsrep::log::debug:
|
||||
if (wsrep_debug) sql_print_information ("[Debug] WSREP: %s", msg);
|
||||
default:
|
||||
WSREP_DEBUG("%s", msg);
|
||||
break;
|
||||
case wsrep::log::unknown:
|
||||
WSREP_UNKNOWN("%s", msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,10 +251,10 @@ void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...);
|
||||
#define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
|
||||
#define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__)
|
||||
#define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__)
|
||||
#define WSREP_UNKNOWN(fmt, ...) WSREP_ERROR("UNKNOWN: " fmt, ##__VA_ARGS__)
|
||||
|
||||
#define WSREP_LOG_CONFLICT_THD(thd, role) \
|
||||
WSREP_LOG(sql_print_information, \
|
||||
"%s: \n " \
|
||||
WSREP_INFO("%s: \n " \
|
||||
" THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \
|
||||
" SQL: %s", \
|
||||
role, \
|
||||
@ -269,12 +269,12 @@ void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...);
|
||||
#define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \
|
||||
if (wsrep_debug || wsrep_log_conflicts) \
|
||||
{ \
|
||||
WSREP_LOG(sql_print_information, "cluster conflict due to %s for threads:", \
|
||||
WSREP_INFO("cluster conflict due to %s for threads:", \
|
||||
(bf_abort) ? "high priority abort" : "certification failure" \
|
||||
); \
|
||||
if (bf_thd) WSREP_LOG_CONFLICT_THD(bf_thd, "Winning thread"); \
|
||||
if (victim_thd) WSREP_LOG_CONFLICT_THD(victim_thd, "Victim thread"); \
|
||||
WSREP_LOG(sql_print_information, "context: %s:%d", __FILE__, __LINE__); \
|
||||
WSREP_INFO("context: %s:%d", __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
#define WSREP_PROVIDER_EXISTS \
|
||||
|
@ -162,16 +162,19 @@ void Wsrep_server_service::log_message(enum wsrep::log::level level,
|
||||
switch (level)
|
||||
{
|
||||
case wsrep::log::debug:
|
||||
sql_print_information("debug: %s", message);
|
||||
WSREP_DEBUG("%s", message);
|
||||
break;
|
||||
case wsrep::log::info:
|
||||
sql_print_information("%s", message);
|
||||
WSREP_INFO("%s", message);
|
||||
break;
|
||||
case wsrep::log::warning:
|
||||
sql_print_warning("%s", message);
|
||||
WSREP_WARN("%s", message);
|
||||
break;
|
||||
case wsrep::log::error:
|
||||
sql_print_error("%s", message);
|
||||
WSREP_ERROR("%s", message);
|
||||
break;
|
||||
case wsrep::log::unknown:
|
||||
WSREP_UNKNOWN("%s", message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Submodule wsrep-lib updated: dcf3ce91cd...515ac816f9
Reference in New Issue
Block a user