mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-06-14 15:02:27 +03:00
Removed ostream include from public API headers.
This commit is contained in:
@ -5,6 +5,8 @@
|
|||||||
#include "db_client.hpp"
|
#include "db_client.hpp"
|
||||||
#include "db_server.hpp"
|
#include "db_server.hpp"
|
||||||
|
|
||||||
|
#include "wsrep/logger.hpp"
|
||||||
|
|
||||||
db::client::client(db::server& server,
|
db::client::client(db::server& server,
|
||||||
wsrep::client_id client_id,
|
wsrep::client_id client_id,
|
||||||
enum wsrep::client_state::mode mode,
|
enum wsrep::client_state::mode mode,
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "db_client.hpp"
|
#include "db_client.hpp"
|
||||||
#include "db_simulator.hpp"
|
#include "db_simulator.hpp"
|
||||||
|
|
||||||
|
#include "wsrep/logger.hpp"
|
||||||
|
|
||||||
db::server::server(simulator& simulator,
|
db::server::server(simulator& simulator,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::string& server_id,
|
const std::string& server_id,
|
||||||
@ -32,7 +34,7 @@ void db::server::applier_thread()
|
|||||||
&applier.client_state()));
|
&applier.client_state()));
|
||||||
enum wsrep::provider::status ret(
|
enum wsrep::provider::status ret(
|
||||||
server_state_.provider().run_applier(cc));
|
server_state_.provider().run_applier(cc));
|
||||||
wsrep::log() << "Applier thread exited with error code " << ret;
|
wsrep::log_info() << "Applier thread exited with error code " << ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void db::server::start_applier()
|
void db::server::start_applier()
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include "db_server_state.hpp"
|
#include "db_server_state.hpp"
|
||||||
#include "db_server.hpp"
|
#include "db_server.hpp"
|
||||||
|
|
||||||
|
#include "wsrep/logger.hpp"
|
||||||
|
|
||||||
wsrep::client_state* db::server_state::local_client_state()
|
wsrep::client_state* db::server_state::local_client_state()
|
||||||
{
|
{
|
||||||
return server_.local_client_state();
|
return server_.local_client_state();
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "db_simulator.hpp"
|
#include "db_simulator.hpp"
|
||||||
|
|
||||||
|
#include "wsrep/logger.hpp"
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "lock.hpp"
|
#include "lock.hpp"
|
||||||
#include "buffer.hpp"
|
#include "buffer.hpp"
|
||||||
#include "thread.hpp"
|
#include "thread.hpp"
|
||||||
#include "logger.hpp"
|
|
||||||
|
|
||||||
namespace wsrep
|
namespace wsrep
|
||||||
{
|
{
|
||||||
@ -117,12 +116,16 @@ namespace wsrep
|
|||||||
/**
|
/**
|
||||||
* Return true if the transaction commit requires
|
* Return true if the transaction commit requires
|
||||||
* two-phase commit.
|
* two-phase commit.
|
||||||
|
*
|
||||||
|
* @todo deprecate
|
||||||
*/
|
*/
|
||||||
bool do_2pc() const
|
bool do_2pc() const
|
||||||
{
|
{
|
||||||
return client_service_.do_2pc();
|
return client_service_.do_2pc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @name Client command handling */
|
||||||
|
/** @{ */
|
||||||
/**
|
/**
|
||||||
* This mehod should be called before the processing of command
|
* This mehod should be called before the processing of command
|
||||||
* received from DBMS client starts.
|
* received from DBMS client starts.
|
||||||
@ -165,7 +168,10 @@ namespace wsrep
|
|||||||
* idle.
|
* idle.
|
||||||
*/
|
*/
|
||||||
void after_command_after_result();
|
void after_command_after_result();
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/** @name Statement level operations */
|
||||||
|
/** @{ */
|
||||||
/**
|
/**
|
||||||
* Before statement execution operations.
|
* Before statement execution operations.
|
||||||
*
|
*
|
||||||
@ -199,10 +205,10 @@ namespace wsrep
|
|||||||
* * Do rollback if requested
|
* * Do rollback if requested
|
||||||
*/
|
*/
|
||||||
enum after_statement_result after_statement();
|
enum after_statement_result after_statement();
|
||||||
|
/** @} */
|
||||||
|
|
||||||
//
|
/** @name Replication interface */
|
||||||
// Replicating interface
|
/** @{ */
|
||||||
//
|
|
||||||
/**
|
/**
|
||||||
* Start a new transaction with a transaction id.
|
* Start a new transaction with a transaction id.
|
||||||
*
|
*
|
||||||
@ -240,10 +246,10 @@ namespace wsrep
|
|||||||
{
|
{
|
||||||
return client_service_.prepare_data_for_replication(*this, tc);
|
return client_service_.prepare_data_for_replication(*this, tc);
|
||||||
}
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
//
|
/** @name Streaming replication interface */
|
||||||
// Streaming interface
|
/** @{ */
|
||||||
//
|
|
||||||
/**
|
/**
|
||||||
* This method should be called after every row operation.
|
* This method should be called after every row operation.
|
||||||
*/
|
*/
|
||||||
@ -270,22 +276,7 @@ namespace wsrep
|
|||||||
int enable_streaming(
|
int enable_streaming(
|
||||||
enum wsrep::streaming_context::fragment_unit
|
enum wsrep::streaming_context::fragment_unit
|
||||||
fragment_unit,
|
fragment_unit,
|
||||||
size_t fragment_size)
|
size_t fragment_size);
|
||||||
{
|
|
||||||
assert(mode_ == m_replicating);
|
|
||||||
if (transaction_.active() &&
|
|
||||||
transaction_.streaming_context_.fragment_unit() !=
|
|
||||||
fragment_unit)
|
|
||||||
{
|
|
||||||
wsrep::log_error()
|
|
||||||
<< "Changing fragment unit for active transaction "
|
|
||||||
<< "not allowed";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
transaction_.streaming_context_.enable(
|
|
||||||
fragment_unit, fragment_size);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @todo deprecate */
|
/** @todo deprecate */
|
||||||
size_t bytes_generated() const
|
size_t bytes_generated() const
|
||||||
@ -321,11 +312,10 @@ namespace wsrep
|
|||||||
{
|
{
|
||||||
client_service_.remove_fragments(transaction_);
|
client_service_.remove_fragments(transaction_);
|
||||||
}
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
//
|
/** @name Applying interface */
|
||||||
// Applying interface
|
/** @{ */
|
||||||
//
|
|
||||||
|
|
||||||
int start_transaction(const wsrep::ws_handle& wsh,
|
int start_transaction(const wsrep::ws_handle& wsh,
|
||||||
const wsrep::ws_meta& meta)
|
const wsrep::ws_meta& meta)
|
||||||
{
|
{
|
||||||
@ -346,11 +336,10 @@ namespace wsrep
|
|||||||
*this,
|
*this,
|
||||||
transaction_.ws_handle(), transaction_.ws_meta());
|
transaction_.ws_handle(), transaction_.ws_meta());
|
||||||
}
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
//
|
/** @name Commit ordering interface */
|
||||||
// Commit ordering
|
/** @{ */
|
||||||
//
|
|
||||||
|
|
||||||
int before_prepare()
|
int before_prepare()
|
||||||
{
|
{
|
||||||
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||||
@ -382,10 +371,10 @@ namespace wsrep
|
|||||||
assert(state_ == s_exec || mode_ == m_local);
|
assert(state_ == s_exec || mode_ == m_local);
|
||||||
return transaction_.after_commit();
|
return transaction_.after_commit();
|
||||||
}
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
//
|
/** @name Rollback interface */
|
||||||
// Rollback
|
/** @{ */
|
||||||
//
|
|
||||||
int rollback()
|
int rollback()
|
||||||
{
|
{
|
||||||
return client_service_.rollback(*this);
|
return client_service_.rollback(*this);
|
||||||
@ -402,6 +391,7 @@ namespace wsrep
|
|||||||
assert(state_ == s_idle || state_ == s_exec || state_ == s_result);
|
assert(state_ == s_idle || state_ == s_exec || state_ == s_result);
|
||||||
return transaction_.after_rollback();
|
return transaction_.after_rollback();
|
||||||
}
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
//
|
//
|
||||||
// BF aborting
|
// BF aborting
|
||||||
@ -481,6 +471,33 @@ namespace wsrep
|
|||||||
*/
|
*/
|
||||||
int wait_for_gtid(const wsrep::gtid&) const;
|
int wait_for_gtid(const wsrep::gtid&) const;
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
/** @name Non-transactional operations */
|
||||||
|
/** @{*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter total order isolation critical section.
|
||||||
|
*/
|
||||||
|
int enter_toi();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Leave total order isolation critical section.
|
||||||
|
*/
|
||||||
|
void leave_toi();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Begin non-blocking operation.
|
||||||
|
*/
|
||||||
|
int begin_nbo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* End non-blocking operation
|
||||||
|
*/
|
||||||
|
void end_nbo();
|
||||||
|
/** @} */
|
||||||
//
|
//
|
||||||
// Debug interface
|
// Debug interface
|
||||||
//
|
//
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <ostream>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
namespace wsrep
|
namespace wsrep
|
||||||
{
|
{
|
||||||
@ -267,26 +265,7 @@ namespace wsrep
|
|||||||
wsrep::server_state& server_state_;
|
wsrep::server_state& server_state_;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline std::string flags_to_string(int flags)
|
std::string flags_to_string(int flags);
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
if (flags & provider::flag::start_transaction)
|
|
||||||
oss << "start_transaction | ";
|
|
||||||
if (flags & provider::flag::commit)
|
|
||||||
oss << "commit | ";
|
|
||||||
if (flags & provider::flag::rollback)
|
|
||||||
oss << "rollback | ";
|
|
||||||
if (flags & provider::flag::isolation)
|
|
||||||
oss << "isolation | ";
|
|
||||||
if (flags & provider::flag::pa_unsafe)
|
|
||||||
oss << "pa_unsafe | ";
|
|
||||||
if (flags & provider::flag::snapshot)
|
|
||||||
oss << "snapshot | ";
|
|
||||||
|
|
||||||
std::string ret(oss.str());
|
|
||||||
if (ret.size() > 3) ret.erase(ret.size() - 3);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool starts_transaction(int flags)
|
static inline bool starts_transaction(int flags)
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "exception.hpp"
|
#include "exception.hpp"
|
||||||
|
|
||||||
#include <ostream>
|
#include <iosfwd>
|
||||||
|
|
||||||
namespace wsrep
|
namespace wsrep
|
||||||
{
|
{
|
||||||
@ -65,10 +65,7 @@ namespace wsrep
|
|||||||
long long seqno_;
|
long long seqno_;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline std::ostream& operator<<(std::ostream& os, wsrep::seqno seqno)
|
std::ostream& operator<<(std::ostream& os, wsrep::seqno seqno);
|
||||||
{
|
|
||||||
return (os << seqno.get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // WSREP_SEQNO_HPP
|
#endif // WSREP_SEQNO_HPP
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||||
//
|
//
|
||||||
|
|
||||||
|
/** @file transaction.hpp */
|
||||||
#ifndef WSREP_TRANSACTION_CONTEXT_HPP
|
#ifndef WSREP_TRANSACTION_CONTEXT_HPP
|
||||||
#define WSREP_TRANSACTION_CONTEXT_HPP
|
#define WSREP_TRANSACTION_CONTEXT_HPP
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#ifndef WSREP_TRANSACTION_ID_HPP
|
#ifndef WSREP_TRANSACTION_ID_HPP
|
||||||
#define WSREP_TRANSACTION_ID_HPP
|
#define WSREP_TRANSACTION_ID_HPP
|
||||||
|
|
||||||
#include <ostream>
|
#include <iosfwd>
|
||||||
|
|
||||||
namespace wsrep
|
namespace wsrep
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ add_library(wsrep-lib
|
|||||||
id.cpp
|
id.cpp
|
||||||
logger.cpp
|
logger.cpp
|
||||||
provider.cpp
|
provider.cpp
|
||||||
|
seqno.cpp
|
||||||
server_state.cpp
|
server_state.cpp
|
||||||
transaction.cpp
|
transaction.cpp
|
||||||
wsrep_provider_v26.cpp)
|
wsrep_provider_v26.cpp)
|
||||||
|
@ -185,6 +185,26 @@ wsrep::client_state::after_statement()
|
|||||||
return asr_success;
|
return asr_success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wsrep::client_state::enable_streaming(
|
||||||
|
enum wsrep::streaming_context::fragment_unit
|
||||||
|
fragment_unit,
|
||||||
|
size_t fragment_size)
|
||||||
|
{
|
||||||
|
assert(mode_ == m_replicating);
|
||||||
|
if (transaction_.active() &&
|
||||||
|
transaction_.streaming_context_.fragment_unit() !=
|
||||||
|
fragment_unit)
|
||||||
|
{
|
||||||
|
wsrep::log_error()
|
||||||
|
<< "Changing fragment unit for active transaction "
|
||||||
|
<< "not allowed";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
transaction_.streaming_context_.enable(
|
||||||
|
fragment_unit, fragment_size);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
|
||||||
void wsrep::client_state::debug_log_state(const char* context) const
|
void wsrep::client_state::debug_log_state(const char* context) const
|
||||||
|
@ -33,3 +33,24 @@ wsrep::provider* wsrep::provider::make_provider(
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string wsrep::flags_to_string(int flags)
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
if (flags & provider::flag::start_transaction)
|
||||||
|
oss << "start_transaction | ";
|
||||||
|
if (flags & provider::flag::commit)
|
||||||
|
oss << "commit | ";
|
||||||
|
if (flags & provider::flag::rollback)
|
||||||
|
oss << "rollback | ";
|
||||||
|
if (flags & provider::flag::isolation)
|
||||||
|
oss << "isolation | ";
|
||||||
|
if (flags & provider::flag::pa_unsafe)
|
||||||
|
oss << "pa_unsafe | ";
|
||||||
|
if (flags & provider::flag::snapshot)
|
||||||
|
oss << "snapshot | ";
|
||||||
|
|
||||||
|
std::string ret(oss.str());
|
||||||
|
if (ret.size() > 3) ret.erase(ret.size() - 3);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
11
src/seqno.cpp
Normal file
11
src/seqno.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
//
|
||||||
|
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "wsrep/seqno.hpp"
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
|
std::ostream& wsrep::operator<<(std::ostream& os, wsrep::seqno seqno)
|
||||||
|
{
|
||||||
|
return (os << seqno.get());
|
||||||
|
}
|
Reference in New Issue
Block a user