From db5bcb50ef6543dc269014f815c22fbb6aee281d Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Mon, 7 May 2018 19:04:41 +0300 Subject: [PATCH] Renamed SST related interface methods. --- src/dbms_simulator.cpp | 16 ++++++---------- src/mock_server_context.hpp | 10 +++++----- src/server_context.cpp | 12 ++++++++---- src/server_context.hpp | 19 ++++++++++++++----- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/dbms_simulator.cpp b/src/dbms_simulator.cpp index 06332c4..969f90f 100644 --- a/src/dbms_simulator.cpp +++ b/src/dbms_simulator.cpp @@ -238,22 +238,18 @@ public: } bool sst_before_init() const override { return false; } - std::string on_sst_request() + std::string on_sst_required() { return id(); } - void on_sst_donate_request(const std::string& req, - const wsrep_gtid_t& gtid, - bool bypass) + void on_sst_request(const std::string& req, + const wsrep_gtid_t& gtid, + bool bypass) { simulator_.donate_sst(*this, req, gtid, bypass); } - void sst_sent(const wsrep_gtid_t& gtid) - { - provider().sst_sent(gtid, 0); - } // Client context management trrep::client_context* local_client_context(); @@ -669,8 +665,8 @@ void dbms_simulator::donate_sst(dbms_server& server, { trrep::log() << "SST " << server.id() << " -> " << id; } - i->second->sst_received(gtid); - server.sst_sent(gtid); + i->second->sst_received(gtid, 0); + server.sst_sent(gtid, 0); } std::string dbms_simulator::build_cluster_address() const { diff --git a/src/mock_server_context.hpp b/src/mock_server_context.hpp index 0621f61..106ab0f 100644 --- a/src/mock_server_context.hpp +++ b/src/mock_server_context.hpp @@ -39,11 +39,11 @@ namespace trrep void on_view(const trrep::view&) TRREP_OVERRIDE { } void on_sync() TRREP_OVERRIDE { } bool sst_before_init() const TRREP_OVERRIDE { return false; } - std::string on_sst_request() TRREP_OVERRIDE { return ""; } - void on_sst_donate_request(const std::string&, - const wsrep_gtid_t&, - bool) TRREP_OVERRIDE { } - void sst_received(const wsrep_gtid_t&) TRREP_OVERRIDE { } + std::string on_sst_required() TRREP_OVERRIDE { return ""; } + void on_sst_request(const std::string&, + const wsrep_gtid_t&, + bool) TRREP_OVERRIDE { } + // void sst_received(const wsrep_gtid_t&, int) TRREP_OVERRIDE { } // void on_apply(trrep::transaction_context&) { } // void on_commit(trrep::transaction_context&) { } diff --git a/src/server_context.cpp b/src/server_context.cpp index eaa2959..55501bb 100644 --- a/src/server_context.cpp +++ b/src/server_context.cpp @@ -90,7 +90,7 @@ namespace 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_len = strlen(req.c_str()); return WSREP_CB_SUCCESS; @@ -161,7 +161,7 @@ namespace { std::string req(reinterpret_cast(req_buf->ptr), req_buf->len); - server_context.on_sst_donate_request(req, *gtid, bypass); + server_context.on_sst_request(req, *gtid, bypass); return WSREP_CB_SUCCESS; } catch (const trrep::runtime_error& e) @@ -232,9 +232,13 @@ trrep::server_context::~server_context() 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( diff --git a/src/server_context.hpp b/src/server_context.hpp index e16906b..cdc12a3 100644 --- a/src/server_context.hpp +++ b/src/server_context.hpp @@ -272,7 +272,7 @@ namespace trrep * provide a string containing an information which the donor * 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 @@ -294,9 +294,15 @@ namespace trrep * \param gtid GTID denoting the current replication position. * \param bypass Boolean bypass flag. */ - virtual void on_sst_donate_request(const std::string& sst_request, - const wsrep_gtid_t& gtid, - bool bypass) = 0; + virtual void on_sst_request(const std::string& sst_request, + const wsrep_gtid_t& gtid, + bool bypass) = 0; + + + /*! + * + */ + void sst_sent(const wsrep_gtid_t& gtid, int error); /*! * 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 */ - 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 * a remote write set is being applied. It is the responsibility