mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-06-11 16:48:11 +03:00
Added topology argument to dbsim to allow testing master/slave
This commit is contained in:
@ -6,6 +6,28 @@
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace
|
||||
{
|
||||
void validate_params(const db::params& params)
|
||||
{
|
||||
std::ostringstream os;
|
||||
if (params.n_servers != params.topology.size())
|
||||
{
|
||||
if (params.topology.size() > 0)
|
||||
{
|
||||
os << "Error: --topology=" << params.topology << " does not "
|
||||
<< "match the number of server --servers="
|
||||
<< params.n_servers << "\n";
|
||||
}
|
||||
}
|
||||
if (os.str().size())
|
||||
{
|
||||
throw std::invalid_argument(os.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
db::params db::parse_args(int argc, char** argv)
|
||||
{
|
||||
@ -22,8 +44,10 @@ db::params db::parse_args(int argc, char** argv)
|
||||
"wsrep provider options")
|
||||
("servers", po::value<size_t>(¶ms.n_servers)->required(),
|
||||
"number of servers to start")
|
||||
("topology", po::value<std::string>(¶ms.topology),
|
||||
"replication topology (e.g. mm for multi master, ms for master/slave")
|
||||
("clients", po::value<size_t>(¶ms.n_clients)->required(),
|
||||
"number of clients to start per server")
|
||||
"number of clients to start per master")
|
||||
("transactions", po::value<size_t>(¶ms.n_transactions),
|
||||
"number of transactions run by a client")
|
||||
("rows", po::value<size_t>(¶ms.n_rows),
|
||||
@ -42,5 +66,7 @@ db::params db::parse_args(int argc, char** argv)
|
||||
std::cerr << desc << "\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
validate_params(params);
|
||||
return params;
|
||||
}
|
||||
|
Reference in New Issue
Block a user