2014-08-06 14:39:15 +02:00
|
|
|
/* Copyright 2014 Codership Oy <http://www.codership.com> & SkySQL Ab
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2019-05-11 21:19:05 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
|
2014-08-06 14:39:15 +02:00
|
|
|
|
|
|
|
#ifndef WSREP_INCLUDED
|
2014-09-25 23:00:45 +02:00
|
|
|
#define WSREP_INCLUDED
|
2014-08-06 14:39:15 +02:00
|
|
|
|
2019-01-23 12:30:00 +01:00
|
|
|
#include <my_config.h>
|
2022-02-15 14:36:02 +01:00
|
|
|
#include "log.h"
|
2019-01-23 12:30:00 +01:00
|
|
|
|
2014-08-06 14:39:15 +02:00
|
|
|
#ifdef WITH_WSREP
|
|
|
|
#define IF_WSREP(A,B) A
|
|
|
|
#define DBUG_ASSERT_IF_WSREP(A) DBUG_ASSERT(A)
|
|
|
|
|
2022-02-15 14:36:02 +01:00
|
|
|
extern ulong wsrep_debug; // wsrep_mysqld.cc
|
|
|
|
extern void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...);
|
2016-02-24 07:21:40 +01:00
|
|
|
|
2014-08-06 14:39:15 +02:00
|
|
|
#define WSREP_DEBUG(...) \
|
|
|
|
if (wsrep_debug) 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_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__)
|
2022-02-15 14:36:02 +01:00
|
|
|
#define WSREP_UNKNOWN(fmt, ...) WSREP_ERROR("UNKNOWN: " fmt, ##__VA_ARGS__)
|
|
|
|
|
|
|
|
#define WSREP_LOG_CONFLICT_THD(thd, role) \
|
|
|
|
WSREP_INFO("%s: \n " \
|
|
|
|
" THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \
|
|
|
|
" SQL: %s", \
|
|
|
|
role, \
|
|
|
|
thd_get_thread_id(thd), \
|
|
|
|
wsrep_thd_client_mode_str(thd), \
|
|
|
|
wsrep_thd_client_state_str(thd), \
|
|
|
|
wsrep_thd_transaction_state_str(thd), \
|
|
|
|
wsrep_thd_trx_seqno(thd), \
|
|
|
|
wsrep_thd_query(thd) \
|
|
|
|
);
|
|
|
|
|
|
|
|
#define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \
|
|
|
|
if (wsrep_debug || wsrep_log_conflicts) \
|
|
|
|
{ \
|
|
|
|
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_INFO("context: %s:%d", __FILE__, __LINE__); \
|
|
|
|
}
|
2014-08-06 14:39:15 +02:00
|
|
|
|
2017-08-21 12:35:00 +02:00
|
|
|
|
2019-01-23 12:30:00 +01:00
|
|
|
#else /* !WITH_WSREP */
|
|
|
|
|
|
|
|
/* These macros are needed to compile MariaDB without WSREP support
|
|
|
|
* (e.g. embedded) */
|
|
|
|
|
2014-08-06 14:39:15 +02:00
|
|
|
#define IF_WSREP(A,B) B
|
2019-01-23 12:30:00 +01:00
|
|
|
//#define DBUG_ASSERT_IF_WSREP(A)
|
2014-08-06 14:39:15 +02:00
|
|
|
#define WSREP_DEBUG(...)
|
2019-01-23 12:30:00 +01:00
|
|
|
//#define WSREP_INFO(...)
|
|
|
|
//#define WSREP_WARN(...)
|
2014-08-06 14:39:15 +02:00
|
|
|
#define WSREP_ERROR(...)
|
2017-08-21 12:35:00 +02:00
|
|
|
#endif /* WITH_WSREP */
|
2014-08-06 14:39:15 +02:00
|
|
|
|
2017-08-21 12:35:00 +02:00
|
|
|
#endif /* WSREP_INCLUDED */
|