Commit 033f8d13 authored by Alexey Yurchenko's avatar Alexey Yurchenko Committed by Jan Lindström

Update wsrep-lib (new logger interface)

Ensure consistent use of logging macros in wsrep-related code
Reviewed-by: default avatarJan Lindström <jan.lindstrom@mariadb.com>
parent 7edbd272
...@@ -316,29 +316,31 @@ wsp::node_status local_status; ...@@ -316,29 +316,31 @@ wsp::node_status local_status;
*/ */
Wsrep_schema *wsrep_schema= 0; 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 Silence all wsrep related logging from lib and provider if
wsrep is not enabled. wsrep is not enabled.
*/ */
if (WSREP_ON) if (!WSREP_ON) return;
{
switch (level) { switch (level) {
case wsrep::log::info: case wsrep::log::info:
sql_print_information("WSREP: %s", msg); WSREP_INFO("%s", msg);
break; break;
case wsrep::log::warning: case wsrep::log::warning:
sql_print_warning("WSREP: %s", msg); WSREP_WARN("%s", msg);
break; break;
case wsrep::log::error: case wsrep::log::error:
sql_print_error("WSREP: %s", msg); WSREP_ERROR("%s", msg);
break;
case wsrep::log::debug:
WSREP_DEBUG("%s", msg);
break;
case wsrep::log::unknown:
WSREP_UNKNOWN("%s", msg);
break; break;
case wsrep::log::debug:
if (wsrep_debug) sql_print_information ("[Debug] WSREP: %s", msg);
default:
break;
}
} }
} }
......
...@@ -251,30 +251,30 @@ void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...); ...@@ -251,30 +251,30 @@ void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...);
#define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__) #define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
#define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__) #define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__)
#define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__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) \ #define WSREP_LOG_CONFLICT_THD(thd, role) \
WSREP_LOG(sql_print_information, \ WSREP_INFO("%s: \n " \
"%s: \n " \ " THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \
" THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \ " SQL: %s", \
" SQL: %s", \ role, \
role, \ thd_get_thread_id(thd), \
thd_get_thread_id(thd), \ wsrep_thd_client_mode_str(thd), \
wsrep_thd_client_mode_str(thd), \ wsrep_thd_client_state_str(thd), \
wsrep_thd_client_state_str(thd), \ wsrep_thd_transaction_state_str(thd), \
wsrep_thd_transaction_state_str(thd), \ wsrep_thd_trx_seqno(thd), \
wsrep_thd_trx_seqno(thd), \ wsrep_thd_query(thd) \
wsrep_thd_query(thd) \
); );
#define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \ #define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \
if (wsrep_debug || wsrep_log_conflicts) \ 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" \ (bf_abort) ? "high priority abort" : "certification failure" \
); \ ); \
if (bf_thd) WSREP_LOG_CONFLICT_THD(bf_thd, "Winning thread"); \ if (bf_thd) WSREP_LOG_CONFLICT_THD(bf_thd, "Winning thread"); \
if (victim_thd) WSREP_LOG_CONFLICT_THD(victim_thd, "Victim 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 \ #define WSREP_PROVIDER_EXISTS \
......
...@@ -162,16 +162,19 @@ void Wsrep_server_service::log_message(enum wsrep::log::level level, ...@@ -162,16 +162,19 @@ void Wsrep_server_service::log_message(enum wsrep::log::level level,
switch (level) switch (level)
{ {
case wsrep::log::debug: case wsrep::log::debug:
sql_print_information("debug: %s", message); WSREP_DEBUG("%s", message);
break; break;
case wsrep::log::info: case wsrep::log::info:
sql_print_information("%s", message); WSREP_INFO("%s", message);
break; break;
case wsrep::log::warning: case wsrep::log::warning:
sql_print_warning("%s", message); WSREP_WARN("%s", message);
break; break;
case wsrep::log::error: case wsrep::log::error:
sql_print_error("%s", message); WSREP_ERROR("%s", message);
break;
case wsrep::log::unknown:
WSREP_UNKNOWN("%s", message);
break; break;
} }
} }
......
Subproject commit dcf3ce91cdb9d254ae04ecc6a2f91f46b171280d Subproject commit 515ac816f98329c0227d0060cc9339c889810834
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