1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-28 20:02:00 +03:00

Recover current view from state after SST.

When member joins the group and needs to receive an SST it won't
receive the corresponding menbership view event because the SST
happens after the event and will already include the effects of
all events ordered before it. The view then must be recovered from
the received state.

Minor renames and cleanups.

References codership/wsrep-lib#18
This commit is contained in:
Alexey Yurchenko
2018-11-11 21:59:24 +02:00
parent c7e8bfbdb5
commit fb14883547
12 changed files with 198 additions and 27 deletions

View File

@ -244,7 +244,11 @@ namespace wsrep
static const int streaming = (1 << 15);
static const int snapshot = (1 << 16);
static const int nbo = (1 << 17);
/** decipher capability bitmask */
static std::string str(int);
};
provider(wsrep::server_state& server_state)
: server_state_(server_state)
{ }
@ -328,7 +332,7 @@ namespace wsrep
* @return Provider status indicating the result of the call.
*/
virtual std::pair<wsrep::gtid, enum status>
causal_read(int timeout) const = 0;
causal_read(int timeout) const = 0;
virtual enum status wait_for_gtid(const wsrep::gtid&, int timeout) const = 0;
/**
* Return last committed GTID.

View File

@ -130,6 +130,17 @@ namespace wsrep
wsrep::high_priority_service* high_priority_service,
const wsrep::view& view) = 0;
/**
* Recover a cluster view change event.
* The method takes own node ID.
*
* @param client_service Reference to client_service
* @param own_id this node ID obtained on connection to cluster
*/
virtual wsrep::view get_view(
wsrep::client_service& client_service,
const wsrep::id& own_id) = 0;
/**
* Log a state change event.
*

View File

@ -103,6 +103,7 @@ namespace wsrep
class transaction;
class const_buffer;
class server_service;
class client_service;
/** @class Server Context
*
@ -446,9 +447,12 @@ namespace wsrep
* initialized, the call will shift the state to initializing
* and will wait until the initialization is complete.
*
* @param client_service
* @param gtid GTID provided by the SST transfer
* @param error code of the SST operation
*/
void sst_received(const wsrep::gtid& gtid, int error);
void sst_received(wsrep::client_service& cs,
const wsrep::gtid& gtid, int error);
/**
* This method must be called after the server initialization
@ -587,7 +591,7 @@ namespace wsrep
void wait_until_state(wsrep::unique_lock<wsrep::mutex>&, enum state) const;
// Close SR transcations whose origin is outside of current
// cluster view.
void close_foreign_sr_transactions(
void close_orphaned_sr_transactions(
wsrep::unique_lock<wsrep::mutex>&,
wsrep::high_priority_service&);

View File

@ -97,6 +97,9 @@ namespace wsrep
wsrep::view::status status() const
{ return status_; }
ssize_t capabilities() const
{ return capabilities_; }
ssize_t own_index() const
{ return own_index_; }
@ -112,6 +115,11 @@ namespace wsrep
return (members_.empty() && own_index_ == -1);
}
/**
* Return member index in the view
*/
int member_index(const wsrep::id& member_id) const;
void print(std::ostream& os) const;
private: