diff options
author | Alexey Yurchenko <ayurchen@gmail.com> | 2015-03-23 23:27:28 +0200 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-05-08 17:41:06 -0400 |
commit | 4ed9ddd30eefbedb4bb2f96a0f0eb2ab18d283a0 (patch) | |
tree | 8b6080f6fd69dd9a456ce51f349fd77ff568905b /sql/wsrep_var.cc | |
parent | f5bce5a6003e0591c822f217b63dc6b65a73000a (diff) | |
download | mariadb-git-4ed9ddd30eefbedb4bb2f96a0f0eb2ab18d283a0.tar.gz |
Refs codership/mysql-wsrep#33
1. factored XID-related functions to a separate wsrep_xid.cc unit.
2. refactored them to take refrences instead of pointers where appropriate
3. implemented wsrep_get/set_SE_position to take wsrep_uuid_t and wsrep_seqno_t instead of XID
4. call wsrep_set_SE_position() in wsrep_sst_received() to reinitialize SE checkpoint after SST was received, avoid assert() in setting code by first checking current position.
Diffstat (limited to 'sql/wsrep_var.cc')
-rw-r--r-- | sql/wsrep_var.cc | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 87698576c44..00b9ce3e4e8 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -1,4 +1,4 @@ -/* Copyright 2008 Codership Oy <http://www.codership.com> +/* Copyright 2008-2015 Codership Oy <http://www.codership.com> 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 @@ -22,6 +22,7 @@ #include <sql_acl.h> #include "wsrep_priv.h" #include "wsrep_thd.h" +#include "wsrep_xid.h" #include <my_dir.h> #include <cstdio> #include <cstdlib> @@ -140,29 +141,30 @@ err: return 1; } -void wsrep_set_local_position (const char* value) +static +void wsrep_set_local_position(const char* const value, bool const sst) { - size_t value_len = strlen (value); - size_t uuid_len = wsrep_uuid_scan (value, value_len, &local_uuid); + size_t const value_len = strlen(value); + wsrep_uuid_t uuid; + size_t const uuid_len = wsrep_uuid_scan(value, value_len, &uuid); + wsrep_seqno_t const seqno = strtoll(value + uuid_len + 1, NULL, 10); - local_seqno = strtoll (value + uuid_len + 1, NULL, 10); - - XID xid; - wsrep_xid_init(&xid, &local_uuid, local_seqno); - wsrep_set_SE_checkpoint(&xid); - WSREP_INFO ("wsrep_start_position var submitted: '%s'", wsrep_start_position); + if (sst) { + wsrep_sst_received (wsrep, uuid, seqno, NULL, 0); + } else { + // initialization + local_uuid = uuid; + local_seqno = seqno; + } } bool wsrep_start_position_update (sys_var *self, THD* thd, enum_var_type type) { + WSREP_INFO ("wsrep_start_position var submitted: '%s'", + wsrep_start_position); // since this value passed wsrep_start_position_check, don't check anything // here - wsrep_set_local_position (wsrep_start_position); - - if (wsrep) { - wsrep_sst_received (wsrep, &local_uuid, local_seqno, NULL, 0); - } - + wsrep_set_local_position (wsrep_start_position, true); return 0; } @@ -175,7 +177,7 @@ void wsrep_start_position_init (const char* val) return; } - wsrep_set_local_position (val); + wsrep_set_local_position (val, false); } static bool refresh_provider_options() @@ -212,7 +214,7 @@ static int wsrep_provider_verify (const char* provider_str) return 1; /* check that provider file exists */ - bzero(&f_stat, sizeof(MY_STAT)); + memset(&f_stat, 0, sizeof(MY_STAT)); if (!my_stat(path, &f_stat, MYF(0))) { return 1; |