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

- Initialize member cluster ID only on connection to cluster and forget

it on disconnect.
 - Don't rely on own index from the view because the view may come from
   another member (IST/SST), instead always determine own index from own ID.

Refs codership/wsrep-lib#13
This commit is contained in:
Alexey Yurchenko
2018-11-06 15:21:48 +02:00
parent a942811ce7
commit ea9971d54b
13 changed files with 185 additions and 52 deletions

View File

@ -296,7 +296,7 @@ namespace wsrep
* A method which will be called when the server
* has been joined to the cluster
*/
void on_connect(const wsrep::gtid& gtid);
void on_connect(const wsrep::view& view);
/**
* A method which will be called when a view
@ -540,7 +540,6 @@ namespace wsrep
wsrep::condition_variable& cond,
wsrep::server_service& server_service,
const std::string& name,
const std::string& id,
const std::string& incoming_address,
const std::string& address,
const std::string& working_dir,
@ -565,7 +564,7 @@ namespace wsrep
, streaming_appliers_()
, provider_()
, name_(name)
, id_(id)
, id_(wsrep::id::undefined())
, incoming_address_(incoming_address)
, address_(address)
, working_dir_(working_dir)

View File

@ -30,6 +30,7 @@
#include "seqno.hpp"
#include "gtid.hpp"
#include <vector>
#include <iostream>
namespace wsrep
{
@ -111,6 +112,8 @@ namespace wsrep
return (members_.empty() && own_index_ == -1);
}
void print(std::ostream& os) const;
private:
wsrep::gtid state_id_;
wsrep::seqno view_seqno_;
@ -120,6 +123,12 @@ namespace wsrep
int protocol_version_;
std::vector<wsrep::view::member> members_;
};
static inline
std::ostream& operator<<(std::ostream& os, const wsrep::view& v)
{
v.print(os); return os;
}
}
#endif // WSREP_VIEW