summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTeemu Ollakka <teemu.ollakka@galeracluster.com>2018-03-07 18:40:15 +0200
committerTeemu Ollakka <teemu.ollakka@galeracluster.com>2018-03-12 14:46:20 +0200
commitdd74b94823711ecb4529b8368c2f6161f39b9fa0 (patch)
treee9daf35be635413542f3f91179031d8cb228798d /include
parent09c5c335e3e8447e7d07c987293042175b51b495 (diff)
downloadmariadb-git-dd74b94823711ecb4529b8368c2f6161f39b9fa0.tar.gz
MDEV-15505 Fix wsrep XID seqno byte order
The problem is that the seqno part of wsrep XID is always stored in host byte order. This may cause issues when a physical backup is restored on a host with different architecture, the seqno part with XID may have incorrect value. In order to fix this, wsrep XID seqno is always written into XID data buffer in little endian byte order using int8store() and read from data buffer using sint8korr(). For backwards compatibility the seqno is read from TRX_SYS page in host byte order during upgrade. This patch implements byte ordering in wsrep_xid_init(), wsrep_xid_seqno(), and exposes functions to read wsrep XID uuid and seqno in wsrep_service_st. Backwards compatibility for upgrade is provided in trx_rseg_init_wsrep_xid().
Diffstat (limited to 'include')
-rw-r--r--include/mysql/service_wsrep.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h
index bc5b2c67cdc..a64ad610508 100644
--- a/include/mysql/service_wsrep.h
+++ b/include/mysql/service_wsrep.h
@@ -70,6 +70,8 @@ struct xid_t;
struct wsrep;
struct wsrep_ws_handle;
struct wsrep_buf;
+/* must match to typedef in wsrep/wsrep_api.h */
+typedef int64_t wsrep_seqno_t;
extern struct wsrep_service_st {
struct wsrep * (*get_wsrep_func)();
@@ -84,6 +86,8 @@ extern struct wsrep_service_st {
void (*wsrep_aborting_thd_enqueue_func)(THD *thd);
bool (*wsrep_consistency_check_func)(THD *thd);
int (*wsrep_is_wsrep_xid_func)(const struct xid_t *xid);
+ wsrep_seqno_t (*wsrep_xid_seqno_func)(const struct xid_t *xid);
+ const unsigned char* (*wsrep_xid_uuid_func)(const struct xid_t *xid);
void (*wsrep_lock_rollback_func)();
int (*wsrep_on_func)(MYSQL_THD);
void (*wsrep_post_commit_func)(THD* thd, bool all);
@@ -125,6 +129,8 @@ extern struct wsrep_service_st {
#define wsrep_aborting_thd_enqueue(T) wsrep_service->wsrep_aborting_thd_enqueue_func(T)
#define wsrep_consistency_check(T) wsrep_service->wsrep_consistency_check_func(T)
#define wsrep_is_wsrep_xid(X) wsrep_service->wsrep_is_wsrep_xid_func(X)
+#define wsrep_xid_seqno(X) wsrep_service->wsrep_xid_seqno_func(X)
+#define wsrep_xid_uuid(X) wsrep_service->wsrep_xid_uuid_func(X)
#define wsrep_lock_rollback() wsrep_service->wsrep_lock_rollback_func()
#define wsrep_on(X) wsrep_service->wsrep_on_func(X)
#define wsrep_post_commit(T,A) wsrep_service->wsrep_post_commit_func(T,A)
@@ -182,6 +188,8 @@ enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd);
enum wsrep_query_state wsrep_thd_query_state(THD *thd);
enum wsrep_trx_status wsrep_run_wsrep_commit(THD *thd, bool all);
int wsrep_is_wsrep_xid(const struct xid_t* xid);
+wsrep_seqno_t wsrep_xid_seqno(const struct xid_t* xid);
+const unsigned char* wsrep_xid_uuid(const struct xid_t* xid);
int wsrep_on(MYSQL_THD thd);
int wsrep_thd_retry_counter(THD *thd);
int wsrep_trx_is_aborting(MYSQL_THD thd);