mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-30 07:23:07 +03:00
Bootstrap server service, fixes to server state management
* Added bootstrap service call to do DBMS side bootstrap operations during the cluster bootstrap. * Added last_committed_gtid() to provider interface * Implemented wait_for_gtid() provider call * Pass initial position to the server state
This commit is contained in:
@ -16,8 +16,8 @@ namespace wsrep
|
||||
{
|
||||
public:
|
||||
gtid()
|
||||
: id_()
|
||||
, seqno_()
|
||||
: id_(wsrep::id::undefined())
|
||||
, seqno_(wsrep::seqno::undefined())
|
||||
{ }
|
||||
gtid(const wsrep::id& id, wsrep::seqno seqno)
|
||||
: id_(id)
|
||||
@ -41,6 +41,7 @@ namespace wsrep
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream&, const wsrep::gtid&);
|
||||
std::istream& operator>>(std::istream&, wsrep::gtid&);
|
||||
}
|
||||
|
||||
#endif // WSREP_GTID_HPP
|
||||
|
@ -299,6 +299,11 @@ namespace wsrep
|
||||
* @return Provider status indicating the result of the call.
|
||||
*/
|
||||
virtual enum status causal_read(int timeout) const = 0;
|
||||
virtual enum status wait_for_gtid(const wsrep::gtid&, int timeout) const = 0;
|
||||
/**
|
||||
* Return last committed GTID.
|
||||
*/
|
||||
virtual wsrep::gtid last_committed_gtid() const = 0;
|
||||
virtual int sst_sent(const wsrep::gtid&, int) = 0;
|
||||
virtual int sst_received(const wsrep::gtid&, int) = 0;
|
||||
|
||||
|
@ -55,6 +55,18 @@ namespace wsrep
|
||||
*/
|
||||
virtual void background_rollback(wsrep::client_state&) = 0;
|
||||
|
||||
/**
|
||||
* Bootstrap a DBMS state for a new cluster.
|
||||
*
|
||||
* This method is called by the wsrep lib after the
|
||||
* new cluster is bootstrapped and the server has reached
|
||||
* initialized state. From this call the DBMS should initialize
|
||||
* environment for the new cluster.
|
||||
*
|
||||
* @param gtid Gtid of the bootstrap position.
|
||||
*/
|
||||
virtual void bootstrap() = 0;
|
||||
|
||||
/**
|
||||
* Log message
|
||||
*
|
||||
|
@ -193,6 +193,11 @@ namespace wsrep
|
||||
*/
|
||||
const std::string& working_dir() const { return working_dir_; }
|
||||
|
||||
/**
|
||||
* Return initial position for server.
|
||||
*/
|
||||
const wsrep::gtid& initial_position() const
|
||||
{ return initial_position_; }
|
||||
/**
|
||||
* Return maximum protocol version.
|
||||
*/
|
||||
@ -316,7 +321,8 @@ namespace wsrep
|
||||
*
|
||||
* @return Zero on success, non-zero on failure.
|
||||
*/
|
||||
int wait_for_gtid(const wsrep::gtid&) const;
|
||||
enum wsrep::provider::status
|
||||
wait_for_gtid(const wsrep::gtid&, int timeout) const;
|
||||
|
||||
/**
|
||||
* Perform a causal read in the cluster. After the call returns,
|
||||
@ -484,6 +490,7 @@ namespace wsrep
|
||||
const std::string& id,
|
||||
const std::string& address,
|
||||
const std::string& working_dir,
|
||||
const wsrep::gtid& initial_position,
|
||||
int max_protocol_version,
|
||||
enum rollback_mode rollback_mode)
|
||||
: mutex_(mutex)
|
||||
@ -492,6 +499,8 @@ namespace wsrep
|
||||
, state_(s_disconnected)
|
||||
, state_hist_()
|
||||
, state_waiters_(n_states_)
|
||||
, bootstrap_()
|
||||
, initial_position_(initial_position)
|
||||
, init_initialized_()
|
||||
, init_synced_()
|
||||
, sst_gtid_()
|
||||
@ -529,6 +538,8 @@ namespace wsrep
|
||||
enum state state_;
|
||||
std::vector<enum state> state_hist_;
|
||||
mutable std::vector<int> state_waiters_;
|
||||
bool bootstrap_;
|
||||
const wsrep::gtid initial_position_;
|
||||
bool init_initialized_;
|
||||
bool init_synced_;
|
||||
wsrep::gtid sst_gtid_;
|
||||
|
@ -86,7 +86,6 @@ namespace wsrep
|
||||
|
||||
int protocol_version() const
|
||||
{ return protocol_version_; }
|
||||
|
||||
const std::vector<member>& members() const { return members_; }
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user