1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-06-17 13:22:00 +03:00

Renamed SST related interface methods.

This commit is contained in:
Teemu Ollakka
2018-05-07 19:04:41 +03:00
parent abf8ef34fc
commit db5bcb50ef
4 changed files with 33 additions and 24 deletions

View File

@ -238,22 +238,18 @@ public:
} }
bool sst_before_init() const override { return false; } bool sst_before_init() const override { return false; }
std::string on_sst_request() std::string on_sst_required()
{ {
return id(); return id();
} }
void on_sst_donate_request(const std::string& req, void on_sst_request(const std::string& req,
const wsrep_gtid_t& gtid, const wsrep_gtid_t& gtid,
bool bypass) bool bypass)
{ {
simulator_.donate_sst(*this, req, gtid, bypass); simulator_.donate_sst(*this, req, gtid, bypass);
} }
void sst_sent(const wsrep_gtid_t& gtid)
{
provider().sst_sent(gtid, 0);
}
// Client context management // Client context management
trrep::client_context* local_client_context(); trrep::client_context* local_client_context();
@ -669,8 +665,8 @@ void dbms_simulator::donate_sst(dbms_server& server,
{ {
trrep::log() << "SST " << server.id() << " -> " << id; trrep::log() << "SST " << server.id() << " -> " << id;
} }
i->second->sst_received(gtid); i->second->sst_received(gtid, 0);
server.sst_sent(gtid); server.sst_sent(gtid, 0);
} }
std::string dbms_simulator::build_cluster_address() const std::string dbms_simulator::build_cluster_address() const
{ {

View File

@ -39,11 +39,11 @@ namespace trrep
void on_view(const trrep::view&) TRREP_OVERRIDE { } void on_view(const trrep::view&) TRREP_OVERRIDE { }
void on_sync() TRREP_OVERRIDE { } void on_sync() TRREP_OVERRIDE { }
bool sst_before_init() const TRREP_OVERRIDE { return false; } bool sst_before_init() const TRREP_OVERRIDE { return false; }
std::string on_sst_request() TRREP_OVERRIDE { return ""; } std::string on_sst_required() TRREP_OVERRIDE { return ""; }
void on_sst_donate_request(const std::string&, void on_sst_request(const std::string&,
const wsrep_gtid_t&, const wsrep_gtid_t&,
bool) TRREP_OVERRIDE { } bool) TRREP_OVERRIDE { }
void sst_received(const wsrep_gtid_t&) TRREP_OVERRIDE { } // void sst_received(const wsrep_gtid_t&, int) TRREP_OVERRIDE { }
// void on_apply(trrep::transaction_context&) { } // void on_apply(trrep::transaction_context&) { }
// void on_commit(trrep::transaction_context&) { } // void on_commit(trrep::transaction_context&) { }

View File

@ -90,7 +90,7 @@ namespace
try try
{ {
std::string req(server_context.on_sst_request()); std::string req(server_context.on_sst_required());
*sst_req = ::strdup(req.c_str()); *sst_req = ::strdup(req.c_str());
*sst_req_len = strlen(req.c_str()); *sst_req_len = strlen(req.c_str());
return WSREP_CB_SUCCESS; return WSREP_CB_SUCCESS;
@ -161,7 +161,7 @@ namespace
{ {
std::string req(reinterpret_cast<const char*>(req_buf->ptr), std::string req(reinterpret_cast<const char*>(req_buf->ptr),
req_buf->len); req_buf->len);
server_context.on_sst_donate_request(req, *gtid, bypass); server_context.on_sst_request(req, *gtid, bypass);
return WSREP_CB_SUCCESS; return WSREP_CB_SUCCESS;
} }
catch (const trrep::runtime_error& e) catch (const trrep::runtime_error& e)
@ -232,9 +232,13 @@ trrep::server_context::~server_context()
delete provider_; delete provider_;
} }
void trrep::server_context::sst_received(const wsrep_gtid_t& gtid) void trrep::server_context::sst_sent(const wsrep_gtid_t& gtid, int error)
{ {
provider_->sst_received(gtid, 0); provider_->sst_sent(gtid, error);
}
void trrep::server_context::sst_received(const wsrep_gtid_t& gtid, int error)
{
provider_->sst_received(gtid, error);
} }
void trrep::server_context::wait_until_state( void trrep::server_context::wait_until_state(

View File

@ -272,7 +272,7 @@ namespace trrep
* provide a string containing an information which the donor * provide a string containing an information which the donor
* server can use to donate SST. * server can use to donate SST.
*/ */
virtual std::string on_sst_request() = 0; virtual std::string on_sst_required() = 0;
/*! /*!
* Virtual method which will be called on *donor* when the * Virtual method which will be called on *donor* when the
@ -294,9 +294,15 @@ namespace trrep
* \param gtid GTID denoting the current replication position. * \param gtid GTID denoting the current replication position.
* \param bypass Boolean bypass flag. * \param bypass Boolean bypass flag.
*/ */
virtual void on_sst_donate_request(const std::string& sst_request, virtual void on_sst_request(const std::string& sst_request,
const wsrep_gtid_t& gtid, const wsrep_gtid_t& gtid,
bool bypass) = 0; bool bypass) = 0;
/*!
*
*/
void sst_sent(const wsrep_gtid_t& gtid, int error);
/*! /*!
* This method must be called by the joiner after the SST * This method must be called by the joiner after the SST
@ -304,8 +310,11 @@ namespace trrep
* *
* \param gtid GTID provided by the SST transfer * \param gtid GTID provided by the SST transfer
*/ */
void sst_received(const wsrep_gtid_t& gtid); void sst_received(const wsrep_gtid_t& gtid, int error);
/*!
*
*/
/*! /*!
* This method will be called by the provider hen * This method will be called by the provider hen
* a remote write set is being applied. It is the responsibility * a remote write set is being applied. It is the responsibility