mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-30 07:23:07 +03:00
Added TOI client mode, replced string with const char* in debug calls.
This commit is contained in:
@ -99,7 +99,9 @@ namespace trrep
|
||||
/*! Generates write sets for replication by the provider. */
|
||||
m_replicating,
|
||||
/*! Applies write sets from the provider. */
|
||||
m_applier
|
||||
m_applier,
|
||||
/*! Client is in total order isolation mode */
|
||||
m_toi
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -345,6 +347,7 @@ namespace trrep
|
||||
const trrep::data&);
|
||||
friend class client_context_switch;
|
||||
friend class client_applier_mode;
|
||||
friend class client_toi_mode;
|
||||
friend class transaction_context;
|
||||
|
||||
/*!
|
||||
@ -450,12 +453,12 @@ namespace trrep
|
||||
/*!
|
||||
* Enter debug synchronization point.
|
||||
*/
|
||||
virtual void debug_sync(const std::string&) = 0;
|
||||
virtual void debug_sync(const char*) = 0;
|
||||
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
virtual void debug_suicide(const std::string&) = 0;
|
||||
virtual void debug_suicide(const char*) = 0;
|
||||
|
||||
/*!
|
||||
* Notify the implementation about an error.
|
||||
@ -526,6 +529,27 @@ namespace trrep
|
||||
trrep::client_context& client_;
|
||||
enum trrep::client_context::mode orig_mode_;
|
||||
};
|
||||
|
||||
class client_toi_mode
|
||||
{
|
||||
public:
|
||||
client_toi_mode(trrep::client_context& client)
|
||||
: client_(client)
|
||||
, orig_mode_(client.mode_)
|
||||
{
|
||||
client_.mode_ = trrep::client_context::m_toi;
|
||||
}
|
||||
~client_toi_mode()
|
||||
{
|
||||
assert(client_.mode == trrep::client_context::m_toi);
|
||||
client_.mode_ = orig_mode_;
|
||||
}
|
||||
private:
|
||||
trrep::client_context& client_;
|
||||
enum trrep::client_context::mode orig_mode_;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // TRREP_CLIENT_CONTEXT_HPP
|
||||
|
@ -225,34 +225,31 @@ namespace trrep
|
||||
bool bootstrap);
|
||||
|
||||
int disconnect();
|
||||
/*!
|
||||
* Virtual method which will be called when the server
|
||||
* has been joined to the cluster. Must be provided by
|
||||
* the implementation.
|
||||
*
|
||||
* \todo Document overriding.
|
||||
*/
|
||||
virtual void on_connect();
|
||||
|
||||
/*!
|
||||
* Virtual method which will be called when a view
|
||||
* A method which will be called when the server
|
||||
* has been joined to the cluster
|
||||
*/
|
||||
void on_connect();
|
||||
|
||||
/*!
|
||||
* A method which will be called when a view
|
||||
* notification event has been delivered by the
|
||||
* provider.
|
||||
*
|
||||
* \todo Document overriding.
|
||||
*
|
||||
* \params view trrep::view object which holds the new view
|
||||
* information.
|
||||
*/
|
||||
virtual void on_view(const trrep::view& view);
|
||||
void on_view(const trrep::view& view);
|
||||
|
||||
/*!
|
||||
* Virtual method which will be called when the server
|
||||
* A method which will be called when the server
|
||||
* has been synchronized with the cluster.
|
||||
*
|
||||
* \todo Document overriding.
|
||||
* This will have a side effect of changing the Server Context
|
||||
* state to s_synced.
|
||||
*/
|
||||
virtual void on_sync();
|
||||
void on_sync();
|
||||
|
||||
/*!
|
||||
* Wait until server reaches given state.
|
||||
@ -312,6 +309,13 @@ namespace trrep
|
||||
*/
|
||||
void sst_received(const wsrep_gtid_t& gtid, int error);
|
||||
|
||||
/*!
|
||||
* This method must be called after the server initialization
|
||||
* has been completed. The call has a side effect of changing
|
||||
* the Server Context state to s_initialized.
|
||||
*/
|
||||
void initialized();
|
||||
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
|
@ -150,7 +150,7 @@ namespace trrep
|
||||
void remove_fragments();
|
||||
void clear_fragments();
|
||||
void cleanup();
|
||||
void debug_log_state(const std::string&) const;
|
||||
void debug_log_state(const char*) const;
|
||||
|
||||
trrep::provider& provider_;
|
||||
trrep::client_context& client_context_;
|
||||
|
@ -17,11 +17,11 @@ function run_benchmark()
|
||||
}
|
||||
|
||||
|
||||
# for servers in 1 2 4 8 16
|
||||
for servers in 16
|
||||
for servers in 1 2 4 8 16
|
||||
# for servers in 16
|
||||
do
|
||||
# for clients in 1 2 4 8 16 32
|
||||
for clients in 4 8 16 32
|
||||
for clients in 1 2 4 8 16 32
|
||||
# for clients in 4 8 16 32
|
||||
do
|
||||
run_benchmark $servers $clients
|
||||
done
|
||||
|
@ -38,6 +38,7 @@ struct dbms_simulator_params
|
||||
size_t n_servers;
|
||||
size_t n_clients;
|
||||
size_t n_transactions;
|
||||
size_t alg_freq;
|
||||
std::string wsrep_provider;
|
||||
std::string wsrep_provider_options;
|
||||
int debug_log_level;
|
||||
@ -46,6 +47,7 @@ struct dbms_simulator_params
|
||||
: n_servers(0)
|
||||
, n_clients(0)
|
||||
, n_transactions(0)
|
||||
, alg_freq(0)
|
||||
, wsrep_provider()
|
||||
, wsrep_provider_options()
|
||||
, debug_log_level(0)
|
||||
@ -56,10 +58,10 @@ struct dbms_simulator_params
|
||||
class dbms_storage_engine
|
||||
{
|
||||
public:
|
||||
dbms_storage_engine()
|
||||
dbms_storage_engine(const dbms_simulator_params& params)
|
||||
: mutex_()
|
||||
, transactions_()
|
||||
, alg_freq_(0)
|
||||
, alg_freq_(params.alg_freq)
|
||||
, bf_aborts_()
|
||||
{ }
|
||||
|
||||
@ -212,7 +214,7 @@ public:
|
||||
name, id, address, name + "_data",
|
||||
trrep::server_context::rm_async)
|
||||
, simulator_(simulator)
|
||||
, storage_engine_()
|
||||
, storage_engine_(simulator_.params())
|
||||
, mutex_()
|
||||
, cond_()
|
||||
, last_client_id_(0)
|
||||
@ -372,8 +374,8 @@ private:
|
||||
bool killed() const override { return false; }
|
||||
void abort() const override { ::abort(); }
|
||||
void store_globals() override { }
|
||||
void debug_sync(const std::string&) override { }
|
||||
void debug_suicide(const std::string&) override { }
|
||||
void debug_sync(const char*) override { }
|
||||
void debug_suicide(const char*) override { }
|
||||
void on_error(enum trrep::client_error) override { }
|
||||
|
||||
template <class Func>
|
||||
@ -714,6 +716,8 @@ int main(int argc, char** argv)
|
||||
"number of clients to start per server")
|
||||
("transactions", po::value<size_t>(¶ms.n_transactions),
|
||||
"number of transactions run by a client")
|
||||
("alg-freq", po::value<size_t>(¶ms.alg_freq),
|
||||
"ALG frequency")
|
||||
("debug-log-level", po::value<int>(¶ms.debug_log_level),
|
||||
"debug logging level: 0 - none, 1 - verbose")
|
||||
("fast-exit", po::value<int>(¶ms.fast_exit),
|
||||
|
@ -50,8 +50,8 @@ namespace trrep
|
||||
bool killed() const TRREP_OVERRIDE { return false; }
|
||||
void abort() const TRREP_OVERRIDE { }
|
||||
void store_globals() TRREP_OVERRIDE { }
|
||||
void debug_sync(const std::string&) TRREP_OVERRIDE { }
|
||||
void debug_suicide(const std::string&) TRREP_OVERRIDE
|
||||
void debug_sync(const char*) TRREP_OVERRIDE { }
|
||||
void debug_suicide(const char*) TRREP_OVERRIDE
|
||||
{
|
||||
::abort();
|
||||
}
|
||||
|
@ -131,6 +131,9 @@ int trrep::transaction_context::before_prepare()
|
||||
case trrep::client_context::m_local:
|
||||
case trrep::client_context::m_applier:
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
assert(state() == s_preparing);
|
||||
@ -174,6 +177,9 @@ int trrep::transaction_context::after_prepare()
|
||||
state(lock, s_committing);
|
||||
ret = 0;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
debug_log_state("after_prepare_leave");
|
||||
return ret;
|
||||
@ -267,6 +273,9 @@ int trrep::transaction_context::before_commit()
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
debug_log_state("before_commit_leave");
|
||||
return ret;
|
||||
@ -310,6 +319,9 @@ int trrep::transaction_context::after_commit()
|
||||
break;
|
||||
case trrep::client_context::m_applier:
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
assert(ret == 0);
|
||||
state(lock, s_committed);
|
||||
@ -806,7 +818,7 @@ void trrep::transaction_context::cleanup()
|
||||
}
|
||||
|
||||
void trrep::transaction_context::debug_log_state(
|
||||
const std::string& context TRREP_UNUSED) const
|
||||
const char* context) const
|
||||
{
|
||||
if (client_context_.debug_log_level() >= 1)
|
||||
{
|
||||
|
2
wsrep
2
wsrep
Submodule wsrep updated: 955da1c8c2...e12a9dd89c
Reference in New Issue
Block a user