mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Remove generator name config
This commit is contained in:
parent
46533c1ea7
commit
e9d43a8f6a
@ -87,64 +87,6 @@ void removeRecursive(Coordination::ZooKeeper & zookeeper, const std::string & pa
|
||||
remove_future.get();
|
||||
}
|
||||
|
||||
std::unique_ptr<Generator> getGenerator(const std::string & name)
|
||||
{
|
||||
//if (name == "create_no_data")
|
||||
//{
|
||||
// return std::make_unique<CreateRequestGenerator>();
|
||||
//}
|
||||
//else if (name == "create_small_data")
|
||||
//{
|
||||
// return std::make_unique<CreateRequestGenerator>("/create_generator", 5, 32);
|
||||
//}
|
||||
//else if (name == "create_medium_data")
|
||||
//{
|
||||
// return std::make_unique<CreateRequestGenerator>("/create_generator", 5, 1024);
|
||||
//}
|
||||
//else if (name == "create_big_data")
|
||||
//{
|
||||
// return std::make_unique<CreateRequestGenerator>("/create_generator", 5, 512 * 1024);
|
||||
//}
|
||||
//else if (name == "get_no_data")
|
||||
//{
|
||||
// return std::make_unique<GetRequestGenerator>("/get_generator", 10, 0);
|
||||
//}
|
||||
//else if (name == "get_small_data")
|
||||
//{
|
||||
// return std::make_unique<GetRequestGenerator>("/get_generator", 10, 32);
|
||||
//}
|
||||
//else if (name == "get_medium_data")
|
||||
//{
|
||||
// return std::make_unique<GetRequestGenerator>("/get_generator", 10, 1024);
|
||||
//}
|
||||
//else if (name == "get_big_data")
|
||||
//{
|
||||
// return std::make_unique<GetRequestGenerator>("/get_generator", 10, 512 * 1024);
|
||||
//}
|
||||
//else if (name == "list_no_nodes")
|
||||
//{
|
||||
// return std::make_unique<ListRequestGenerator>("/list_generator", 0, 1);
|
||||
//}
|
||||
//else if (name == "list_few_nodes")
|
||||
//{
|
||||
// return std::make_unique<ListRequestGenerator>("/list_generator", 10, 5);
|
||||
//}
|
||||
//else if (name == "list_medium_nodes")
|
||||
//{
|
||||
// return std::make_unique<ListRequestGenerator>("/list_generator", 1000, 5);
|
||||
//}
|
||||
//else if (name == "list_a_lot_nodes")
|
||||
//{
|
||||
// return std::make_unique<ListRequestGenerator>("/list_generator", 100000, 5);
|
||||
//}
|
||||
//else if (name == "set_small_data")
|
||||
//{
|
||||
// return std::make_unique<SetRequestGenerator>("/set_generator", 5);
|
||||
//}
|
||||
|
||||
throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "Unknown generator {}", name);
|
||||
}
|
||||
|
||||
NumberGetter
|
||||
NumberGetter::fromConfig(const std::string & key, const Poco::Util::AbstractConfiguration & config, std::optional<uint64_t> default_value)
|
||||
{
|
||||
@ -321,6 +263,10 @@ std::string PathGetter::description() const
|
||||
return description;
|
||||
}
|
||||
|
||||
RequestGetter::RequestGetter(std::vector<RequestGeneratorPtr> request_generators_)
|
||||
: request_generators(std::move(request_generators_))
|
||||
{}
|
||||
|
||||
RequestGetter RequestGetter::fromConfig(const std::string & key, const Poco::Util::AbstractConfiguration & config, bool for_multi)
|
||||
{
|
||||
RequestGetter request_getter;
|
||||
@ -658,7 +604,7 @@ Generator::Generator(const Poco::Util::AbstractConfiguration & config)
|
||||
|
||||
static const std::string generator_key = "generator";
|
||||
|
||||
std::cout << "---- Parsing setup ---- " << std::endl;
|
||||
std::cout << "---- Parsing setup ---- " << std::endl;
|
||||
static const std::string setup_key = generator_key + ".setup";
|
||||
Poco::Util::AbstractConfiguration::Keys keys;
|
||||
config.keys(setup_key, keys);
|
||||
|
@ -9,115 +9,6 @@
|
||||
#include <Poco/Util/AbstractConfiguration.h>
|
||||
#include <Common/randomSeed.h>
|
||||
|
||||
|
||||
std::string generateRandomPath(const std::string & prefix, size_t length = 5);
|
||||
|
||||
std::string generateRandomData(size_t size);
|
||||
|
||||
//
|
||||
//class CreateRequestGenerator final : public IGenerator
|
||||
//{
|
||||
//public:
|
||||
// explicit CreateRequestGenerator(
|
||||
// std::string path_prefix_ = "/create_generator",
|
||||
// std::optional<uint64_t> path_length_ = std::nullopt,
|
||||
// std::optional<uint64_t> data_size_ = std::nullopt)
|
||||
// : path_prefix(path_prefix_)
|
||||
// , path_length(path_length_)
|
||||
// , data_size(data_size_)
|
||||
// {}
|
||||
//
|
||||
// void startup(Coordination::ZooKeeper & zookeeper) override;
|
||||
// Coordination::ZooKeeperRequestPtr generate() override;
|
||||
//
|
||||
//private:
|
||||
// std::string path_prefix;
|
||||
// std::optional<uint64_t> path_length;
|
||||
// std::optional<uint64_t> data_size;
|
||||
// std::unordered_set<std::string> paths_created;
|
||||
//};
|
||||
//
|
||||
//
|
||||
//class GetRequestGenerator final : public IGenerator
|
||||
//{
|
||||
//public:
|
||||
// explicit GetRequestGenerator(
|
||||
// std::string path_prefix_ = "/get_generator",
|
||||
// std::optional<uint64_t> num_nodes_ = std::nullopt,
|
||||
// std::optional<uint64_t> nodes_data_size_ = std::nullopt)
|
||||
// : path_prefix(path_prefix_)
|
||||
// , num_nodes(num_nodes_)
|
||||
// , nodes_data_size(nodes_data_size_)
|
||||
// , rng(randomSeed())
|
||||
// , distribution(0, num_nodes ? *num_nodes - 1 : 0)
|
||||
// {}
|
||||
//
|
||||
// void startup(Coordination::ZooKeeper & zookeeper) override;
|
||||
// Coordination::ZooKeeperRequestPtr generate() override;
|
||||
//
|
||||
//private:
|
||||
// std::string path_prefix;
|
||||
// std::optional<uint64_t> num_nodes;
|
||||
// std::optional<uint64_t> nodes_data_size;
|
||||
// std::vector<std::string> paths_to_get;
|
||||
//
|
||||
// pcg64 rng;
|
||||
// std::uniform_int_distribution<size_t> distribution;
|
||||
//};
|
||||
//
|
||||
//class ListRequestGenerator final : public IGenerator
|
||||
//{
|
||||
//public:
|
||||
// explicit ListRequestGenerator(
|
||||
// std::string path_prefix_ = "/list_generator",
|
||||
// std::optional<uint64_t> num_nodes_ = std::nullopt,
|
||||
// std::optional<uint64_t> paths_length_ = std::nullopt)
|
||||
// : path_prefix(path_prefix_)
|
||||
// , num_nodes(num_nodes_)
|
||||
// , paths_length(paths_length_)
|
||||
// {}
|
||||
//
|
||||
// void startup(Coordination::ZooKeeper & zookeeper) override;
|
||||
// Coordination::ZooKeeperRequestPtr generate() override;
|
||||
//
|
||||
//private:
|
||||
// std::string path_prefix;
|
||||
// std::optional<uint64_t> num_nodes;
|
||||
// std::optional<uint64_t> paths_length;
|
||||
//};
|
||||
//
|
||||
//class SetRequestGenerator final : public IGenerator
|
||||
//{
|
||||
//public:
|
||||
// explicit SetRequestGenerator(
|
||||
// std::string path_prefix_ = "/set_generator",
|
||||
// uint64_t data_size_ = 5)
|
||||
// : path_prefix(path_prefix_)
|
||||
// , data_size(data_size_)
|
||||
// {}
|
||||
//
|
||||
// void startup(Coordination::ZooKeeper & zookeeper) override;
|
||||
// Coordination::ZooKeeperRequestPtr generate() override;
|
||||
//
|
||||
//private:
|
||||
// std::string path_prefix;
|
||||
// uint64_t data_size;
|
||||
//};
|
||||
//
|
||||
//class MixedRequestGenerator final : public IGenerator
|
||||
//{
|
||||
//public:
|
||||
// explicit MixedRequestGenerator(std::vector<std::unique_ptr<IGenerator>> generators_)
|
||||
// : generators(std::move(generators_))
|
||||
// {}
|
||||
//
|
||||
// void startup(Coordination::ZooKeeper & zookeeper) override;
|
||||
// Coordination::ZooKeeperRequestPtr generate() override;
|
||||
//
|
||||
//private:
|
||||
// std::vector<std::unique_ptr<IGenerator>> generators;
|
||||
//};
|
||||
|
||||
struct NumberGetter
|
||||
{
|
||||
static NumberGetter fromConfig(const std::string & key, const Poco::Util::AbstractConfiguration & config, std::optional<uint64_t> default_value = std::nullopt);
|
||||
@ -247,6 +138,10 @@ private:
|
||||
|
||||
struct RequestGetter
|
||||
{
|
||||
explicit RequestGetter(std::vector<RequestGeneratorPtr> request_generators_);
|
||||
|
||||
RequestGetter() = default;
|
||||
|
||||
static RequestGetter fromConfig(const std::string & key, const Poco::Util::AbstractConfiguration & config, bool for_multi = false);
|
||||
|
||||
RequestGeneratorPtr getRequestGenerator() const;
|
||||
@ -279,7 +174,6 @@ public:
|
||||
void startup(Coordination::ZooKeeper & zookeeper);
|
||||
Coordination::ZooKeeperRequestPtr generate();
|
||||
void cleanup(Coordination::ZooKeeper & zookeeper);
|
||||
|
||||
private:
|
||||
struct Node
|
||||
{
|
||||
@ -299,4 +193,4 @@ private:
|
||||
Coordination::ACLs default_acls;
|
||||
};
|
||||
|
||||
std::unique_ptr<Generator> getGenerator(const std::string & name);
|
||||
std::optional<Generator> getGenerator(const std::string & name);
|
||||
|
@ -13,7 +13,6 @@ namespace DB::ErrorCodes
|
||||
|
||||
Runner::Runner(
|
||||
std::optional<size_t> concurrency_,
|
||||
const std::string & generator_name,
|
||||
const std::string & config_path,
|
||||
const Strings & hosts_strings_,
|
||||
std::optional<double> max_time_,
|
||||
@ -23,28 +22,10 @@ Runner::Runner(
|
||||
: info(std::make_shared<Stats>())
|
||||
{
|
||||
|
||||
DB::ConfigurationPtr config = nullptr;
|
||||
DB::ConfigProcessor config_processor(config_path, true, false);
|
||||
auto config = config_processor.loadConfig().configuration;
|
||||
|
||||
if (!config_path.empty())
|
||||
{
|
||||
DB::ConfigProcessor config_processor(config_path, true, false);
|
||||
config = config_processor.loadConfig().configuration;
|
||||
}
|
||||
|
||||
if (!generator_name.empty())
|
||||
{
|
||||
//generator = getGenerator(generator_name);
|
||||
|
||||
if (!generator)
|
||||
throw DB::Exception(DB::ErrorCodes::BAD_ARGUMENTS, "Failed to create generator");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!config)
|
||||
throw DB::Exception(DB::ErrorCodes::BAD_ARGUMENTS, "No config file or generator name defined");
|
||||
|
||||
generator.emplace(*config);
|
||||
}
|
||||
generator.emplace(*config);
|
||||
|
||||
if (!hosts_strings_.empty())
|
||||
{
|
||||
@ -60,34 +41,38 @@ Runner::Runner(
|
||||
}
|
||||
|
||||
std::cout << "---- Run options ---- " << std::endl;
|
||||
static constexpr uint64_t DEFAULT_CONCURRENCY = 1;
|
||||
if (concurrency_)
|
||||
concurrency = *concurrency_;
|
||||
else
|
||||
concurrency = config->getUInt64("concurrency", 1);
|
||||
concurrency = config->getUInt64("concurrency", DEFAULT_CONCURRENCY);
|
||||
std::cout << "Concurrency: " << concurrency << std::endl;
|
||||
|
||||
static constexpr uint64_t DEFAULT_ITERATIONS = 0;
|
||||
if (max_iterations_)
|
||||
max_iterations = *max_iterations_;
|
||||
else
|
||||
max_iterations = config->getUInt64("iterations", 0);
|
||||
max_iterations = config->getUInt64("iterations", DEFAULT_ITERATIONS);
|
||||
std::cout << "Iterations: " << max_iterations << std::endl;
|
||||
|
||||
static constexpr double DEFAULT_DELAY = 1.0;
|
||||
if (delay_)
|
||||
delay = *delay_;
|
||||
else
|
||||
delay = config->getDouble("report_delay", 1);
|
||||
delay = config->getDouble("report_delay", DEFAULT_DELAY);
|
||||
std::cout << "Report delay: " << delay << std::endl;
|
||||
|
||||
static constexpr double DEFAULT_TIME_LIMIT = 1.0;
|
||||
if (max_time_)
|
||||
max_time = *max_time_;
|
||||
else
|
||||
max_time = config->getDouble("timelimit", 1.0);
|
||||
max_time = config->getDouble("timelimit", DEFAULT_TIME_LIMIT);
|
||||
std::cout << "Time limit: " << max_time << std::endl;
|
||||
|
||||
if (continue_on_error_)
|
||||
continue_on_error = *continue_on_error_;
|
||||
else
|
||||
continue_on_error = config->getBool("continue_on_error", 1.0);
|
||||
continue_on_error = config->getBool("continue_on_error", false);
|
||||
std::cout << "Continue on error: " << continue_on_error << std::endl;
|
||||
std::cout << "---- Run options ----\n" << std::endl;
|
||||
|
||||
|
@ -35,7 +35,6 @@ class Runner
|
||||
public:
|
||||
Runner(
|
||||
std::optional<size_t> concurrency_,
|
||||
const std::string & generator_name,
|
||||
const std::string & config_path,
|
||||
const Strings & hosts_strings_,
|
||||
std::optional<double> max_time_,
|
||||
|
@ -34,7 +34,6 @@ int main(int argc, char *argv[])
|
||||
boost::program_options::options_description desc = createOptionsDescription("Allowed options", getTerminalWidth());
|
||||
desc.add_options()
|
||||
("help", "produce help message")
|
||||
("generator", value<std::string>()->default_value(""), "query to execute")
|
||||
("config", value<std::string>()->default_value(""), "yaml/xml file containing configuration")
|
||||
("concurrency,c", value<unsigned>(), "number of parallel queries")
|
||||
("report-delay,d", value<double>(), "delay between intermediate reports in seconds (set 0 to disable reports)")
|
||||
@ -56,7 +55,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
Runner runner(valueToOptional<unsigned>(options["concurrency"]),
|
||||
options["generator"].as<std::string>(),
|
||||
options["config"].as<std::string>(),
|
||||
options["hosts"].as<Strings>(),
|
||||
valueToOptional<double>(options["time-limit"]),
|
||||
|
Loading…
Reference in New Issue
Block a user