mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-28 20:02:00 +03:00
Refactored most of the server_state interface into server_service
abstract interface.
This commit is contained in:
@ -5,12 +5,17 @@
|
||||
#ifndef WSREP_APPLYING_SERVICE_HPP
|
||||
#define WSREP_APPLYING_SERVICE_HPP
|
||||
|
||||
#include "transaction_termination_service.hpp"
|
||||
|
||||
namespace wsrep
|
||||
{
|
||||
class applying_service
|
||||
class ws_handle;
|
||||
class ws_meta;
|
||||
class applying_service : public wsrep::transaction_termination_service
|
||||
{
|
||||
public:
|
||||
virtual int start_transaction();
|
||||
virtual int start_transaction(const wsrep::ws_handle&,
|
||||
const wsrep::ws_meta&) = 0;
|
||||
virtual int apply_write_set(const wsrep::const_buffer&) = 0;
|
||||
virtual int apply_toi(const wsrep::const_buffer&);
|
||||
virtual int apply_nbo(const wsrep::const_buffer&);
|
||||
|
@ -66,6 +66,11 @@ namespace wsrep
|
||||
//
|
||||
// Streaming
|
||||
//
|
||||
/**
|
||||
* Return true if current statement is allowed for streaming,
|
||||
* otherwise false.
|
||||
*/
|
||||
virtual bool statement_allowed_for_streaming() const = 0;
|
||||
virtual size_t bytes_generated() const = 0;
|
||||
virtual int prepare_fragment_for_replication(wsrep::mutable_buffer&) = 0;
|
||||
virtual void remove_fragments() = 0;
|
||||
|
@ -277,7 +277,10 @@ namespace wsrep
|
||||
enum wsrep::streaming_context::fragment_unit
|
||||
fragment_unit,
|
||||
size_t fragment_size);
|
||||
|
||||
bool statement_allowed_for_streaming() const
|
||||
{
|
||||
return client_service_.statement_allowed_for_streaming();
|
||||
}
|
||||
/** @todo deprecate */
|
||||
size_t bytes_generated() const
|
||||
{
|
||||
|
@ -12,8 +12,12 @@
|
||||
namespace wsrep
|
||||
{
|
||||
class client_state;
|
||||
class ws_meta;
|
||||
class gtid;
|
||||
class view;
|
||||
class server_service
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create client state instance which acts only locally, i.e. does
|
||||
* not participate in replication. However, local client
|
||||
|
@ -63,6 +63,7 @@
|
||||
|
||||
#include "mutex.hpp"
|
||||
#include "condition_variable.hpp"
|
||||
#include "server_service.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@ -86,7 +87,7 @@ namespace wsrep
|
||||
*
|
||||
*
|
||||
*/
|
||||
class server_state
|
||||
class server_state : public wsrep::server_service
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@ -190,24 +191,6 @@ namespace wsrep
|
||||
*/
|
||||
enum rollback_mode rollback_mode() const { return rollback_mode_; }
|
||||
|
||||
/**
|
||||
* Create client context which acts only locally, i.e. does
|
||||
* not participate in replication. However, local client
|
||||
* connection may execute transactions which require ordering,
|
||||
* as when modifying local SR fragment storage requires
|
||||
* strict commit ordering.
|
||||
*
|
||||
* @return Pointer to Client Context.
|
||||
*/
|
||||
virtual client_state* local_client_state() = 0;
|
||||
|
||||
/**
|
||||
* Create applier context for streaming transaction.
|
||||
*/
|
||||
virtual client_state* streaming_applier_client_state() = 0;
|
||||
|
||||
virtual void release_client_state(wsrep::client_state*) = 0;
|
||||
|
||||
void start_streaming_applier(
|
||||
const wsrep::id&,
|
||||
const wsrep::transaction_id&,
|
||||
@ -219,10 +202,7 @@ namespace wsrep
|
||||
* Return reference to streaming applier.
|
||||
*/
|
||||
client_state* find_streaming_applier(const wsrep::id&,
|
||||
const wsrep::transaction_id&) const;
|
||||
|
||||
virtual void log_dummy_write_set(wsrep::client_state&,
|
||||
const wsrep::ws_meta&) = 0;
|
||||
const wsrep::transaction_id&) const;
|
||||
/**
|
||||
* Load WSRep provider.
|
||||
*
|
||||
@ -292,46 +272,6 @@ namespace wsrep
|
||||
*/
|
||||
void wait_until_state(wsrep::server_state::state) const;
|
||||
|
||||
/**
|
||||
* Virtual method to return true if the configured SST
|
||||
* method requires SST to be performed before DBMS storage
|
||||
* engine initialization, false otherwise.
|
||||
*/
|
||||
virtual bool sst_before_init() const = 0;
|
||||
|
||||
/**
|
||||
* Virtual method which will be called on *joiner* when the provider
|
||||
* requests the SST request information. This method should
|
||||
* provide a string containing an information which the donor
|
||||
* server can use to donate SST.
|
||||
*/
|
||||
virtual std::string on_sst_required() = 0;
|
||||
|
||||
/**
|
||||
* Virtual method which will be called on *donor* when the
|
||||
* SST request has been delivered by the provider.
|
||||
* This method should initiate SST transfer or throw
|
||||
* a wsrep::runtime_error
|
||||
* if the SST transfer cannot be initiated. If the SST request
|
||||
* initiation is succesful, the server remains in s_donor
|
||||
* state until the SST is over or fails. The @param bypass
|
||||
* should be passed to SST implementation. If the flag is true,
|
||||
* no actual SST should happen, but the joiner server should
|
||||
* be notified that the donor has seen the request. The notification
|
||||
* should included @param gtid provided. This must be passed
|
||||
* to sst_received() call on the joiner.
|
||||
*
|
||||
* @todo Figure out better exception for error codition.
|
||||
*
|
||||
* @param sst_request SST request string provided by the joiner.
|
||||
* @param gtid GTID denoting the current replication position.
|
||||
* @param bypass Boolean bypass flag.
|
||||
*/
|
||||
virtual void on_sst_request(const std::string& sst_request,
|
||||
const wsrep::gtid& gtid,
|
||||
bool bypass) = 0;
|
||||
|
||||
virtual void background_rollback(wsrep::client_state&) = 0;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -373,20 +313,6 @@ namespace wsrep
|
||||
const wsrep::ws_meta& ws_meta,
|
||||
const wsrep::const_buffer& data);
|
||||
|
||||
/**
|
||||
* This virtual method should be implemented by the DBMS
|
||||
* to provide information if the current statement in processing
|
||||
* is allowd for streaming replication.
|
||||
*
|
||||
* @return True if the statement is allowed for streaming
|
||||
* replication, false otherwise.
|
||||
*
|
||||
* @todo Move to client service interface.
|
||||
*/
|
||||
virtual bool statement_allowed_for_streaming(
|
||||
const wsrep::client_state& client_state,
|
||||
const wsrep::transaction& transaction) const;
|
||||
|
||||
/**
|
||||
* Set server wide wsrep debug logging level.
|
||||
*
|
||||
@ -420,12 +346,12 @@ namespace wsrep
|
||||
* @param rollback_mode Rollback mode which server operates on.
|
||||
*/
|
||||
server_state(wsrep::mutex& mutex,
|
||||
wsrep::condition_variable& cond,
|
||||
const std::string& name,
|
||||
const std::string& id,
|
||||
const std::string& address,
|
||||
const std::string& working_dir,
|
||||
enum rollback_mode rollback_mode)
|
||||
wsrep::condition_variable& cond,
|
||||
const std::string& name,
|
||||
const std::string& id,
|
||||
const std::string& address,
|
||||
const std::string& working_dir,
|
||||
enum rollback_mode rollback_mode)
|
||||
: mutex_(mutex)
|
||||
, cond_(cond)
|
||||
, state_(s_disconnected)
|
||||
|
Reference in New Issue
Block a user