| 1520 | } |
| 1521 | |
| 1522 | void BenchmarkContext::initializeFromConfig(const Poco::Util::AbstractConfiguration & config) |
| 1523 | { |
| 1524 | default_acls = getDefaultACLs(); |
| 1525 | |
| 1526 | use_remove_recursive = config.getBool("use_remove_recursive", true); |
| 1527 | |
| 1528 | std::cerr << "---- Parsing setup ---- " << std::endl; |
| 1529 | static const std::string setup_key = "setup"; |
| 1530 | Poco::Util::AbstractConfiguration::Keys keys; |
| 1531 | config.keys(setup_key, keys); |
| 1532 | for (const auto & key : keys) |
| 1533 | { |
| 1534 | if (key.starts_with("node")) |
| 1535 | { |
| 1536 | auto node_key = setup_key + "." + key; |
| 1537 | auto parsed_root_node = parseNode(node_key, config); |
| 1538 | const auto node = root_nodes.emplace_back(parsed_root_node); |
| 1539 | |
| 1540 | if (config.has(node_key + ".repeat")) |
| 1541 | { |
| 1542 | if (!node->name.isRandom()) |
| 1543 | throw DB::Exception(DB::ErrorCodes::BAD_ARGUMENTS, "Repeating node creation for key {}, but name is not randomly generated", node_key); |
| 1544 | |
| 1545 | auto repeat_count = config.getUInt64(node_key + ".repeat"); |
| 1546 | node->repeat_count = repeat_count; |
| 1547 | for (size_t i = 1; i < repeat_count; ++i) |
| 1548 | root_nodes.emplace_back(node->clone()); |
| 1549 | } |
| 1550 | |
| 1551 | std::cerr << "Tree to create:" << std::endl; |
| 1552 | |
| 1553 | node->dumpTree(); |
| 1554 | std::cerr << std::endl; |
| 1555 | } |
| 1556 | } |
| 1557 | std::cerr << "---- Done parsing data setup ----\n" << std::endl; |
| 1558 | } |
| 1559 | |
| 1560 | std::shared_ptr<BenchmarkContext::Node> BenchmarkContext::parseNode(const std::string & key, const Poco::Util::AbstractConfiguration & config) |
| 1561 | { |
no test coverage detected