Skip to content

Commit 33aad1d

Browse files
committed
MDEV-15505 Fixes to compilation without -DWITH_WSREP:BOOL=ON
Removed including wsrep_api.h from service_wsrep.h. This caused various kinds of collisions with definitions when wsrep is not supposed to be built in. Defined functions wsrep_xid_seqno() and wsrep_xid_uuid() in wsrep_dummy.cc. Replaced wsrep_seqno_t with long long where wsrep_api.h is not included. Removed wsrep_xid_seqno() macro from wsrep_mysqld.h and made wsrep code using wsrep_xid_seqno() in handler.cc to be compiled in only if WITH_WSREP is ON. Included wsrep_api.h for mariabackup if WITH_WSREP is ON.
1 parent b125ae0 commit 33aad1d

File tree

9 files changed

+30
-14
lines changed

9 files changed

+30
-14
lines changed

cmake/wsrep.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,4 @@ SET(WSREP_PROC_INFO ${WITH_WSREP})
4040

4141
IF(WITH_WSREP)
4242
SET(WSREP_PATCH_VERSION "wsrep_${WSREP_VERSION}")
43-
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/wsrep)
4443
ENDIF()

extra/mariabackup/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ IF(NOT HAVE_SYSTEM_REGEX)
4040
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pcre)
4141
ENDIF()
4242

43+
IF(WITH_WSREP)
44+
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep)
45+
ENDIF()
46+
4347
ADD_DEFINITIONS(-UMYSQL_SERVER)
4448
########################################################################
4549
# xtrabackup binary

extra/mariabackup/wsrep.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ permission notice:
4949
#include "common.h"
5050
#ifdef WITH_WSREP
5151

52+
#include <wsrep_api.h>
53+
5254
/*! Name of file where Galera info is stored on recovery */
5355
#define XB_GALERA_INFO_FILENAME "xtrabackup_galera_info"
5456

@@ -62,7 +64,7 @@ xb_write_galera_info(bool incremental_prepare)
6264
FILE* fp;
6365
XID xid;
6466
char uuid_str[40];
65-
wsrep_seqno_t seqno;
67+
long long seqno;
6668
MY_STAT statinfo;
6769

6870
/* Do not overwrite existing an existing file to be compatible with

include/mysql/service_wsrep.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
For engines that want to support galera.
2323
*/
2424

25-
#include <wsrep_api.h>
26-
2725
#ifdef __cplusplus
2826
extern "C" {
2927
#endif
@@ -69,7 +67,9 @@ enum wsrep_trx_status {
6967
};
7068

7169
struct xid_t;
70+
struct wsrep;
7271
struct wsrep_ws_handle;
72+
struct wsrep_buf;
7373

7474
extern struct wsrep_service_st {
7575
struct wsrep * (*get_wsrep_func)();
@@ -84,7 +84,7 @@ extern struct wsrep_service_st {
8484
void (*wsrep_aborting_thd_enqueue_func)(THD *thd);
8585
bool (*wsrep_consistency_check_func)(THD *thd);
8686
int (*wsrep_is_wsrep_xid_func)(const struct xid_t *xid);
87-
wsrep_seqno_t (*wsrep_xid_seqno_func)(const struct xid_t *xid);
87+
long long (*wsrep_xid_seqno_func)(const struct xid_t *xid);
8888
const unsigned char* (*wsrep_xid_uuid_func)(const struct xid_t *xid);
8989
void (*wsrep_lock_rollback_func)();
9090
int (*wsrep_on_func)(MYSQL_THD);
@@ -186,7 +186,7 @@ enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd);
186186
enum wsrep_query_state wsrep_thd_query_state(THD *thd);
187187
enum wsrep_trx_status wsrep_run_wsrep_commit(THD *thd, bool all);
188188
int wsrep_is_wsrep_xid(const struct xid_t* xid);
189-
wsrep_seqno_t wsrep_xid_seqno(const struct xid_t* xid);
189+
long long wsrep_xid_seqno(const struct xid_t* xid);
190190
const unsigned char* wsrep_xid_uuid(const struct xid_t* xid);
191191
int wsrep_on(MYSQL_THD thd);
192192
int wsrep_thd_retry_counter(THD *thd);

sql/handler.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,11 +1484,13 @@ int ha_commit_trans(THD *thd, bool all)
14841484
DEBUG_SYNC(thd, "ha_commit_trans_after_prepare");
14851485
DBUG_EXECUTE_IF("crash_commit_after_prepare", DBUG_SUICIDE(););
14861486

1487+
#ifdef WITH_WSREP
14871488
if (!error && WSREP_ON && wsrep_is_wsrep_xid(&thd->transaction.xid_state.xid))
14881489
{
14891490
// xid was rewritten by wsrep
14901491
xid= wsrep_xid_seqno(thd->transaction.xid_state.xid);
14911492
}
1493+
#endif /* WITH_WSREP */
14921494

14931495
if (!is_real_trans)
14941496
{
@@ -1914,9 +1916,10 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
19141916
got, hton_name(hton)->str);
19151917
for (int i=0; i < got; i ++)
19161918
{
1917-
my_xid x= WSREP_ON && wsrep_is_wsrep_xid(&info->list[i]) ?
1918-
wsrep_xid_seqno(info->list[i]) :
1919-
info->list[i].get_my_xid();
1919+
my_xid x= IF_WSREP(WSREP_ON && wsrep_is_wsrep_xid(&info->list[i]) ?
1920+
wsrep_xid_seqno(info->list[i]) :
1921+
info->list[i].get_my_xid(),
1922+
info->list[i].get_my_xid());
19201923
if (!x) // not "mine" - that is generated by external TM
19211924
{
19221925
#ifndef DBUG_OFF

sql/wsrep_dummy.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ enum wsrep_conflict_state wsrep_thd_conflict_state(THD *, my_bool)
2929
int wsrep_is_wsrep_xid(const XID*)
3030
{ return 0; }
3131

32+
long long wsrep_xid_seqno(const XID* x)
33+
{ return -1; }
34+
35+
const unsigned char* wsrep_xid_uuid(const XID*)
36+
{
37+
static const unsigned char uuid[16] = {0};
38+
return uuid;
39+
}
40+
3241
bool wsrep_prepare_key(const uchar*, size_t, const uchar*, size_t, struct wsrep_buf*, size_t*)
3342
{ return 0; }
3443

sql/wsrep_mysqld.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ bool wsrep_node_is_synced();
328328
#define WSREP_FORMAT(my_format) ((ulong)my_format)
329329
#define WSREP_PROVIDER_EXISTS (0)
330330
#define wsrep_emulate_bin_log (0)
331-
#define wsrep_xid_seqno(X) (0)
332331
#define wsrep_to_isolation (0)
333332
#define wsrep_init() (1)
334333
#define wsrep_prepend_PATH(X)

sql/wsrep_xid.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ wsrep_seqno_t wsrep_xid_seqno(const XID& xid)
9191
return ret;
9292
}
9393

94-
wsrep_seqno_t wsrep_xid_seqno(const xid_t* xid)
94+
long long wsrep_xid_seqno(const xid_t* xid)
9595
{
9696
DBUG_ASSERT(xid);
9797
return wsrep_xid_seqno(*xid);

storage/innobase/trx/trx0rseg.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Created 3/26/1996 Heikki Tuuri
3939

4040
#ifdef UNIV_DEBUG
4141
/** The latest known WSREP XID sequence number */
42-
static wsrep_seqno_t wsrep_seqno = -1;
42+
static long long wsrep_seqno = -1;
4343
#endif /* UNIV_DEBUG */
4444
/** The latest known WSREP XID UUID */
4545
static unsigned char wsrep_uuid[16];
@@ -58,7 +58,7 @@ trx_rseg_update_wsrep_checkpoint(
5858

5959
#ifdef UNIV_DEBUG
6060
/* Check that seqno is monotonically increasing */
61-
wsrep_seqno_t xid_seqno = wsrep_xid_seqno(xid);
61+
long long xid_seqno = wsrep_xid_seqno(xid);
6262
const byte* xid_uuid = wsrep_xid_uuid(xid);
6363

6464
if (!memcmp(xid_uuid, wsrep_uuid, sizeof wsrep_uuid)) {
@@ -227,7 +227,7 @@ bool trx_rseg_read_wsrep_checkpoint(XID& xid)
227227
}
228228

229229
XID tmp_xid;
230-
wsrep_seqno_t tmp_seqno = 0;
230+
long long tmp_seqno = 0;
231231
if (trx_rseg_read_wsrep_checkpoint(rseg_header, tmp_xid)
232232
&& (tmp_seqno = wsrep_xid_seqno(&tmp_xid))
233233
> max_xid_seqno) {

0 commit comments

Comments
 (0)