1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-31 18:24:25 +03:00

Added TOI client mode, replced string with const char* in debug calls.

This commit is contained in:
Teemu Ollakka
2018-05-21 16:42:40 +03:00
parent 90f6eb1ecf
commit 646a2b328e
8 changed files with 76 additions and 32 deletions

View File

@ -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>(&params.n_transactions),
"number of transactions run by a client")
("alg-freq", po::value<size_t>(&params.alg_freq),
"ALG frequency")
("debug-log-level", po::value<int>(&params.debug_log_level),
"debug logging level: 0 - none, 1 - verbose")
("fast-exit", po::value<int>(&params.fast_exit),

View File

@ -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();
}

View File

@ -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)
{